cloud-ide-model-schema
Version:
Pachage for schema management of Cloud IDEsys LMS
114 lines (113 loc) • 3.67 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CCoreEntityUdise = void 0;
var mongoose_1 = require("mongoose");
/* SCHEMA START */
var core_entity_udise = new mongoose_1.Schema({
syudise_entity_id_syen: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "core_system_entity",
required: true,
unique: true,
comment: "School/Entity ID - One UDISE record per entity"
},
syudise_code: {
type: String,
required: true,
maxlength: 50,
trim: true,
unique: true,
sparse: true,
comment: "11-digit UDISE code (Unified District Information System for Education)"
},
syudise_verified: {
type: Boolean,
default: false,
comment: "UDISE code verification status"
},
syudise_verification_date: {
type: Date,
comment: "UDISE verification date"
},
syudise_verification_source_sygms: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "core_general_master",
comment: "UDISE verification source (UDISE Portal, Manual, API, Other) - Reference to core_general_master with type 'UDISE_VERIFICATION_SOURCE'"
},
syudise_verification_notes: {
type: String,
maxlength: 500,
trim: true,
comment: "Notes about UDISE verification"
},
syudise_state_code: {
type: String,
maxlength: 10,
trim: true,
comment: "State code extracted from UDISE (positions 1-2)"
},
syudise_district_code: {
type: String,
maxlength: 10,
trim: true,
comment: "District code extracted from UDISE (positions 3-4)"
},
syudise_block_code: {
type: String,
maxlength: 10,
trim: true,
comment: "Block code extracted from UDISE (positions 5-6)"
},
syudise_school_code: {
type: String,
maxlength: 10,
trim: true,
comment: "School code extracted from UDISE (positions 7-9)"
},
syudise_check_digits: {
type: String,
maxlength: 10,
trim: true,
comment: "Check digits extracted from UDISE (positions 10-11)"
},
syudise_last_synced_date: {
type: Date,
comment: "Last date when UDISE data was synced from UDISE portal"
},
syudise_sync_status: {
type: String,
maxlength: 50,
trim: true,
enum: ["Not Synced", "Synced", "Sync Failed", "Pending"],
default: "Not Synced",
comment: "UDISE data sync status"
},
syudise_sync_error: {
type: String,
maxlength: 500,
trim: true,
comment: "Error message if UDISE sync failed"
},
syudise_metadata: {
type: Object,
default: {},
comment: "Additional UDISE metadata from UDISE portal (school type, management, etc.)"
},
syudise_isactive: {
type: Boolean,
default: true,
comment: "UDISE record active status"
}
}, {
collection: 'core_entity_udise',
timestamps: true
});
// Indexes for performance
// Note: syudise_entity_id_syen and syudise_code indexes are automatically created by unique: true, so we don't need to add them explicitly
core_entity_udise.index({ syudise_verified: 1 });
core_entity_udise.index({ syudise_state_code: 1 });
core_entity_udise.index({ syudise_district_code: 1 });
core_entity_udise.index({ syudise_sync_status: 1 });
core_entity_udise.index({ syudise_isactive: 1 });
var CCoreEntityUdise = mongoose_1.default.model("core_entity_udise", core_entity_udise);
exports.CCoreEntityUdise = CCoreEntityUdise;