raise a ticket

master^2
Bhaskar 4 months ago
parent 023b78c17c
commit e8c32b95fc

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

Loading…
Cancel
Save