diff --git a/src/modules/gates/domain/entity/gate-request.entity.ts b/src/modules/gates/domain/entity/gate-request.entity.ts index 299e086..37b62c1 100644 --- a/src/modules/gates/domain/entity/gate-request.entity.ts +++ b/src/modules/gates/domain/entity/gate-request.entity.ts @@ -3,3 +3,9 @@ export interface GateScanEntity { type: string; uuid: string; } + +export interface GateLogEntity { + gate_id: string; + code: string; + error: any; +} diff --git a/src/modules/gates/infrastructure/dto/logs.dto.ts b/src/modules/gates/infrastructure/dto/logs.dto.ts new file mode 100644 index 0000000..011e757 --- /dev/null +++ b/src/modules/gates/infrastructure/dto/logs.dto.ts @@ -0,0 +1,26 @@ +import { IsNotEmpty, IsString } from 'class-validator'; +import { GateLogEntity } from '../../domain/entity/gate-request.entity'; +import { ApiProperty } from '@nestjs/swagger'; + +export class GateLogDto implements GateLogEntity { + @ApiProperty({ + type: String, + required: true, + }) + @IsNotEmpty() + @IsString() + gate_id: string; + + @ApiProperty({ + type: String, + required: true, + }) + @IsNotEmpty() + @IsString() + code: string; + + @ApiProperty({ + required: false, + }) + error: any; +} diff --git a/src/modules/gates/infrastructure/gate.controller.ts b/src/modules/gates/infrastructure/gate.controller.ts index 74fa973..4da847b 100644 --- a/src/modules/gates/infrastructure/gate.controller.ts +++ b/src/modules/gates/infrastructure/gate.controller.ts @@ -8,6 +8,7 @@ import { GateResponseEntity, } from '../domain/entity/gate-response.entity'; import { Gate } from 'src/core/response'; +import { GateLogDto } from './dto/logs.dto'; const masterGates = [ '319b6d3e-b661-4d19-8695-0dd6fb76465e', @@ -72,6 +73,13 @@ export class GateController { return responseValue; } + @Post('logs') + async logs(@Body() data: GateLogDto): Promise { + console.log(data); + + return { code: 1, message: 'success' }; + } + @Get(':id/master') async detail(@Param('id') id: string): Promise { if (id == '1') return { codes: masterGates };