fix: fixed quantity display on cryptos

This commit is contained in:
Kevsl 2024-06-12 21:26:29 +02:00
parent cf8fbe4fe5
commit 49faaf4fa0
3 changed files with 23 additions and 18 deletions

View File

@ -1,12 +1,12 @@
import {
Body,
Controller,
Delete,
// Delete,
Get,
HttpCode,
HttpStatus,
Param,
Patch,
// Patch,
Post,
UseGuards,
} from '@nestjs/common';
@ -55,19 +55,19 @@ export class CryptoController {
) {
return this.cryptoService.buyCrypto(user.id, dto);
}
@HttpCode(HttpStatus.OK)
@Patch('/update/:id')
editCryptoById(
@Param('id') cryptoId: string,
@Body() dto: CryptoDto,
@GetUser() user: User,
) {
return this.cryptoService.editCryptoById(user.id, cryptoId, dto);
}
// @HttpCode(HttpStatus.OK)
// @Patch('/update/:id')
// editCryptoById(
// @Param('id') cryptoId: string,
// @Body() dto: CryptoDto,
// @GetUser() user: User,
// ) {
// return this.cryptoService.editCryptoById(user.id, cryptoId, dto);
// }
@HttpCode(HttpStatus.NO_CONTENT)
@Delete('/delete/:id')
deleteOfferById(@Param('id') roleId: string, @GetUser() user: User) {
return this.cryptoService.deleteCryptoById(user.id, roleId);
}
// @HttpCode(HttpStatus.NO_CONTENT)
// @Delete('/delete/:id')
// deleteOfferById(@Param('id') roleId: string, @GetUser() user: User) {
// return this.cryptoService.deleteCryptoById(user.id, roleId);
// }
}

View File

@ -36,9 +36,9 @@ export class CryptoService {
await checkUserHasAccount(userId);
if (cryptoId) {
return this.prisma.crypto.findMany({
return this.prisma.cryptoHistory.findMany({
where: {
id: cryptoId,
id_crypto: cryptoId,
},
orderBy: {

View File

@ -21,6 +21,7 @@ export class UserService {
UserHasCrypto: {
select: {
Crypto: true,
amount: true,
},
},
},
@ -40,10 +41,14 @@ export class UserService {
UserHasCrypto: {
select: {
Crypto: true,
amount: true,
},
},
},
take: 50,
orderBy: {
dollarAvailables: 'desc',
},
});
return user;
}