aitasker / backend /src /wallet /wallet.controller.ts
minhhungg's picture
feat: upload dataset and simulation files to Hugging Face
675f6bd
Raw
History Blame Contribute Delete
1.24 kB
import { JwtAuthGuard } from '@common/guards/jwt-auth.guard';
import { Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common';
import { WalletService } from './wallet.service';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { WalletTopupAmmountDto } from './dto/wallet-topup.dto';
import { RolesGuard } from '@common/guards/roles.guard';
import { Roles } from '@common/decorators/roles.decorator';
@ApiTags('Wallet')
@Controller('wallets')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('CLIENT', 'EXPERT')
export class WalletController {
constructor(private readonly walletService: WalletService) {}
@ApiBearerAuth('JWT') // Add this to make the bearer of Swagger work
@Get('me')
// @Req: taking request from client-side
getWalletBalance(@Req() req: any) {
return this.walletService.getWalletBalance(req.user.id);
}
@ApiBearerAuth('JWT')
@Get('me/transactions')
getWalletTransaction(@Req() req: any) {
return this.walletService.getWalletTransaction(req.user.id);
}
@ApiBearerAuth('JWT')
@Post('virtual-accounts/topup')
getTopupWallet(@Req() req: any, @Body() walletDto: WalletTopupAmmountDto) {
return this.walletService.getTopupWallet(req.user.id, walletDto);
}
}