cloud-ide-model-schema
Version:
Pachage for schema management of Cloud IDEsys LMS
134 lines (133 loc) • 4.02 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CAdmissionStatusHistory = void 0;
var mongoose_1 = require("mongoose");
/* SCHEMA START */
var admission_status_history = new mongoose_1.Schema({
// FOREIGN KEY TO MAIN APPLICATION
adsh_application_id_admap: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "admission_application_main",
required: true,
comment: "Foreign key to admission_application_main"
},
// STATUS CHANGE DETAILS
adsh_status_from: {
type: String,
maxlength: 50,
trim: true,
comment: "Previous status"
},
adsh_status_to: {
type: String,
required: true,
maxlength: 50,
trim: true,
enum: ["Draft", "Submitted", "Under Review", "Interview Scheduled", "Accepted", "Waitlisted", "Rejected", "Withdrawn"],
comment: "New status"
},
adsh_status_change_date: {
type: Date,
required: true,
default: Date.now,
comment: "Date when status was changed"
},
adsh_status_change_reason: {
type: String,
maxlength: 500,
trim: true,
comment: "Reason for status change"
},
adsh_status_change_notes: {
type: String,
maxlength: 1000,
trim: true,
comment: "Additional notes about the status change"
},
adsh_changed_by_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst",
required: true,
comment: "User who changed the status"
},
adsh_notification_sent: {
type: Boolean,
default: false,
comment: "Whether notification was sent for this status change"
},
adsh_notification_sent_date: {
type: Date,
comment: "Date when notification was sent"
},
adsh_email_sent: {
type: Boolean,
default: false,
comment: "Whether email was sent for this status change"
},
adsh_sms_sent: {
type: Boolean,
default: false,
comment: "Whether SMS was sent for this status change"
},
// INTERVIEW SPECIFIC FIELDS
adsh_interview_scheduled_date: {
type: Date,
comment: "Interview scheduled date (if status is Interview Scheduled)"
},
adsh_interview_completed_date: {
type: Date,
comment: "Interview completed date"
},
adsh_interview_notes: {
type: String,
maxlength: 1000,
trim: true,
comment: "Interview notes"
},
adsh_interviewer_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst",
comment: "User who conducted the interview"
},
// DECISION SPECIFIC FIELDS
adsh_decision_date: {
type: Date,
comment: "Decision date (if status is Accepted/Rejected/Waitlisted)"
},
adsh_decision_notes: {
type: String,
maxlength: 1000,
trim: true,
comment: "Decision notes"
},
adsh_waitlist_position: {
type: Number,
min: 0,
comment: "Waitlist position (if status is Waitlisted)"
},
adsh_rejection_reason: {
type: String,
maxlength: 500,
trim: true,
comment: "Rejection reason (if status is Rejected)"
},
// METADATA
adsh_created_date: {
type: Date,
default: Date.now
},
adsh_isactive: {
type: Boolean,
default: true
}
}, {
collection: 'admission_status_history',
timestamps: true
});
// Indexes for performance
admission_status_history.index({ adsh_application_id_admap: 1 });
admission_status_history.index({ adsh_status_to: 1 });
admission_status_history.index({ adsh_status_change_date: -1 });
admission_status_history.index({ adsh_changed_by_user: 1 });
var CAdmissionStatusHistory = mongoose_1.default.model("admission_status_history", admission_status_history);
exports.CAdmissionStatusHistory = CAdmissionStatusHistory;