mirror of
https://github.com/Kevsl/crypto-exchange-api.git
synced 2025-07-09 14:00:12 +02:00
fix: fixed quantity display on cryptos
This commit is contained in:
parent
cf8fbe4fe5
commit
49faaf4fa0
@ -1,12 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
Body,
|
Body,
|
||||||
Controller,
|
Controller,
|
||||||
Delete,
|
// Delete,
|
||||||
Get,
|
Get,
|
||||||
HttpCode,
|
HttpCode,
|
||||||
HttpStatus,
|
HttpStatus,
|
||||||
Param,
|
Param,
|
||||||
Patch,
|
// Patch,
|
||||||
Post,
|
Post,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
@ -55,19 +55,19 @@ export class CryptoController {
|
|||||||
) {
|
) {
|
||||||
return this.cryptoService.buyCrypto(user.id, dto);
|
return this.cryptoService.buyCrypto(user.id, dto);
|
||||||
}
|
}
|
||||||
@HttpCode(HttpStatus.OK)
|
// @HttpCode(HttpStatus.OK)
|
||||||
@Patch('/update/:id')
|
// @Patch('/update/:id')
|
||||||
editCryptoById(
|
// editCryptoById(
|
||||||
@Param('id') cryptoId: string,
|
// @Param('id') cryptoId: string,
|
||||||
@Body() dto: CryptoDto,
|
// @Body() dto: CryptoDto,
|
||||||
@GetUser() user: User,
|
// @GetUser() user: User,
|
||||||
) {
|
// ) {
|
||||||
return this.cryptoService.editCryptoById(user.id, cryptoId, dto);
|
// return this.cryptoService.editCryptoById(user.id, cryptoId, dto);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@HttpCode(HttpStatus.NO_CONTENT)
|
// @HttpCode(HttpStatus.NO_CONTENT)
|
||||||
@Delete('/delete/:id')
|
// @Delete('/delete/:id')
|
||||||
deleteOfferById(@Param('id') roleId: string, @GetUser() user: User) {
|
// deleteOfferById(@Param('id') roleId: string, @GetUser() user: User) {
|
||||||
return this.cryptoService.deleteCryptoById(user.id, roleId);
|
// return this.cryptoService.deleteCryptoById(user.id, roleId);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ export class CryptoService {
|
|||||||
await checkUserHasAccount(userId);
|
await checkUserHasAccount(userId);
|
||||||
|
|
||||||
if (cryptoId) {
|
if (cryptoId) {
|
||||||
return this.prisma.crypto.findMany({
|
return this.prisma.cryptoHistory.findMany({
|
||||||
where: {
|
where: {
|
||||||
id: cryptoId,
|
id_crypto: cryptoId,
|
||||||
},
|
},
|
||||||
|
|
||||||
orderBy: {
|
orderBy: {
|
||||||
|
@ -21,6 +21,7 @@ export class UserService {
|
|||||||
UserHasCrypto: {
|
UserHasCrypto: {
|
||||||
select: {
|
select: {
|
||||||
Crypto: true,
|
Crypto: true,
|
||||||
|
amount: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -40,10 +41,14 @@ export class UserService {
|
|||||||
UserHasCrypto: {
|
UserHasCrypto: {
|
||||||
select: {
|
select: {
|
||||||
Crypto: true,
|
Crypto: true,
|
||||||
|
amount: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
take: 50,
|
take: 50,
|
||||||
|
orderBy: {
|
||||||
|
dollarAvailables: 'desc',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user