diff --git a/src/tickets/dto/create-ticket.dto.ts b/src/tickets/dto/create-ticket.dto.ts index 728d7d8..249e829 100644 --- a/src/tickets/dto/create-ticket.dto.ts +++ b/src/tickets/dto/create-ticket.dto.ts @@ -87,4 +87,7 @@ export class CreateTicketDto { @IsNotEmpty() @IsNumber() seat_limit: number; + + + } diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts index 46fdc3a..1d735db 100644 --- a/src/users/users.controller.ts +++ b/src/users/users.controller.ts @@ -33,12 +33,12 @@ export class UsersController { @Patch(':id/add-money') @UseGuards(JwtGuard, RolesGuard) @Roles(Role.User, Role.Provider, Role.Admin) //for dev - buyCarbon( + async addMoney( @Param('id') id: string, @Body() addMoneyDto: AddMoneyDto, @GetUser() user) { - const addMoney = this.usersService.addMoney(id,addMoneyDto, user); + const addMoney = await this.usersService.addMoney(id,addMoneyDto, user); return { message: 'success', data: addMoney diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 04e44fc..08729ad 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -82,6 +82,7 @@ export class UsersService { ); } const userExists = await this.findOneById(id); + console.log(userExists); if (!userExists) { throw new HttpException( { @@ -90,7 +91,7 @@ export class UsersService { }, 404, ); - } + }else{ if (moneyType === 'carbonCredit') { userExists.carbonCredit += quantity; } @@ -100,8 +101,12 @@ export class UsersService { if (moneyType === 'retailCC') { userExists.retailCC += quantity; } + userExists.save(); - return userExists; + console.log(userExists); + return await userExists; } - } +} + +