Sindbad~EG File Manager
let db,mongoose;_52d.x([["default",()=>_52d.o]]);_52d.w("../../model/index",[["default",["db"],function(v){db=v}]]);_52d.w("mongoose",[["default",["mongoose"],function(v){mongoose=v}]]);
const Contact = new (_52d.a("mongoose",mongoose)).Schema(
{
contact_type: {
type: String,
required: true,
},
customer_type: {
type: String,
required: true,
},
current_status: {
type: String,
required: true,
},
first_name: { type: String, required: true },
last_name: { type: String, required: true },
location: { type: String, required: false },
email: { type: String, required: true },
profile_picture: { type: String, required: false },
created_by: {
type: _52d.a("mongoose",mongoose).Schema.ObjectId,
ref: "User",
required: true,
},
deleted: {
type: Boolean,
default: false,
},
createdOn: { type: Date, default: Date.now },
modifiedOn: { type: Date, default: Date.now },
},
{
toJSON: { virtuals: true },
toObject: { virtuals: true },
}
);
Contact.index({
first_name: "text",
last_name: "text",
email: "text",
location: "text",
});
Contact.pre("remove", async function (next) {
try {
await _52d.a("db",db).Address.deleteMany({ contact_id: this._id });
await _52d.a("db",db).BasicContactInfo.deleteMany({ contact_id: this._id });
await _52d.a("db",db).File.deleteMany({ contact_id: this._id });
await _52d.a("db",db).Note.deleteMany({ contact_id: this._id });
await _52d.a("db",db).PersonalInfo.deleteMany({ contact_id: this._id });
await _52d.a("db",db).SocialMedia.deleteMany({ contact_id: this._id });
await _52d.a("db",db).Task.deleteMany({ contact_id: this._id });
await _52d.a("db",db).Employee.deleteMany({ contact_id: this._id });
await _52d.a("db",db).ExpireDate.deleteMany({ contact_id: this._id });
await _52d.a("db",db).LinkedAccount.deleteMany({ contact_id: this._id });
await _52d.a("db",db).Policy.deleteMany({ contact_id: this._id });
await _52d.a("db",db).AccountInfo.deleteMany({ contact_id: this._id });
await _52d.a("db",db).AdditionalContact.deleteMany({ contact_id: this._id });
next();
} catch (err) {
next(err);
}
});
_52d.d(_52d.a("mongoose",mongoose).model("Contact", Contact));_52d.j(["default"]);
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists