|
|
@ -115,6 +115,8 @@ const installationschema = new mongoose.Schema({
|
|
|
|
const storeSchema = new mongoose.Schema({
|
|
|
|
const storeSchema = new mongoose.Schema({
|
|
|
|
storename: { type: String },
|
|
|
|
storename: { type: String },
|
|
|
|
phone: { type: String, unique: true, trim: true },
|
|
|
|
phone: { type: String, unique: true, trim: true },
|
|
|
|
|
|
|
|
contactPersonName: {type: String},
|
|
|
|
|
|
|
|
contactPersonPhone: { type: String, unique: true, trim: true },
|
|
|
|
storeId: { type: String, default: null },
|
|
|
|
storeId: { type: String, default: null },
|
|
|
|
phoneVerified: { type: Boolean, default: false },
|
|
|
|
phoneVerified: { type: Boolean, default: false },
|
|
|
|
phoneVerificationCode: { type: Number, default: 11111 },
|
|
|
|
phoneVerificationCode: { type: Number, default: 11111 },
|
|
|
@ -134,7 +136,7 @@ const installationschema = new mongoose.Schema({
|
|
|
|
lastName: { type: String, default: null },
|
|
|
|
lastName: { type: String, default: null },
|
|
|
|
contactNumber: { type: String, default: null },
|
|
|
|
contactNumber: { type: String, default: null },
|
|
|
|
alternativeContactNumber: { type: String, default: null },
|
|
|
|
alternativeContactNumber: { type: String, default: null },
|
|
|
|
office_address: { type: String, default: null },
|
|
|
|
store_address: { type: String, default: null },
|
|
|
|
city: { type: String, default: null },
|
|
|
|
city: { type: String, default: null },
|
|
|
|
state: { type: String, default: null },
|
|
|
|
state: { type: String, default: null },
|
|
|
|
country: { type: String, default: null },
|
|
|
|
country: { type: String, default: null },
|
|
|
@ -322,6 +324,59 @@ const serviceCartSchema = new mongoose.Schema({
|
|
|
|
timestamps: true,
|
|
|
|
timestamps: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const salesSchema = new mongoose.Schema({
|
|
|
|
|
|
|
|
username: { type: String },
|
|
|
|
|
|
|
|
phone: { type: String, unique: true, trim: true },
|
|
|
|
|
|
|
|
salesId: { type: String, default: null },
|
|
|
|
|
|
|
|
phoneVerified: { type: Boolean, default: false },
|
|
|
|
|
|
|
|
phoneVerificationCode: { type: Number, default: 11111 },
|
|
|
|
|
|
|
|
passwordResetCode: { type: Number, default: 11111 },
|
|
|
|
|
|
|
|
oneTimePasswordSetFlag: { type: Boolean, default: false },
|
|
|
|
|
|
|
|
emails: {type: String},
|
|
|
|
|
|
|
|
services: {
|
|
|
|
|
|
|
|
password: {
|
|
|
|
|
|
|
|
bcrypt: { type: String, required: true }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
description: { type: String, default: null },
|
|
|
|
|
|
|
|
profile: {
|
|
|
|
|
|
|
|
role: [{ type: String, default: "sales" }],
|
|
|
|
|
|
|
|
firstName: { type: String, default: null },
|
|
|
|
|
|
|
|
lastName: { type: String, default: null },
|
|
|
|
|
|
|
|
contactNumber: { type: String, default: null },
|
|
|
|
|
|
|
|
alternativeContactNumber: { type: String, default: null },
|
|
|
|
|
|
|
|
address: { type: String, default: null },
|
|
|
|
|
|
|
|
city: { type: String, default: null },
|
|
|
|
|
|
|
|
state: { type: String, default: null },
|
|
|
|
|
|
|
|
country: { type: String, default: null },
|
|
|
|
|
|
|
|
zip: { type: String, default: null },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
status: {
|
|
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
|
|
enum: ['inactive', 'active'],
|
|
|
|
|
|
|
|
default: 'active'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
longitude: { type: Number, default: 0.0 },
|
|
|
|
|
|
|
|
latitude: { type: Number, default: 0.0 },
|
|
|
|
|
|
|
|
isActive: Boolean,
|
|
|
|
|
|
|
|
tenantId: ObjectId,
|
|
|
|
|
|
|
|
fcmId: { type: String, default: null },
|
|
|
|
|
|
|
|
createdAt: {
|
|
|
|
|
|
|
|
type: Date,
|
|
|
|
|
|
|
|
default: function () {
|
|
|
|
|
|
|
|
return Date.now();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
createdBy: ObjectId,
|
|
|
|
|
|
|
|
updatedAt: {
|
|
|
|
|
|
|
|
type: Date,
|
|
|
|
|
|
|
|
default: function () {
|
|
|
|
|
|
|
|
return Date.now();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
updatedBy: ObjectId,
|
|
|
|
|
|
|
|
}, { versionKey: false });
|
|
|
|
|
|
|
|
|
|
|
|
const Insensors = mongoose.model('Insensors', insensorsSchema);
|
|
|
|
const Insensors = mongoose.model('Insensors', insensorsSchema);
|
|
|
|
const Store = mongoose.model("Store", storeSchema);
|
|
|
|
const Store = mongoose.model("Store", storeSchema);
|
|
|
|
const WaterLeverSensor = mongoose.model('WaterLeverSensor', waterLeverSensorInSchema);
|
|
|
|
const WaterLeverSensor = mongoose.model('WaterLeverSensor', waterLeverSensorInSchema);
|
|
|
@ -333,6 +388,7 @@ const serviceCartSchema = new mongoose.Schema({
|
|
|
|
const Install = mongoose.model("Install", installationschema);
|
|
|
|
const Install = mongoose.model("Install", installationschema);
|
|
|
|
const HardwareCart = mongoose.model("HardwareCart", hardwareCartSchema);
|
|
|
|
const HardwareCart = mongoose.model("HardwareCart", hardwareCartSchema);
|
|
|
|
const ServiceCart = mongoose.model("ServiceCart", serviceCartSchema);
|
|
|
|
const ServiceCart = mongoose.model("ServiceCart", serviceCartSchema);
|
|
|
|
|
|
|
|
const Sales = mongoose.model("Sales", salesSchema);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = { Install, ProfilePictureInstall, SensorQuotation,generateinstallationId,Store,ProfilePictureStore,WaterLeverSensor,MotorSwitchSensor,Insensors,generatequatationId, HardwareCart, ServiceCart};
|
|
|
|
module.exports = {Sales, Install, ProfilePictureInstall, SensorQuotation,generateinstallationId,Store,ProfilePictureStore,WaterLeverSensor,MotorSwitchSensor,Insensors,generatequatationId, HardwareCart, ServiceCart};
|
|
|
|