feat: add gate log
parent
8e7e43b09d
commit
ad3e3593fd
|
@ -3,3 +3,9 @@ export interface GateScanEntity {
|
||||||
type: string;
|
type: string;
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GateLogEntity {
|
||||||
|
gate_id: string;
|
||||||
|
code: string;
|
||||||
|
error: any;
|
||||||
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import {
|
||||||
GateResponseEntity,
|
GateResponseEntity,
|
||||||
} from '../domain/entity/gate-response.entity';
|
} from '../domain/entity/gate-response.entity';
|
||||||
import { Gate } from 'src/core/response';
|
import { Gate } from 'src/core/response';
|
||||||
|
import { GateLogDto } from './dto/logs.dto';
|
||||||
|
|
||||||
const masterGates = [
|
const masterGates = [
|
||||||
'319b6d3e-b661-4d19-8695-0dd6fb76465e',
|
'319b6d3e-b661-4d19-8695-0dd6fb76465e',
|
||||||
|
@ -72,6 +73,13 @@ export class GateController {
|
||||||
return responseValue;
|
return responseValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post('logs')
|
||||||
|
async logs(@Body() data: GateLogDto): Promise<GateResponseEntity> {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
return { code: 1, message: 'success' };
|
||||||
|
}
|
||||||
|
|
||||||
@Get(':id/master')
|
@Get(':id/master')
|
||||||
async detail(@Param('id') id: string): Promise<GateMasterEntity> {
|
async detail(@Param('id') id: string): Promise<GateMasterEntity> {
|
||||||
if (id == '1') return { codes: masterGates };
|
if (id == '1') return { codes: masterGates };
|
||||||
|
|
Loading…
Reference in New Issue