FIX: added get token method

This commit is contained in:
Arthur Simas
2022-07-11 02:13:53 -03:00
parent db78ee3d8b
commit f383cf49d5
6 changed files with 34 additions and 9 deletions
@@ -2,6 +2,7 @@ import {
Body,
Controller,
Post,
Get,
HttpCode,
HttpStatus,
Inject,
@@ -15,6 +16,7 @@ import { TermsOfUseClientService } from './termsOfUse.service';
import { DadosferaLogger } from 'dadosfera-logs';
import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter';
import { RequestUser, User } from '../../authentication/user.decorator';
@ApiTags('TermsOfUse')
@UseFilters(new GrpcToHttpExceptionFilter())
@@ -30,6 +32,13 @@ export class TermsOfUseController {
this.logger = dadosferaLogger.logger;
}
@Get('token')
async getToken(@User({ required: true }) user: RequestUser) {
this.logger.info('/terms-of-use - get token');
return this.termsOfUseClient.getToken({ userId: user.user_id });
}
@Post('accept')
@HttpCode(HttpStatus.OK)
async accept(@Body() body: TermsOfUseAcceptRequest, @Headers() headers) {