cloud-ide-model-schema
Version:
Pachage for schema management of Cloud IDEsys LMS
217 lines (216 loc) • 6.28 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CAdmissionDocumentUploads = void 0;
var mongoose_1 = require("mongoose");
/* SCHEMA START */
var admission_document_uploads = new mongoose_1.Schema({
// FOREIGN KEY TO MAIN APPLICATION
addu_application_id_admap: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "admission_application_main",
required: true,
comment: "Foreign key to admission_application_main"
},
// DOCUMENT DETAILS
addu_document_type: {
type: String,
required: true,
maxlength: 100,
trim: true,
enum: [
"Transcript",
"Report Card",
"Birth Certificate",
"Passport",
"Identity Document",
"Letter of Recommendation 1",
"Letter of Recommendation 2",
"Teacher Recommendation",
"Portfolio",
"Personal Statement",
"Immunization Record",
"Medical Clearance",
"Custody Document",
"Residency Proof",
"Financial Aid Document",
"Scholarship Application",
"Other"
],
comment: "Type of document"
},
addu_document_name: {
type: String,
required: true,
maxlength: 255,
trim: true,
comment: "Name/description of the document"
},
addu_file_id_cyfm: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "core_file_manager",
required: true,
comment: "File manager ID for the uploaded document"
},
addu_file_name: {
type: String,
required: true,
maxlength: 255,
trim: true,
comment: "Original file name"
},
addu_file_size: {
type: Number,
required: true,
min: 0,
comment: "File size in bytes"
},
addu_file_type: {
type: String,
required: true,
maxlength: 50,
trim: true,
comment: "File MIME type (e.g., application/pdf, image/jpeg)"
},
addu_file_path: {
type: String,
required: true,
maxlength: 500,
trim: true,
comment: "File storage path"
},
addu_upload_date: {
type: Date,
required: true,
default: Date.now,
comment: "Date when document was uploaded"
},
addu_uploaded_by_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst",
comment: "User who uploaded the document"
},
// DOCUMENT VERIFICATION
addu_verification_status: {
type: String,
required: true,
maxlength: 50,
trim: true,
enum: ["Pending", "Verified", "Rejected", "Under Review"],
default: "Pending",
comment: "Verification status of the document"
},
addu_verification_date: {
type: Date,
comment: "Date when document was verified"
},
addu_verified_by_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst",
comment: "User who verified the document"
},
addu_verification_notes: {
type: String,
maxlength: 500,
trim: true,
comment: "Verification notes"
},
addu_rejection_reason: {
type: String,
maxlength: 500,
trim: true,
comment: "Reason for rejection (if applicable)"
},
// DOCUMENT SPECIFIC FIELDS
addu_document_issue_date: {
type: Date,
comment: "Issue date of the document (if applicable)"
},
addu_document_expiry_date: {
type: Date,
comment: "Expiry date of the document (if applicable)"
},
addu_document_number: {
type: String,
maxlength: 100,
trim: true,
comment: "Document number (e.g., passport number, certificate number)"
},
addu_issuing_authority: {
type: String,
maxlength: 255,
trim: true,
comment: "Issuing authority (e.g., school name, government agency)"
},
addu_recommender_name: {
type: String,
maxlength: 255,
trim: true,
comment: "Recommender name (for recommendation letters)"
},
addu_recommender_type: {
type: String,
maxlength: 100,
trim: true,
enum: ["Teacher", "Principal", "Counselor", "Employer", "Other"],
comment: "Recommender type (for recommendation letters)"
},
addu_recommender_email: {
type: String,
maxlength: 255,
trim: true,
lowercase: true,
comment: "Recommender email (for recommendation letters)"
},
addu_year: {
type: String,
maxlength: 50,
trim: true,
comment: "Year (for report cards, transcripts)"
},
addu_grade_level: {
type: String,
maxlength: 50,
trim: true,
comment: "Grade level (for report cards, transcripts)"
},
// METADATA
addu_notes: {
type: String,
maxlength: 1000,
trim: true,
comment: "Additional notes about the document"
},
addu_is_required: {
type: Boolean,
default: true,
comment: "Whether this document is required"
},
addu_is_optional: {
type: Boolean,
default: false,
comment: "Whether this document is optional"
},
addu_created_date: {
type: Date,
default: Date.now
},
addu_modified_date: {
type: Date,
default: Date.now
},
addu_isactive: {
type: Boolean,
default: true
}
}, {
collection: 'admission_document_uploads',
timestamps: true
});
// Indexes for performance
admission_document_uploads.index({ addu_application_id_admap: 1 });
admission_document_uploads.index({ addu_document_type: 1 });
admission_document_uploads.index({ addu_verification_status: 1 });
admission_document_uploads.index({ addu_file_id_cyfm: 1 });
admission_document_uploads.index({ addu_upload_date: -1 });
var CAdmissionDocumentUploads = mongoose_1.default.model("admission_document_uploads", admission_document_uploads);
exports.CAdmissionDocumentUploads = CAdmissionDocumentUploads;