diff --git a/src/app.controller.ts b/src/app.controller.ts index 2c11b13..5ba6230 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -260,6 +260,11 @@ export class QueryVisitorByNumberDto { @IsString() @IsNotEmpty() identity_card_no: string + + @ApiPropertyOptional({ description: "", required: false }) + @IsString() + @IsOptional() + area_code?: string } @Controller() @@ -301,11 +306,15 @@ export class AppController { // } @Get("/visitor") @ApiBearerAuth() - async getVisiotr(@Query() { identity_card_no }: QueryVisitorByNumberDto, @Req() req: any) { + async getVisiotr(@Query() { identity_card_no, area_code }: QueryVisitorByNumberDto, @Req() req: any) { let date = new Date().toDateString(); let node_other_visitor; + const where: any = { identity_card_no, end_time: IsNull() }; + if (area_code) { + where.to_area_code = area_code; + } const node_other_visitors: any = await this.nodeOtherVisitorRepository.find({ - where: { identity_card_no, end_time: IsNull() }, + where, order: { created_date: "DESC" }