|
|
|
@ -4,7 +4,7 @@ import * as fs from 'fs';
|
|
|
|
import { ApiBearerAuth, ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
import { ApiBearerAuth, ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
import { IsArray, IsBoolean, IsDateString, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
|
|
|
import { IsArray, IsBoolean, IsDateString, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
|
|
|
import { NodeVisitorEntity } from './node-visitor.entity';
|
|
|
|
import { NodeVisitorEntity } from './node-visitor.entity';
|
|
|
|
import { DataSource, IsNull, Not, Repository } from 'typeorm';
|
|
|
|
import { DataSource, IsNull, LessThan, Not, Repository } from 'typeorm';
|
|
|
|
import * as bluebird from 'bluebird';
|
|
|
|
import * as bluebird from 'bluebird';
|
|
|
|
import { NodeOtherVisitorEntity } from './node-other-visitor.entity';
|
|
|
|
import { NodeOtherVisitorEntity } from './node-other-visitor.entity';
|
|
|
|
import * as moment from 'moment';
|
|
|
|
import * as moment from 'moment';
|
|
|
|
@ -229,6 +229,7 @@ export class AppController {
|
|
|
|
@Get("/visitor")
|
|
|
|
@Get("/visitor")
|
|
|
|
@ApiBearerAuth()
|
|
|
|
@ApiBearerAuth()
|
|
|
|
async getVisiotr(@Query() { identity_card_no }: QueryVisitorByNumberDto, @Req() req: any) {
|
|
|
|
async getVisiotr(@Query() { identity_card_no }: QueryVisitorByNumberDto, @Req() req: any) {
|
|
|
|
|
|
|
|
let date = new Date().getDate();
|
|
|
|
const node_other_visitor: any = await this.nodeOtherVisitorRepository.findOne({
|
|
|
|
const node_other_visitor: any = await this.nodeOtherVisitorRepository.findOne({
|
|
|
|
where: { identity_card_no },
|
|
|
|
where: { identity_card_no },
|
|
|
|
order: {
|
|
|
|
order: {
|
|
|
|
@ -239,7 +240,12 @@ export class AppController {
|
|
|
|
const node_visitor = await this.nodeVisitorRepository.findOne({
|
|
|
|
const node_visitor = await this.nodeVisitorRepository.findOne({
|
|
|
|
where: { id: node_other_visitor.node_visitor_id }
|
|
|
|
where: { id: node_other_visitor.node_visitor_id }
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
if (new Date(node_visitor.start_date) <= new Date(date) && new Date(node_visitor.end_date) >= new Date(date)) {
|
|
|
|
node_other_visitor.info = node_visitor;
|
|
|
|
node_other_visitor.info = node_visitor;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return node_other_visitor
|
|
|
|
return node_other_visitor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|