Files
puppeteerjs/src/models/ReserveResultPojo.js
T
2024-03-05 15:01:51 +01:00

48 lines
1.5 KiB
JavaScript

const PublishType = require("./PublishType");
const {hostname} = require("os");
const hostName = hostname();
class ReserveResultPojo {
constructor(id, phoneNumber, passportNumber, mail, lastName, firstName, storeType, url, type = PublishType.ERROR) {
this.id = id;
this.phoneNumber = phoneNumber;
this.passportNumber = passportNumber;
this.firstName = firstName;
this.lastName = lastName;
this.storeType = storeType;
this.url = url;
this.email = mail;
this.type = type;
this.source_from = ""
this.serial = ""
this.hostName = hostName
this.currentIp = ""
this.created_at = new Date().toLocaleString()
}
to_mongo_dict() {
return {
id: this.id,
phone: this.phoneNumber,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
passport: this.passportNumber,
url: this.url,
store_type: this.storeType,
source_from: this.source_from,
serial: this.serial,
created_at: this.created_at,
hostName: this.hostName,
current_ip: this.currentIp
}
}
static create_from_contact(contactPojo, id, url, storeType, type) {
return new ReserveResultPojo(id, contactPojo.phoneNumber, contactPojo.passportNumber, contactPojo.mail, contactPojo.lastName, contactPojo.firstName, storeType, url, type);
}
}
module.exports = ReserveResultPojo