added offers by crypto id

This commit is contained in:
Kevsl 2024-06-19 14:11:53 +02:00
parent 9b4194f618
commit 124502a820
2 changed files with 0 additions and 32 deletions

View File

@ -29,10 +29,6 @@ export class OfferController {
getAllOffers(@GetUser() user: User) { getAllOffers(@GetUser() user: User) {
return this.offerService.getOffers(user.id); return this.offerService.getOffers(user.id);
} }
@Get('/crypto/:id')
searchOfferByCryptoId(@GetUser() user: User, @Param('id') cryptoId: string) {
return this.offerService.getOffersByCryptoId(user.id, cryptoId);
}
@HttpCode(HttpStatus.CREATED) @HttpCode(HttpStatus.CREATED)
@Post('/create') @Post('/create')

View File

@ -27,34 +27,6 @@ export class OfferService {
}); });
} }
async getOffersByCryptoId(userId: string, cryptoId: string) {
await checkUserHasAccount(userId);
return this.prisma.offer.findMany({
where: {
Crypto: {
id: cryptoId,
},
},
orderBy: {
amount: 'desc',
},
select: {
id: true,
User: {
select: {
pseudo: true,
},
},
amount: true,
created_at: true,
id_user: true,
Crypto: true,
},
});
}
async createOffer(userId: string, dto: OfferDto) { async createOffer(userId: string, dto: OfferDto) {
await checkUserHasAccount(userId); await checkUserHasAccount(userId);