import { Body, Controller, Post, Req } from '@nestjs/common'
import { WithdrawApplyDto } from './dto/withdraw-apply.dto'
import { WithdrawService } from './withdraw.service'
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'

@ApiTags('withdraw')
@ApiBearerAuth()
@Controller('/withdraw')
export class WithdrawController {
    constructor(private readonly withdrawService: WithdrawService) {}

    @Post('/apply')
    async apply(@Req() req, @Body() body: WithdrawApplyDto) {
        return await this.withdrawService.applyWithdraw(req.user.id, body.amount, body.name, body.account, body.remark)
    }
}
