|
|
|
@ -229,18 +229,23 @@ 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();
|
|
|
|
let date = new Date().toDateString();
|
|
|
|
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: {
|
|
|
|
created_date: "DESC"
|
|
|
|
created_date: "DESC"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// console.log('node_other_visitor', node_other_visitor)
|
|
|
|
if (node_other_visitor) {
|
|
|
|
if (node_other_visitor) {
|
|
|
|
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)) {
|
|
|
|
// console.log('node_visitor', node_visitor)
|
|
|
|
|
|
|
|
// console.log('new Date(node_visitor.start_date)', new Date(node_visitor.start_date))
|
|
|
|
|
|
|
|
// console.log('new Date(node_visitor.end_date)', new Date(node_visitor.end_date))
|
|
|
|
|
|
|
|
// console.log('new Date(date)', new Date(date))
|
|
|
|
|
|
|
|
if (node_visitor && 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 {
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|