feat: add gate log
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

pull/115/head 20.2.11-alpha.3
shancheas 2024-11-13 10:00:37 +07:00
parent 8e7e43b09d
commit ad3e3593fd
3 changed files with 40 additions and 0 deletions

View File

@ -3,3 +3,9 @@ export interface GateScanEntity {
type: string;
uuid: string;
}
export interface GateLogEntity {
gate_id: string;
code: string;
error: any;
}

View File

@ -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;
}

View File

@ -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<GateResponseEntity> {
console.log(data);
return { code: 1, message: 'success' };
}
@Get(':id/master')
async detail(@Param('id') id: string): Promise<GateMasterEntity> {
if (id == '1') return { codes: masterGates };