import { Body, Controller, Post, UseGuards } from '@nestjs/common' import { CreditAuthorType } from '../../../models' import { Credits } from '../domain/credits' import { ThirdPartyAuthorizationGuard } from '../../../guards' import { AddCreditParam, ThirdParty } from './params' @UseGuards(ThirdPartyAuthorizationGuard) @Controller('api/credits') export class CreditsController { constructor(private readonly credits: Credits) {} @Post('/add') async add(@Body() params: AddCreditParam, @ThirdParty() thirdParty: CreditAuthorType): Promise { await this.credits.add({ document_number: params.documentNumber }, params.productCode, { id: params.externalId, type: thirdParty, }) } }