cloud-ide-model-schema
Version:
Pachage for schema management of Cloud IDEsys LMS
104 lines (103 loc) • 3.46 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CAcaStudentEnrollment = void 0;
var mongoose_1 = require("mongoose");
/* SCHEMA START */
var aca_student_enrollment = new mongoose_1.Schema({
acen_student_id_auth: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst",
required: true
},
acen_entity_id_syen: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "core_system_entity",
required: true
},
acen_academic_year_id_acayr: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "aca_academic_year",
required: true
},
acen_class_program_id_acacpm: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "aca_class_program_master",
required: true
},
acen_branch_id_acabrn: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "aca_class_prg_branch",
default: null
},
acen_term_id_acapt: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "aca_class_program_term",
required: true
},
acen_section_id_acapts: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "aca_prg_trm_section",
required: true
},
acen_roll_number: {
type: String,
trim: true,
maxlength: 50
},
acen_status_sygms: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "core_general_master",
required: true
},
acen_current_year_level: {
type: String,
trim: true,
maxlength: 30
},
acen_joined_date: {
type: Date
},
acen_exit_date: {
type: Date,
default: null
},
acen_previous_enrollment_id: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "aca_student_enrollment",
default: null
},
acen_promoted_to_enrollment_id: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "aca_student_enrollment",
default: null
},
acen_iscurrent: {
type: Boolean,
default: true
},
acen_isactive: {
type: Boolean,
default: true
},
acen_remarks: {
type: String,
trim: true,
maxlength: 500
},
acen_created_by_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst"
},
acen_updated_by_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst"
}
}, { collection: "aca_student_enrollment", timestamps: { createdAt: "acen_created_at", updatedAt: "acen_updated_at" } });
// Query/index patterns for section-wise operational usage
aca_student_enrollment.index({ acen_entity_id_syen: 1, acen_academic_year_id_acayr: 1, acen_section_id_acapts: 1, acen_iscurrent: 1 });
aca_student_enrollment.index({ acen_student_id_auth: 1, acen_academic_year_id_acayr: 1 });
aca_student_enrollment.index({ acen_class_program_id_acacpm: 1, acen_term_id_acapt: 1, acen_section_id_acapts: 1 });
// Prevent multiple "current" enrollments for same student/year/entity
aca_student_enrollment.index({ acen_student_id_auth: 1, acen_entity_id_syen: 1, acen_academic_year_id_acayr: 1, acen_iscurrent: 1 }, { unique: true });
var CAcaStudentEnrollment = mongoose_1.default.model("aca_student_enrollment", aca_student_enrollment);
exports.CAcaStudentEnrollment = CAcaStudentEnrollment;