cloud-ide-model-schema 1.1.141 → 1.1.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,7 @@ var MAX_RETRY_ATTEMPTS = 10;
47
47
  var INITIAL_RETRY_DELAY = 1000; // 1 second
48
48
  var MAX_RETRY_DELAY = 30000; // 30 seconds
49
49
  var retryTimeout = null;
50
+ var alertEmailSent = false; // Track if alert email has been sent
50
51
  /**
51
52
  * Check if MongoDB is already connected
52
53
  */
@@ -72,6 +73,7 @@ function setupConnectionListeners() {
72
73
  console.log('✅ MongoDB connected successfully');
73
74
  connectionRetryCount = 0; // Reset retry count on success
74
75
  isConnecting = false;
76
+ alertEmailSent = false; // Reset alert flag on successful connection
75
77
  });
76
78
  // Connection error
77
79
  mongoose.connection.on('error', function (error) {
@@ -115,9 +117,25 @@ function attemptReconnection() {
115
117
  clearTimeout(retryTimeout);
116
118
  retryTimeout = null;
117
119
  }
118
- // Check retry limit
120
+ // Check retry limit - but allow reset after a longer delay
119
121
  if (connectionRetryCount >= MAX_RETRY_ATTEMPTS) {
120
- console.error("\u274C MongoDB reconnection failed after ".concat(MAX_RETRY_ATTEMPTS, " attempts. Server will continue running but database operations may fail."));
122
+ // Send alert email if not already sent
123
+ if (!alertEmailSent) {
124
+ sendMongoDBConnectionAlert();
125
+ alertEmailSent = true;
126
+ }
127
+ // After max attempts, wait longer before allowing another attempt
128
+ // This prevents infinite retries but allows recovery if MongoDB becomes available
129
+ var longDelay = MAX_RETRY_DELAY * 2; // 60 seconds
130
+ console.log("\u23F3 MongoDB reconnection paused after ".concat(MAX_RETRY_ATTEMPTS, " attempts. Will retry in ").concat(longDelay, "ms..."));
131
+ retryTimeout = setTimeout(function () {
132
+ retryTimeout = null;
133
+ connectionRetryCount = 0; // Reset retry count to allow fresh attempt
134
+ console.log('🔄 Resetting retry count. Attempting fresh MongoDB connection...');
135
+ connectDB().catch(function () {
136
+ // If it fails, start retry cycle again
137
+ });
138
+ }, longDelay);
121
139
  return;
122
140
  }
123
141
  // Calculate exponential backoff delay
@@ -129,10 +147,12 @@ function attemptReconnection() {
129
147
  switch (_a.label) {
130
148
  case 0:
131
149
  retryTimeout = null;
150
+ if (!(!isConnected() && !isConnecting)) return [3 /*break*/, 2];
132
151
  return [4 /*yield*/, connectDB()];
133
152
  case 1:
134
153
  _a.sent(); // Recursive call
135
- return [2 /*return*/];
154
+ _a.label = 2;
155
+ case 2: return [2 /*return*/];
136
156
  }
137
157
  });
138
158
  }); }, delay);
