ashok 4 months ago
commit 11a4858da6

File diff suppressed because it is too large Load Diff

@ -4,7 +4,6 @@ const ObjectId = Schema.Types.ObjectId;
const { Counter} = require('../models/User')
const code = Math.floor(100000 + Math.random() * 900000);
const generateinstallationId = async () => {
var result = await Counter.findOneAndUpdate(
{ _id: 'installation_id' },
@ -206,6 +205,92 @@ const installationschema = new mongoose.Schema({
}
});
const IssueSchema = new Schema({
type: {
type: String,
enum: ["master", "slave"],
required: true
},
hardwareId: {
type: String,
required: true
},
masterHardwareId: {
type: String
},
masterName: {
type: String
},
slaveName: {
type: String
},
hardwareIds: [String],
slaveNames: [String],
resolved: {
type: Boolean,
default: false
},
movedToCategory: {
type: Boolean,
default: false
},
category: {
type: String
},
createdAt: {
type: String
},
lastTicketRaisedAt: {
type: String
},
movedAt: {
type: String
}
});
const CategorizedIssueSchema = new Schema({
type: {
type: String,
enum: ["master", "slave"],
required: true
},
hardwareId: {
type: String,
required: true
},
masterHardwareId: {
type: String,
required: true
},
slaveName: {
type: String
},
category: {
type: String,
enum: ["Power Outage", "Resolved", "Escalation"],
required: true
},
movedAt: {
type: String,
required: true
},
assignedTo: {
name: String,
support_teamMemberId: String,
phone: String,
email: String,
startDate: String,
endDate: String
}
});
const CommentSchema = new Schema({
text: { type: String, required: true },
customerId: String,
hardwareId: String,
createdAt: { type: Date, default: Date.now }
});
const supportschema = new mongoose.Schema({
// name: { type: String },
phone: { type: String, unique: true, trim: true },
@ -231,16 +316,12 @@ const installationschema = new mongoose.Schema({
dateOfLogin: { type: String, default: null },
timeOfLogin: { type: String, default: null },
currentTime: { type: Date, default: Date.now },
comments: [
{
text: { type: String, required: true },
customerId: String,
hardwareId: String,
createdAt: { type: Date, default: Date.now }
}
],
comments: [CommentSchema],
lastTicketRaisedAt: {type : String},
issues: [{ type: Object }], // existing issues array
issues: [IssueSchema],
categorizedIssues: [CategorizedIssueSchema],
masterDisconnected: [{ // new field for master disconnected details
hardwareId: String,
masterName: String,
@ -250,44 +331,44 @@ const installationschema = new mongoose.Schema({
slaveHardwareId: String,
slaveName: String,
}],
categorizedIssues: [
{
type: {
type: String,
required: true
},
hardwareId: {
type: String,
required: true
},
masterHardwareId: {
type: String,
required: true
},
slaveName: {
type: String,
},
category: {
type: String,
enum: [ "Power Outage",
"Resolved",
"Escalation",],
required: true
},
movedAt: {
type: String, // or Date, depending on your preference
required: true
},
assignedTo: {
name: String,
support_teamMemberId: String,
phone: String,
email: String,
startDate: String,
endDate: String
}
}
],
// categorizedIssues: [
// {
// type: {
// type: String,
// required: true
// },
// hardwareId: {
// type: String,
// required: true
// },
// masterHardwareId: {
// type: String,
// required: true
// },
// slaveName: {
// type: String,
// },
// category: {
// type: String,
// enum: [ "Power Outage",
// "Resolved",
// "Escalation",],
// required: true
// },
// movedAt: {
// type: String, // or Date, depending on your preference
// required: true
// },
// assignedTo: {
// name: String,
// support_teamMemberId: String,
// phone: String,
// email: String,
// startDate: String,
// endDate: String
// }
// }
// ],
profile: {

Loading…
Cancel
Save