import { Body, Controller, Get, Post, Req } from '@nestjs/common'
import { CommissionService } from './commission.service'
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'

@ApiTags('commission')
@ApiBearerAuth()
@Controller('/commission')
export class CommissionController {
    constructor(private readonly commissionService: CommissionService) {}

    @Get('/records/get')
    async getCommission(@Req() req) {
        return await this.commissionService.getRecords(req.user.id)
    }

    @Post('/doCommission')
    async doCommission(@Body() { userId, amount }) {
        return await this.commissionService.doCommission(userId, amount)
    }
}
