UNPKG

cloud-ide-model-schema

Version:

Pachage for schema management of Cloud IDEsys LMS

316 lines (315 loc) 9.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CAdmissionFamilyMembers = exports.CAdmissionEntityAccessPassManagementAdmfm = void 0; var mongoose_1 = require("mongoose"); /** * Admission Family Members / Guardians Schema * * Purpose: Store multiple family members and guardians for admission applications * Cloned from: core_user_family_details * Prefix: admfm_ (admission family member) */ /* SCHEMA START */ var admission_family_members = new mongoose_1.Schema({ admfm_admission_id_admap: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'admission_application_main', comment: "Reference to admission application" }, admfm_is_guardian: { type: Boolean, default: true, comment: "Is this person a guardian (Default: true as requested)" }, admfm_is_primary_guardian: { type: Boolean, default: false, comment: "Is primary guardian" }, admfm_relationship_id_sygms: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_general_master', comment: "Relationship (Father, Mother, etc.)" }, admfm_family_member_name: { type: String, default: "", maxlength: 200, trim: true, comment: "Full name" }, admfm_first_name: { type: String, default: "", maxlength: 100, trim: true, comment: "First name" }, admfm_middle_name: { type: String, default: "", maxlength: 100, trim: true, comment: "Middle name" }, admfm_last_name: { type: String, default: "", maxlength: 100, trim: true, comment: "Last name" }, admfm_family_member_dob: { type: Date, default: null, comment: "Date of birth" }, admfm_gender_id_sygms: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_general_master', comment: "Gender reference" }, admfm_blood_group_sygms: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_general_master', comment: "Blood group reference" }, admfm_nationality_id_synty: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_system_country', comment: "Nationality reference" }, // Contact Information admfm_contact_number: { type: Number, default: null, comment: "Primary phone number" }, admfm_contact_number_country_code: { type: String, default: "", maxlength: 10, trim: true, comment: "Phone country code" }, admfm_contact_number_alt: { type: Number, default: null, comment: "Alternative phone number" }, admfm_contact_number_alt_country_code: { type: String, default: "", maxlength: 10, trim: true, comment: "Alt phone country code" }, admfm_contact_email_id: { type: String, default: "", maxlength: 255, trim: true, lowercase: true, comment: "Primary email" }, admfm_contact_email_alt: { type: String, default: "", maxlength: 255, trim: true, lowercase: true, comment: "Alternative email" }, // Occupation & Financial Information admfm_occupation: { type: String, default: "", maxlength: 200, trim: true, comment: "Occupation/Profession" }, admfm_occupation_type_id_sygms: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_general_master', comment: "Occupation type ref" }, admfm_employer_name: { type: String, default: "", maxlength: 200, trim: true, comment: "Employer name" }, admfm_employer_address: { type: String, default: "", maxlength: 500, trim: true, comment: "Employer address" }, admfm_annual_income: { type: Number, default: null, comment: "Annual income" }, admfm_annual_income_currency_id_syic: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_system_currency', comment: "Currency reference" }, admfm_education_level_id_sygms: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_general_master', comment: "Education level" }, // Identification Information admfm_identification_type_id_sygms: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_general_master', comment: "ID type (Passport, etc.)" }, admfm_identification_number: { type: String, default: "", maxlength: 100, trim: true, comment: "ID number" }, admfm_identification_expiry_date: { type: Date, default: null, comment: "ID expiry date" }, // Address Information admfm_address: { type: String, default: "", maxlength: 500, trim: true, comment: "Residential address" }, admfm_city: { type: String, default: "", maxlength: 100, trim: true, comment: "City" }, admfm_state: { type: String, default: "", maxlength: 100, trim: true, comment: "State/Province" }, admfm_country_syctr: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_system_country', comment: "Country reference" }, admfm_pin_code_sypin: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_pin_code', comment: "Pin/Zip code reference" }, // Permissions & Responsibilities admfm_lives_with_student: { type: Boolean, default: true, comment: "Lives with student" }, admfm_emergency_contact: { type: Boolean, default: false, comment: "Is emergency contact" }, admfm_can_pickup_student: { type: Boolean, default: false, comment: "Authorized to pick up" }, admfm_financial_responsibility: { type: Boolean, default: false, comment: "Financially responsible" }, // System Fields admfm_family_member_id_user: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'auth_user_mst', comment: "If member is system user" }, admfm_remarks: { type: String, default: "", maxlength: 1000, trim: true, comment: "Additional notes" }, admfm_isactive: { type: Boolean, default: true, comment: "Is active" } }, { collection: 'admission_family_members', timestamps: { createdAt: 'admfm_created_at', updatedAt: 'admfm_updated_at' } }); // Indexes for better performance admission_family_members.index({ admfm_admission_id_admap: 1 }); admission_family_members.index({ admfm_is_guardian: 1 }); admission_family_members.index({ admfm_is_primary_guardian: 1 }); admission_family_members.index({ admfm_relationship_id_sygms: 1 }); admission_family_members.index({ admfm_emergency_contact: 1 }); admission_family_members.index({ admfm_isactive: 1 }); admission_family_members.index({ admfm_contact_email_id: 1 }); var CAdmissionFamilyMembers = mongoose_1.default.model("admission_family_members", admission_family_members); exports.CAdmissionFamilyMembers = CAdmissionFamilyMembers; // Access pass for entity-based access control var admission_entity_access_pass_management_admfm = new mongoose_1.Schema({ admepm_user_id_user: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'auth_user_mst', comment: "User who has access" }, admepm_entity_id_syen: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'core_system_entity', comment: "Entity context" }, admepm_access_pass_to: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'admission_family_members', comment: "Family member record access" }, admepm_is_owner: { type: Boolean, default: true, comment: "Is owner of record" }, admepm_can_edit: { type: Boolean, default: true, comment: "Can edit permission" }, admepm_can_view: { type: Boolean, default: true, comment: "Can view permission" }, admepm_isactive: { type: Boolean, default: true, comment: "Is access active" }, admepm_actions_allowed: { type: Object, default: {}, comment: "Specific actions allowed" } }, { collection: 'admission_entity_access_pass_management_admfm' }); var CAdmissionEntityAccessPassManagementAdmfm = mongoose_1.default.model("admission_entity_access_pass_management_admfm", admission_entity_access_pass_management_admfm); exports.CAdmissionEntityAccessPassManagementAdmfm = CAdmissionEntityAccessPassManagementAdmfm;