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 Policy = new (_52d.a("mongoose",mongoose)).Schema(
{
policy_type: { type: String, required: false, default: "" },
line_of_business: { type: String, required: false, default: "" },
effective_date: { type: String, required: false, default: "" },
policy_number: { type: String, required: false, default: "" },
term: { type: String, required: false, default: "" },
status: {
type: String,
enum: ["pending", "in_progress", "completed"],
default: "pending",
},
estimated_premium: { type: String, required: false, default: "" },
contact_id: {
type: _52d.a("mongoose",mongoose).Schema.ObjectId,
ref: "Contact",
},
user_id: {
type: _52d.a("mongoose",mongoose).Schema.ObjectId,
ref: "User",
},
createdOn: { type: Date, default: Date.now },
modifiedOn: { type: Date, default: Date.now },
},
{
toJSON: { virtuals: true },
toObject: { virtuals: true },
}
);
Policy.index({
policy_type: "text",
line_of_business: "text",
});
Policy.pre("remove", async function (next) {
try {
await _52d.a("db",db).AdditionalInfo.deleteMany({ policy_id: this._id });
await _52d.a("db",db).AdditionalInterest.deleteMany({ policy_id: this._id });
await _52d.a("db",db).BinderInfo.deleteMany({ policy_id: this._id });
await _52d.a("db",db).ContractorUnderwriting.deleteMany({ policy_id: this._id });
await _52d.a("db",db).ExtendedPolicyInfo.deleteMany({ policy_id: this._id });
await _52d.a("db",db).GeneralLiabilityUnderwriting.deleteMany({ policy_id: this._id });
await _52d.a("db",db).LocationSchedule.deleteMany({ policy_id: this._id });
await _52d.a("db",db).NamedInsured.deleteMany({ policy_id: this._id });
await _52d.a("db",db).NatureOfBusiness.deleteMany({ policy_id: this._id });
await _52d.a("db",db).PaymentPlan.deleteMany({ policy_id: this._id });
await _52d.a("db",db).PolicyAttachment.deleteMany({ policy_id: this._id });
await _52d.a("db",db).PolicyForm.deleteMany({ policy_id: this._id });
await _52d.a("db",db).PolicyInfo.deleteMany({ policy_id: this._id });
await _52d.a("db",db).PriorPolicyInfo.deleteMany({ policy_id: this._id });
await _52d.a("db",db).Product.deleteMany({ policy_id: this._id });
await _52d.a("db",db).UnderwritingQuestion.deleteMany({ policy_id: this._id });
next();
} catch (err) {
next(err);
}
});
_52d.d(_52d.a("mongoose",mongoose).model("Policy", Policy));_52d.j(["default"]);
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists