Skip to content

Commit

Permalink
Merge pull request #26 from deviate-team/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
1tpp authored Aug 9, 2023
2 parents 18af999 + 745737b commit 0fd7fb1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/tickets/dto/create-ticket.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ export class CreateTicketDto {
@IsNotEmpty()
@IsNumber()
seat_limit: number;



}
4 changes: 2 additions & 2 deletions src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class UsersService {
);
}
const userExists = await this.findOneById(id);
console.log(userExists);
if (!userExists) {
throw new HttpException(
{
Expand All @@ -90,7 +91,7 @@ export class UsersService {
},
404,
);
}
}else{
if (moneyType === 'carbonCredit') {
userExists.carbonCredit += quantity;
}
Expand All @@ -100,8 +101,12 @@ export class UsersService {
if (moneyType === 'retailCC') {
userExists.retailCC += quantity;
}

userExists.save();
return userExists;
console.log(userExists);
return await userExists;
}

}
}


0 comments on commit 0fd7fb1

Please sign in to comment.