@@ -143,7 +163,7 @@ function attemptReconnection() {
143
163
  */
144
164
  function connectDB() {
145
165
  return __awaiter(this, void 0, void 0, function () {
146
- var mongoUri, options, connectPromise, timeoutPromise, error_1, errorMessage;
166
+ var mongoUri, closeError_1, options, error_1, errorMessage, closeError_2;
147
167
  return __generator(this, function (_a) {
148
168
  switch (_a.label) {
149
169
  case 0:
@@ -151,10 +171,23 @@ function connectDB() {
151
171
  if (isConnected()) {
152
172
  return [2 /*return*/];
153
173
  }
154
- // If already connecting, wait for it
155
- if (isConnecting || isConnectingState()) {
174
+ if (!(isConnecting || isConnectingState())) return [3 /*break*/, 2];
175
+ // Wait 2 seconds and check if connection succeeded
176
+ return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 2000); })];
177
+ case 1:
178
+ // Wait 2 seconds and check if connection succeeded
179
+ _a.sent();
180
+ // If connected now, return
181
+ if (isConnected()) {
156
182
  return [2 /*return*/];
157
183
  }
184
+ // If still connecting after wait, allow new attempt (might be stuck)
185
+ if (isConnecting || isConnectingState()) {
186
+ console.warn('⚠️ Previous connection attempt seems stuck. Starting fresh connection attempt...');
187
+ isConnecting = false; // Reset flag to allow new attempt
188
+ }
189
+ _a.label = 2;
190
+ case 2:
158
191
  // Setup event listeners (idempotent)
159
192
  setupConnectionListeners();
160
193
  mongoUri = process.env.MONGODB_URI;
@@ -164,13 +197,25 @@ function connectDB() {
164
197
  return [2 /*return*/];
165
198
  }
166
199
  isConnecting = true;
167
- _a.label = 1;
168
- case 1:
169
- _a.trys.push([1, 3, , 4]);
200
+ _a.label = 3;
201
+ case 3:
202
+ _a.trys.push([3, 9, , 15]);
203
+ if (!(mongoose.connection.readyState !== 0)) return [3 /*break*/, 7];
204
+ _a.label = 4;
205
+ case 4:
206
+ _a.trys.push([4, 6, , 7]);
207
+ return [4 /*yield*/, mongoose.connection.close()];
208
+ case 5:
209
+ _a.sent();
210
+ return [3 /*break*/, 7];
211
+ case 6:
212
+ closeError_1 = _a.sent();
213
+ return [3 /*break*/, 7];
214
+ case 7:
170
215
  options = {
171
- connectTimeoutMS: 15000, // Increased timeout
172
- socketTimeoutMS: 45000, // Increased socket timeout
173
- serverSelectionTimeoutMS: 15000, // Timeout for server selection
216
+ connectTimeoutMS: 15000, // 15 second timeout
217
+ socketTimeoutMS: 45000, // 45 second socket timeout
218
+ serverSelectionTimeoutMS: 15000, // 15 second server selection timeout
174
219
  heartbeatFrequencyMS: 10000, // Heartbeat frequency
175
220
  retryWrites: true,
176
221
  retryReads: true,
@@ -179,35 +224,121 @@ function connectDB() {
179
224
  maxPoolSize: 10, // Maximum number of connections in the pool
180
225
  minPoolSize: 2, // Minimum number of connections in the pool
181
226
  };
182
- connectPromise = mongoose.connect(mongoUri, options);
183
- timeoutPromise = new Promise(function (_, reject) {
184
- setTimeout(function () {
185
- reject(new Error('Connection timeout'));
186
- }, 20000); // 20 second timeout
187
- });
188
- return [4 /*yield*/, Promise.race([connectPromise, timeoutPromise])];
189
- case 2:
227
+ // Attempt connection
228
+ return [4 /*yield*/, mongoose.connect(mongoUri, options)];
229
+ case 8:
230
+ // Attempt connection
190
231
  _a.sent();
191
232
  // If we get here, connection was successful
192
233
  console.log('✅ Connected to MongoDB');
193
- connectionRetryCount = 0; // Reset retry count
234
+ connectionRetryCount = 0; // Reset retry count on success
194
235
  isConnecting = false;
195
- return [3 /*break*/, 4];
196
- case 3:
236
+ return [3 /*break*/, 15];
237
+ case 9:
197
238
  error_1 = _a.sent();
198
239
  isConnecting = false;
199
240
  errorMessage = (error_1 === null || error_1 === void 0 ? void 0 : error_1.message) || 'Unknown error';
200
241
  console.error("\u274C MongoDB connection failed: ".concat(errorMessage));
242
+ _a.label = 10;
243
+ case 10:
244
+ _a.trys.push([10, 13, , 14]);
245
+ if (!(mongoose.connection.readyState !== 0)) return [3 /*break*/, 12];
246
+ return [4 /*yield*/, mongoose.connection.close()];
247
+ case 11:
248
+ _a.sent();
249
+ _a.label = 12;
250
+ case 12: return [3 /*break*/, 14];
251
+ case 13:
252
+ closeError_2 = _a.sent();
253
+ return [3 /*break*/, 14];
254
+ case 14:
201
255
  // Only attempt retry if we haven't exceeded max attempts
202
256
  if (connectionRetryCount < MAX_RETRY_ATTEMPTS) {
203
257
  attemptReconnection();
204
258
  }
205
259
  else {
206
- console.error("\u274C MongoDB connection failed after ".concat(MAX_RETRY_ATTEMPTS, " attempts. Server will continue running but database operations may fail."));
207
- console.error('⚠️ To retry connection, restart the server or wait for automatic reconnection.');
260
+ // Send alert email if we've reached max attempts and haven't sent it yet
261
+ if (!alertEmailSent) {
262
+ sendMongoDBConnectionAlert();
263
+ alertEmailSent = true;
264
+ }
265
+ // After max attempts, schedule a longer wait before retrying
266
+ attemptReconnection(); // This will handle the long delay
267
+ }
268
+ return [3 /*break*/, 15];
269
+ case 15: return [2 /*return*/];
270
+ }
271
+ });
272
+ });
273
+ }
274
+ /**
275
+ * Send email alert to Cloud IDE team about MongoDB connection failure
276
+ * This function works without requiring MongoDB connection
277
+ */
278
+ function sendMongoDBConnectionAlert() {
279
+ return __awaiter(this, void 0, void 0, function () {
280
+ var recipientEmail, serverName, mongoUri, subject, body, emailGatewayUrl, emailGatewayApiKey, senderEmail, axios, emailPayload, emailError_1, error_2;
281
+ return __generator(this, function (_a) {
282
+ switch (_a.label) {
283
+ case 0:
284
+ _a.trys.push([0, 7, , 8]);
285
+ recipientEmail = process.env.CLOUD_IDE_ALERT_EMAIL || process.env.SYSTEM_ALERT_EMAIL;
286
+ if (!recipientEmail) {
287
+ console.warn('⚠️ MongoDB alert email not sent: CLOUD_IDE_ALERT_EMAIL or SYSTEM_ALERT_EMAIL not configured');
288
+ return [2 /*return*/];
208
289
  }
290
+ serverName = process.env.SERVER_NAME || process.env.NODE_ENV || 'Unknown';
291
+ mongoUri = process.env.MONGODB_URI ?
292
+ process.env.MONGODB_URI.replace(/\/\/([^:]+):([^@]+)@/, '//***:***@') : // Mask credentials
293
+ 'Not configured';
294
+ subject = "\uD83D\uDEA8 MongoDB Connection Failure Alert - ".concat(serverName);
295
+ body = "\nMongoDB Connection Failure Alert\n\nSystem Information:\n- Server: ".concat(serverName, "\n- Environment: ").concat(process.env.NODE_ENV || 'Unknown', "\n- Timestamp: ").concat(new Date().toISOString(), "\n- MongoDB URI: ").concat(mongoUri, "\n\nConnection Status:\n- Retry Attempts: ").concat(connectionRetryCount, "/").concat(MAX_RETRY_ATTEMPTS, "\n- Connection State: ").concat(mongoose.connection.readyState === 0 ? 'Disconnected' :
296
+ mongoose.connection.readyState === 1 ? 'Connected' :
297
+ mongoose.connection.readyState === 2 ? 'Connecting' : 'Unknown', "\n\nAction Required:\nThe system has failed to connect to MongoDB after ").concat(MAX_RETRY_ATTEMPTS, " retry attempts. \nPlease check:\n1. MongoDB server status\n2. Network connectivity\n3. MongoDB URI configuration\n4. Firewall rules\n5. MongoDB authentication credentials\n\nThe system will continue to retry connection automatically, but database operations may fail until connection is restored.\n\nThis is an automated alert from Cloud IDE System Monitoring.\n ").trim();
298
+ emailGatewayUrl = process.env.EMAIL_GATEWAY_URL;
299
+ emailGatewayApiKey = process.env.EMAIL_GATEWAY_API_KEY;
300
+ senderEmail = process.env.EMAIL_SENDER || process.env.SYSTEM_EMAIL || 'noreply@cloudide.com';
301
+ if (!(emailGatewayUrl && emailGatewayApiKey)) return [3 /*break*/, 5];
302
+ axios = require('axios');
303
+ emailPayload = {
304
+ to: recipientEmail,
305
+ from: senderEmail,
306
+ subject: subject,
307
+ body: body,
308
+ html: body.replace(/\n/g, '<br>') // Convert newlines to HTML breaks
309
+ };
310
+ _a.label = 1;
311
+ case 1:
312
+ _a.trys.push([1, 3, , 4]);
313
+ return [4 /*yield*/, axios.post(emailGatewayUrl, emailPayload, {
314
+ headers: {
315
+ 'Content-Type': 'application/json',
316
+ 'Authorization': "Bearer ".concat(emailGatewayApiKey),
317
+ 'X-API-Key': emailGatewayApiKey
318
+ },
319
+ timeout: 10000 // 10 second timeout
320
+ })];
321
+ case 2:
322
+ _a.sent();
323
+ console.log("\uD83D\uDCE7 MongoDB connection failure alert email sent to ".concat(recipientEmail));
324
+ return [3 /*break*/, 4];
325
+ case 3:
326
+ emailError_1 = _a.sent();
327
+ console.error('❌ Failed to send alert email via gateway:', (emailError_1 === null || emailError_1 === void 0 ? void 0 : emailError_1.message) || emailError_1);
209
328
  return [3 /*break*/, 4];
210
- case 4: return [2 /*return*/];
329
+ case 4: return [3 /*break*/, 6];
330
+ case 5:
331
+ console.warn('⚠️ Alert email not sent: EMAIL_GATEWAY_URL and EMAIL_GATEWAY_API_KEY not configured');
332
+ console.warn('⚠️ Please configure email gateway environment variables for MongoDB connection failure alerts');
333
+ console.warn("\u26A0\uFE0F Alert details would have been sent to: ".concat(recipientEmail));
334
+ _a.label = 6;
335
+ case 6: return [3 /*break*/, 8];
336
+ case 7:
337
+ error_2 = _a.sent();
338
+ // Don't throw - this is a non-critical operation
339
+ console.error('❌ Failed to send MongoDB connection alert email:', (error_2 === null || error_2 === void 0 ? void 0 : error_2.message) || error_2);
340
+ return [3 /*break*/, 8];
341
+ case 8: return [2 /*return*/];
211
342
  }
212
343
  });
213
344
  });
@@ -99,6 +99,50 @@ var admission_application_main = new mongoose_1.Schema({
99
99
  ref: "core_file_manager",
100
100
  comment: "Student photo file manager ID"
101
101
  },
102
+ admap_identification_status_id_sygms: {
103
+ type: mongoose_1.default.Schema.Types.ObjectId,
104
+ ref: "core_general_master",
105
+ comment: "Student identification status (Alive, Passed Away, etc.) - Reference to core_general_master with type 'IDENTIFICATION_STATUS'"
106
+ },
107
+ admap_is_rte_scheme: {
108
+ type: Boolean,
109
+ default: false,
110
+ comment: "Is student under Right to Education (RTE) scheme - if true, RTE details will be required"
111
+ },
112
+ admap_grn: {
113
+ type: String,
114
+ maxlength: 100,
115
+ trim: true,
116
+ comment: "General Registration Number assigned by authority (CBSE, State Board, etc.)"
117
+ },
118
+ admap_grn_authority_id_edbrd: {
119
+ type: mongoose_1.default.Schema.Types.ObjectId,
120
+ ref: "core_education_board",
121
+ comment: "Education board/authority that assigned GRN - Reference to core_education_board"
122
+ },
123
+ admap_handicap_certificate_id_cyfm: {
124
+ type: mongoose_1.default.Schema.Types.ObjectId,
125
+ ref: "core_file_manager",
126
+ comment: "Handicap certificate file manager ID"
127
+ },
128
+ admap_handicap_certificate_number: {
129
+ type: String,
130
+ maxlength: 100,
131
+ trim: true,
132
+ comment: "Handicap certificate number"
133
+ },
134
+ admap_handicap_percentage: {
135
+ type: Number,
136
+ min: 0,
137
+ max: 100,
138
+ comment: "Handicap percentage (0-100)"
139
+ },
140
+ admap_accessibility_requirements: {
141
+ type: String,
142
+ maxlength: 1000,
143
+ trim: true,
144
+ comment: "Accessibility requirements and special accommodations needed"
145
+ },
102
146
  // SECTION 2: CONTACT & ADDRESS INFORMATION
103
147
  admap_primary_email: {
104
148
  type: String,
@@ -249,6 +249,11 @@ var admission_family_members = new mongoose_1.Schema({
249
249
  trim: true,
250
250
  comment: "Additional remarks/notes"
251
251
  },
252
+ admfm_identification_status_id_sygms: {
253
+ type: mongoose_1.default.Schema.Types.ObjectId,
254
+ ref: 'core_general_master',
255
+ comment: "Identification status for father/guardian (Alive, Passed Away, etc.) - Reference to core_general_master with type 'IDENTIFICATION_STATUS'"
256
+ },
252
257
  admfm_isactive: {
253
258
  type: Boolean,
254
259
  default: true,
@@ -0,0 +1,45 @@
1
+ import mongoose from "mongoose";
2
+ declare const CAdmissionRteDetails: mongoose.Model<{
3
+ [x: string]: unknown;
4
+ }, {}, {}, {}, mongoose.Document<unknown, {}, {
5
+ [x: string]: unknown;
6
+ }, {}> & {
7
+ [x: string]: unknown;
8
+ } & Required<{
9
+ _id: unknown;
10
+ }> & {
11
+ __v: number;
12
+ }, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
13
+ [x: string]: unknown;
14
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
15
+ [x: string]: unknown;
16
+ }>, {}> & mongoose.FlatRecord<{
17
+ [x: string]: unknown;
18
+ }> & Required<{
19
+ _id: unknown;
20
+ }> & {
21
+ __v: number;
22
+ }>>;
23
+ declare const CAdmissionEntityAccessPassManagementAdmrte: mongoose.Model<{
24
+ [x: string]: unknown;
25
+ }, {}, {}, {}, mongoose.Document<unknown, {}, {
26
+ [x: string]: unknown;
27
+ }, {}> & {
28
+ [x: string]: unknown;
29
+ } & Required<{
30
+ _id: unknown;
31
+ }> & {
32
+ __v: number;
33
+ }, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
34
+ [x: string]: unknown;
35
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
36
+ [x: string]: unknown;
37
+ }>, {}> & mongoose.FlatRecord<{
38
+ [x: string]: unknown;
39
+ }> & Required<{
40
+ _id: unknown;
41
+ }> & {
42
+ __v: number;
43
+ }>>;
44
+ export { CAdmissionEntityAccessPassManagementAdmrte, // collection
45
+ CAdmissionRteDetails };
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CAdmissionRteDetails = exports.CAdmissionEntityAccessPassManagementAdmrte = void 0;
4
+ var mongoose_1 = require("mongoose");
5
+ /**
6
+ * Admission RTE (Right to Education) Details Schema
7
+ *
8
+ * Purpose: Store comprehensive RTE scheme details for admission applications
9
+ * Prefix: admrte_ (admission RTE)
10
+ *
11
+ * BUSINESS LOGIC:
12
+ * 1. Separate table for RTE details to allow future integration with multiple tables
13
+ * 2. One RTE details record per admission (when RTE scheme is applicable)
14
+ * 3. Stores certificates, income details, caste information, BPL card details
15
+ * 4. Reference fields for future extensibility to connect with student master and other tables
16
+ * 5. Entity-based access control
17
+ */
18
+ /* SCHEMA START */
19
+ var admission_rte_details = new mongoose_1.Schema({
20
+ admrte_admission_id_admap: {
21
+ type: mongoose_1.default.Schema.Types.ObjectId,
22
+ ref: 'admission_application_main',
23
+ required: true,
24
+ comment: "Reference to admission application (primary reference)"
25
+ },
26
+ admrte_reference_table: {
27
+ type: String,
28
+ maxlength: 100,
29
+ trim: true,
30
+ comment: "Reference table name for future extensibility (e.g., 'admission_application_main', 'student_master')"
31
+ },
32
+ admrte_reference_id: {
33
+ type: mongoose_1.default.Schema.Types.ObjectId,
34
+ comment: "Reference ID for future extensibility (reference to other tables)"
35
+ },
36
+ admrte_rte_certificate_number: {
37
+ type: String,
38
+ maxlength: 100,
39
+ trim: true,
40
+ comment: "RTE certificate number"
41
+ },
42
+ admrte_rte_certificate_date: {
43
+ type: Date,
44
+ comment: "RTE certificate issue date"
45
+ },
46
+ admrte_rte_category_id_sygms: {
47
+ type: mongoose_1.default.Schema.Types.ObjectId,
48
+ ref: 'core_general_master',
49
+ comment: "RTE category (Economically Weaker Section, Disadvantaged Group, etc.) - Reference to core_general_master with type 'RTE_CATEGORY'"
50
+ },
51
+ admrte_income_certificate_number: {
52
+ type: String,
53
+ maxlength: 100,
54
+ trim: true,
55
+ comment: "Income certificate number"
56
+ },
57
+ admrte_income_certificate_date: {
58
+ type: Date,
59
+ comment: "Income certificate date"
60
+ },
61
+ admrte_income_certificate_id_cyfm: {
62
+ type: mongoose_1.default.Schema.Types.ObjectId,
63
+ ref: 'core_file_manager',
64
+ comment: "Income certificate file manager ID"
65
+ },
66
+ admrte_caste_certificate_number: {
67
+ type: String,
68
+ maxlength: 100,
69
+ trim: true,
70
+ comment: "Caste certificate number"
71
+ },
72
+ admrte_caste_certificate_date: {
73
+ type: Date,
74
+ comment: "Caste certificate date"
75
+ },
76
+ admrte_caste_certificate_id_cyfm: {
77
+ type: mongoose_1.default.Schema.Types.ObjectId,
78
+ ref: 'core_file_manager',
79
+ comment: "Caste certificate file manager ID"
80
+ },
81
+ admrte_caste_category_id_sygms: {
82
+ type: mongoose_1.default.Schema.Types.ObjectId,
83
+ ref: 'core_general_master',
84
+ comment: "Caste category (General, OBC, SC, ST, etc.) - Reference to core_general_master with type 'CASTE_CATEGORY'"
85
+ },
86
+ admrte_bpl_card_number: {
87
+ type: String,
88
+ maxlength: 100,
89
+ trim: true,
90
+ comment: "BPL (Below Poverty Line) card number"
91
+ },
92
+ admrte_bpl_card_id_cyfm: {
93
+ type: mongoose_1.default.Schema.Types.ObjectId,
94
+ ref: 'core_file_manager',
95
+ comment: "BPL card file manager ID"
96
+ },
97
+ admrte_annual_income: {
98
+ type: Number,
99
+ min: 0,
100
+ comment: "Annual family income"
101
+ },
102
+ admrte_annual_income_currency_id_syic: {
103
+ type: mongoose_1.default.Schema.Types.ObjectId,
104
+ ref: 'core_iso_currency',
105
+ comment: "Currency reference for annual income"
106
+ },
107
+ admrte_rte_quota_percentage: {
108
+ type: Number,
109
+ min: 0,
110
+ max: 100,
111
+ comment: "RTE quota percentage (0-100)"
112
+ },
113
+ admrte_remarks: {
114
+ type: String,
115
+ maxlength: 1000,
116
+ trim: true,
117
+ comment: "Additional remarks/notes"
118
+ },
119
+ admrte_isactive: {
120
+ type: Boolean,
121
+ default: true,
122
+ comment: "Is active"
123
+ }
124
+ }, {
125
+ collection: 'admission_rte_details'
126
+ });
127
+ // Indexes for better performance
128
+ admission_rte_details.index({ admrte_admission_id_admap: 1 });
129
+ admission_rte_details.index({ admrte_reference_table: 1, admrte_reference_id: 1 });
130
+ admission_rte_details.index({ admrte_isactive: 1 });
131
+ var CAdmissionRteDetails = mongoose_1.default.model("admission_rte_details", admission_rte_details);
132
+ exports.CAdmissionRteDetails = CAdmissionRteDetails;
133
+ // Access pass for entity-based access control
134
+ var admission_entity_access_pass_management_admrte = new mongoose_1.Schema({
135
+ admepm_user_id_user: {
136
+ type: mongoose_1.default.Schema.Types.ObjectId,
137
+ ref: 'auth_user_mst',
138
+ comment: "User who has access"
139
+ },
140
+ admepm_entity_id_syen: {
141
+ type: mongoose_1.default.Schema.Types.ObjectId,
142
+ ref: 'core_system_entity',
143
+ comment: "Entity context"
144
+ },
145
+ admepm_access_pass_to: {
146
+ type: mongoose_1.default.Schema.Types.ObjectId,
147
+ ref: 'admission_rte_details',
148
+ comment: "RTE details record access"
149
+ },
150
+ admepm_is_owner: {
151
+ type: Boolean,
152
+ default: true,
153
+ comment: "Is owner of record"
154
+ },
155
+ admepm_can_edit: {
156
+ type: Boolean,
157
+ default: true,
158
+ comment: "Can edit permission"
159
+ },
160
+ admepm_can_view: {
161
+ type: Boolean,
162
+ default: true,
163
+ comment: "Can view permission"
164
+ },
165
+ admepm_isactive: {
166
+ type: Boolean,
167
+ default: true,
168
+ comment: "Is access active"
169
+ },
170
+ admepm_actions_allowed: {
171
+ type: Object,
172
+ default: {},
173
+ comment: "Specific actions allowed"
174
+ }
175
+ }, { collection: 'admission_entity_access_pass_management_admrte' });
176
+ var CAdmissionEntityAccessPassManagementAdmrte = mongoose_1.default.model("admission_entity_access_pass_management_admrte", admission_entity_access_pass_management_admrte);
177
+ exports.CAdmissionEntityAccessPassManagementAdmrte = CAdmissionEntityAccessPassManagementAdmrte;
@@ -0,0 +1,45 @@
1
+ import mongoose from "mongoose";
2
+ declare const CAdmissionVitalInformation: mongoose.Model<{
3
+ [x: string]: unknown;
4
+ }, {}, {}, {}, mongoose.Document<unknown, {}, {
5
+ [x: string]: unknown;
6
+ }, {}> & {
7
+ [x: string]: unknown;
8
+ } & Required<{
9
+ _id: unknown;
10
+ }> & {
11
+ __v: number;
12
+ }, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
13
+ [x: string]: unknown;
14
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
15
+ [x: string]: unknown;
16
+ }>, {}> & mongoose.FlatRecord<{
17
+ [x: string]: unknown;
18
+ }> & Required<{
19
+ _id: unknown;
20
+ }> & {
21
+ __v: number;
22
+ }>>;
23
+ declare const CAdmissionEntityAccessPassManagementAdmvi: mongoose.Model<{
24
+ [x: string]: unknown;
25
+ }, {}, {}, {}, mongoose.Document<unknown, {}, {
26
+ [x: string]: unknown;
27
+ }, {}> & {
28
+ [x: string]: unknown;
29
+ } & Required<{
30
+ _id: unknown;
31
+ }> & {
32
+ __v: number;
33
+ }, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
34
+ [x: string]: unknown;
35
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
36
+ [x: string]: unknown;
37
+ }>, {}> & mongoose.FlatRecord<{
38
+ [x: string]: unknown;
39
+ }> & Required<{
40
+ _id: unknown;
41
+ }> & {
42
+ __v: number;
43
+ }>>;
44
+ export { CAdmissionEntityAccessPassManagementAdmvi, // collection
45
+ CAdmissionVitalInformation };
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CAdmissionVitalInformation = exports.CAdmissionEntityAccessPassManagementAdmvi = void 0;
4
+ var mongoose_1 = require("mongoose");
5
+ /**
6
+ * Admission Vital Information Schema
7
+ *
8
+ * Purpose: Store flexible vital information for admission applications with timestamps
9
+ * Prefix: admvi_ (admission vital information)
10
+ *
11
+ * BUSINESS LOGIC:
12
+ * 1. Multiple vital information entries per admission (height, weight, blood pressure, etc.)
13
+ * 2. Flexible structure - vital types configurable via general master
14
+ * 3. Each entry has capture date and user for audit trail
15
+ * 4. Supports various units of measurement (configurable via general master)
16
+ * 5. Entity-based access control
17
+ */
18
+ /* SCHEMA START */
19
+ var admission_vital_information = new mongoose_1.Schema({
20
+ admvi_admission_id_admap: {
21
+ type: mongoose_1.default.Schema.Types.ObjectId,
22
+ ref: 'admission_application_main',
23
+ required: true,
24
+ comment: "Reference to admission application"
25
+ },
26
+ admvi_vital_type_id_sygms: {
27
+ type: mongoose_1.default.Schema.Types.ObjectId,
28
+ ref: 'core_general_master',
29
+ required: true,
30
+ comment: "Vital information type (Height, Weight, Blood Pressure, etc.) - Reference to core_general_master with type 'VITAL_INFORMATION_TYPE'"
31
+ },
32
+ admvi_value: {
33
+ type: String,
34
+ maxlength: 100,
35
+ trim: true,
36
+ required: true,
37
+ comment: "Vital information value (stored as string to support various data types)"
38
+ },
39
+ admvi_unit_id_sygms: {
40
+ type: mongoose_1.default.Schema.Types.ObjectId,
41
+ ref: 'core_general_master',
42
+ comment: "Unit of measurement (cm, kg, mmHg, bpm, etc.) - Reference to core_general_master with type 'VITAL_INFORMATION_UNIT'"
43
+ },
44
+ admvi_captured_date: {
45
+ type: Date,
46
+ required: true,
47
+ default: Date.now,
48
+ comment: "Date when vital information was captured"
49
+ },
50
+ admvi_captured_by_user: {
51
+ type: mongoose_1.default.Schema.Types.ObjectId,
52
+ ref: 'auth_user_mst',
53
+ comment: "User who captured the vital information"
54
+ },
55
+ admvi_remarks: {
56
+ type: String,
57
+ maxlength: 500,
58
+ trim: true,
59
+ comment: "Additional remarks/notes about the vital information"
60
+ },
61
+ admvi_isactive: {
62
+ type: Boolean,
63
+ default: true,
64
+ comment: "Is active"
65
+ }
66
+ }, {
67
+ collection: 'admission_vital_information'
68
+ });
69
+ // Indexes for better performance
70
+ admission_vital_information.index({ admvi_admission_id_admap: 1 });
71
+ admission_vital_information.index({ admvi_vital_type_id_sygms: 1 });
72
+ admission_vital_information.index({ admvi_captured_date: 1 });
73
+ admission_vital_information.index({ admvi_isactive: 1 });
74
+ var CAdmissionVitalInformation = mongoose_1.default.model("admission_vital_information", admission_vital_information);
75
+ exports.CAdmissionVitalInformation = CAdmissionVitalInformation;
76
+ // Access pass for entity-based access control
77
+ var admission_entity_access_pass_management_admvi = new mongoose_1.Schema({
78
+ admepm_user_id_user: {
79
+ type: mongoose_1.default.Schema.Types.ObjectId,
80
+ ref: 'auth_user_mst',
81
+ comment: "User who has access"
82
+ },
83
+ admepm_entity_id_syen: {
84
+ type: mongoose_1.default.Schema.Types.ObjectId,
85
+ ref: 'core_system_entity',
86
+ comment: "Entity context"
87
+ },
88
+ admepm_access_pass_to: {
89
+ type: mongoose_1.default.Schema.Types.ObjectId,
90
+ ref: 'admission_vital_information',
91
+ comment: "Vital information record access"
92
+ },
93
+ admepm_is_owner: {
94
+ type: Boolean,
95
+ default: true,
96
+ comment: "Is owner of record"
97
+ },
98
+ admepm_can_edit: {
99
+ type: Boolean,
100
+ default: true,
101
+ comment: "Can edit permission"
102
+ },
103
+ admepm_can_view: {
104
+ type: Boolean,
105
+ default: true,
106
+ comment: "Can view permission"
107
+ },
108
+ admepm_isactive: {
109
+ type: Boolean,
110
+ default: true,
111
+ comment: "Is access active"
112
+ },
113
+ admepm_actions_allowed: {
114
+ type: Object,
115
+ default: {},
116
+ comment: "Specific actions allowed"
117
+ }
118
+ }, { collection: 'admission_entity_access_pass_management_admvi' });
119
+ var CAdmissionEntityAccessPassManagementAdmvi = mongoose_1.default.model("admission_entity_access_pass_management_admvi", admission_entity_access_pass_management_admvi);
120
+ exports.CAdmissionEntityAccessPassManagementAdmvi = CAdmissionEntityAccessPassManagementAdmvi;
@@ -5,3 +5,5 @@ export * from "./admission_document_uploads";
5
5
  export * from "./admission_contact_addresses";
6
6
  export * from "./admission_family_members";
7
7
  export * from "./admission_fee_snapshot";
8
+ export * from "./admission_rte_details";
9
+ export * from "./admission_vital_information";
@@ -21,3 +21,5 @@ __exportStar(require("./admission_document_uploads"), exports);
21
21
  __exportStar(require("./admission_contact_addresses"), exports);
22
22
  __exportStar(require("./admission_family_members"), exports);
23
23
  __exportStar(require("./admission_fee_snapshot"), exports);
24
+ __exportStar(require("./admission_rte_details"), exports);
25
+ __exportStar(require("./admission_vital_information"), exports);
@@ -35,7 +35,28 @@ var email_log = new mongoose_1.Schema({
35
35
  type: String,
36
36
  trim: true,
37
37
  default: 'created',
38
- enum: ['created', 'sent', 'not_sent']
38
+ enum: ['created', 'pending', 'queued', 'sent', 'delivered', 'failed', 'not_sent', 'bounced'],
39
+ comment: "Email delivery status"
40
+ },
41
+ elog_response_data: {
42
+ type: String,
43
+ comment: "Vendor response data (JSON string)"
44
+ },
45
+ elog_error_message: {
46
+ type: String,
47
+ maxlength: 1000,
48
+ trim: true,
49
+ comment: "Error message if email failed"
50
+ },
51
+ elog_retry_count: {
52
+ type: Number,
53
+ default: 0,
54
+ min: 0,
55
+ comment: "Number of retry attempts"
56
+ },
57
+ elog_delivered_at: {
58
+ type: Date,
59
+ comment: "Timestamp when email was delivered"
39
60
  },
40
61
  elog_timestamp: {
41
62
  type: Date,
@@ -12,18 +12,38 @@ var email_reference = new mongoose_1.Schema({
12
12
  eref_sender_id_elst: {
13
13
  type: mongoose_1.default.Schema.Types.ObjectId,
14
14
  require: true,
15
- ref: "email_vendor"
15
+ ref: "email_list",
16
+ comment: "Reference to email_list (fixed: was incorrectly referencing email_vendor)"
16
17
  },
17
18
  eref_receiver_id_elst: {
18
19
  type: mongoose_1.default.Schema.Types.ObjectId,
19
20
  require: true,
20
- ref: "email_vendor"
21
+ ref: "email_list",
22
+ comment: "Reference to email_list"
21
23
  },
22
24
  eref_var: {
23
25
  type: Array,
24
26
  required: true,
25
27
  trim: true,
26
- default: []
28
+ default: [],
29
+ comment: "Array of template variables"
30
+ },
31
+ eref_description: {
32
+ type: String,
33
+ maxlength: 500,
34
+ trim: true,
35
+ comment: "Email reference description"
36
+ },
37
+ eref_category: {
38
+ type: String,
39
+ maxlength: 100,
40
+ trim: true,
41
+ comment: "Email reference category"
42
+ },
43
+ eref_default_variables: {
44
+ type: [String],
45
+ default: [],
46
+ comment: "Default variables expected for this reference"
27
47
  },
28
48
  eref_isactive: {
29
49
  type: Boolean,
@@ -17,7 +17,13 @@ var email_subscription_vendor = new mongoose_1.Schema({
17
17
  esub_end_dtm: {
18
18
  type: Date,
19
19
  required: true,
20
- default: new Date()
20
+ default: new Date(),
21
+ validate: {
22
+ validator: function (value) {
23
+ return !this.esub_start_dtm || value > this.esub_start_dtm;
24
+ },
25
+ message: 'End date must be after start date'
26
+ }
21
27
  },
22
28
  esub_timestamp: {
23
29
  type: Date,
@@ -45,6 +51,15 @@ var email_subscription_vendor = new mongoose_1.Schema({
45
51
  minvalue: 0,
46
52
  default: 0,
47
53
  },
54
+ esub_alert_sent: {
55
+ type: Boolean,
56
+ default: false,
57
+ comment: "Whether alert has been sent for limit"
58
+ },
59
+ esub_last_alert_at: {
60
+ type: Date,
61
+ comment: "Timestamp of last alert sent"
62
+ },
48
63
  esub_status: {
49
64
  type: String,
50
65
  required: true,
@@ -23,11 +23,46 @@ var email_templete = new mongoose_1.Schema({
23
23
  maxlength: 384000,
24
24
  required: true
25
25
  },
26
+ etmp_variables: {
27
+ type: [String],
28
+ default: [],
29
+ comment: "Template variables detected in body (e.g., {{user_name}})"
30
+ },
31
+ etmp_category: {
32
+ type: String,
33
+ maxlength: 100,
34
+ trim: true,
35
+ comment: "Template category for organization"
36
+ },
37
+ etmp_description: {
38
+ type: String,
39
+ maxlength: 500,
40
+ trim: true,
41
+ comment: "Template description"
42
+ },
26
43
  etmp_isactive: {
27
44
  type: Boolean,
28
45
  required: true,
29
46
  default: true
47
+ },
48
+ etmp_created_at: {
49
+ type: Date,
50
+ default: Date.now,
51
+ comment: "Creation timestamp"
52
+ },
53
+ etmp_updated_at: {
54
+ type: Date,
55
+ default: Date.now,
56
+ comment: "Last update timestamp"
30
57
  }
31
- }, { collection: 'email_templete' });
58
+ }, {
59
+ collection: 'email_templete',
60
+ timestamps: { createdAt: 'etmp_created_at', updatedAt: 'etmp_updated_at' }
61
+ });
62
+ // Indexes for better query performance
63
+ email_templete.index({ etmp_id_eref: 1 });
64
+ email_templete.index({ etmp_isactive: 1 });
65
+ email_templete.index({ etmp_category: 1 });
66
+ email_templete.index({ etmp_created_at: -1 });
32
67
  var CEmailTemplete = mongoose_1.default.model("email_templete", email_templete);
33
68
  exports.CEmailTemplete = CEmailTemplete;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "typescript": "^5.8.3"
10
10
  },
11
11
  "name": "cloud-ide-model-schema",
12
- "version": "1.1.141",
12
+ "version": "1.1.142",
13
13
  "description": "Pachage for schema management of Cloud IDEsys LMS",
14
14
  "main": "lib/index.js",
15
15
  "types": "lib/index.d.ts",