cloud-ide-model-schema 1.1.142 → 1.1.144
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.
- package/lib/config/database.js +163 -27
- package/lib/schema/academics/academics_bonafide_request.d.ts +8 -0
- package/lib/schema/academics/academics_bonafide_request.js +98 -0
- package/lib/schema/academics/index.d.ts +1 -0
- package/lib/schema/academics/index.js +1 -0
- package/lib/schema/auth/auth_user_mst.js +11 -0
- package/lib/schema/core/core_department.js +6 -0
- package/lib/schema/core/core_designation.js +6 -0
- package/lib/schema/core/core_entity_mapping.js +11 -0
- package/lib/schema/core/core_user_role.js +6 -0
- package/lib/schema/core/core_workflow_approver_rules.d.ts +8 -0
- package/lib/schema/core/core_workflow_approver_rules.js +83 -0
- package/lib/schema/core/core_workflow_config.d.ts +8 -0
- package/lib/schema/core/core_workflow_config.js +103 -0
- package/lib/schema/core/core_workflow_registry.d.ts +8 -0
- package/lib/schema/core/core_workflow_registry.js +128 -0
- package/lib/schema/core/core_workflow_transaction_history.d.ts +8 -0
- package/lib/schema/core/core_workflow_transaction_history.js +86 -0
- package/lib/schema/core/index.d.ts +13 -1
- package/lib/schema/core/index.js +9 -1
- package/package.json +2 -2
package/lib/config/database.js
CHANGED
|
@@ -40,6 +40,8 @@ exports.customUUID = void 0;
|
|
|
40
40
|
exports.connectDB = connectDB;
|
|
41
41
|
var mongoose = require("mongoose");
|
|
42
42
|
require("dotenv/config");
|
|
43
|
+
var fs = require("fs");
|
|
44
|
+
var path = require("path");
|
|
43
45
|
// Connection state tracking
|
|
44
46
|
var isConnecting = false;
|
|
45
47
|
var connectionRetryCount = 0;
|
|
@@ -60,14 +62,30 @@ function isConnected() {
|
|
|
60
62
|
function isConnectingState() {
|
|
61
63
|
return mongoose.connection.readyState === 2; // 2 = connecting
|
|
62
64
|
}
|
|
65
|
+
// Track if listeners have been set up to prevent duplicates
|
|
66
|
+
// This prevents the "Possible EventEmitter memory leak detected" warning
|
|
67
|
+
// that occurs when multiple modules call connectDB() and listeners are added multiple times
|
|
68
|
+
var listenersSetup = false;
|
|
63
69
|
/**
|
|
64
70
|
* Setup MongoDB connection event listeners (idempotent)
|
|
71
|
+
* This function ensures listeners are only added once, even if called multiple times.
|
|
72
|
+
*
|
|
73
|
+
* IMPORTANT: This prevents EventEmitter memory leaks that occur when:
|
|
74
|
+
* - Multiple controller/service files call connectDB() at module import time
|
|
75
|
+
* - Reconnection logic calls connectDB() recursively
|
|
76
|
+
* - Each call would add duplicate event listeners without this protection
|
|
77
|
+
*
|
|
78
|
+
* The fix uses a flag to ensure listeners are only added once, regardless of
|
|
79
|
+
* how many times connectDB() is called.
|
|
65
80
|
*/
|
|
66
81
|
function setupConnectionListeners() {
|
|
67
|
-
// Only setup once
|
|
68
|
-
if (
|
|
82
|
+
// Only setup once - check flag to ensure no duplicates
|
|
83
|
+
if (listenersSetup) {
|
|
69
84
|
return;
|
|
70
85
|
}
|
|
86
|
+
// Keep max listeners at default (10) since we prevent duplicates with the flag
|
|
87
|
+
// No need to increase if listeners are only added once
|
|
88
|
+
mongoose.connection.setMaxListeners(10);
|
|
71
89
|
// Connection successful
|
|
72
90
|
mongoose.connection.on('connected', function () {
|
|
73
91
|
console.log('✅ MongoDB connected successfully');
|
|
@@ -85,6 +103,15 @@ function setupConnectionListeners() {
|
|
|
85
103
|
mongoose.connection.on('disconnected', function () {
|
|
86
104
|
console.warn('⚠️ MongoDB disconnected. Will attempt to reconnect...');
|
|
87
105
|
isConnecting = false;
|
|
106
|
+
// Send alert for unexpected disconnection (but not on initial connection failure)
|
|
107
|
+
if (connectionRetryCount > 0) {
|
|
108
|
+
sendMongoDBConnectionAlert('WARNING: MongoDB Disconnected', {
|
|
109
|
+
name: 'MongoDisconnected',
|
|
110
|
+
message: 'MongoDB connection was lost unexpectedly'
|
|
111
|
+
}).catch(function (alertError) {
|
|
112
|
+
console.error('❌ Failed to send disconnection alert:', (alertError === null || alertError === void 0 ? void 0 : alertError.message) || alertError);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
88
115
|
// Attempt reconnection
|
|
89
116
|
attemptReconnection();
|
|
90
117
|
});
|
|
@@ -102,6 +129,8 @@ function setupConnectionListeners() {
|
|
|
102
129
|
// Attempt reconnection
|
|
103
130
|
attemptReconnection();
|
|
104
131
|
});
|
|
132
|
+
// Mark listeners as setup
|
|
133
|
+
listenersSetup = true;
|
|
105
134
|
}
|
|
106
135
|
/**
|
|
107
136
|
* Attempt to reconnect to MongoDB with exponential backoff
|
|
@@ -121,7 +150,9 @@ function attemptReconnection() {
|
|
|
121
150
|
if (connectionRetryCount >= MAX_RETRY_ATTEMPTS) {
|
|
122
151
|
// Send alert email if not already sent
|
|
123
152
|
if (!alertEmailSent) {
|
|
124
|
-
sendMongoDBConnectionAlert()
|
|
153
|
+
sendMongoDBConnectionAlert('CRITICAL: Maximum retry attempts reached').catch(function (alertError) {
|
|
154
|
+
console.error('❌ Failed to send max retry alert:', (alertError === null || alertError === void 0 ? void 0 : alertError.message) || alertError);
|
|
155
|
+
});
|
|
125
156
|
alertEmailSent = true;
|
|
126
157
|
}
|
|
127
158
|
// After max attempts, wait longer before allowing another attempt
|
|
@@ -163,7 +194,7 @@ function attemptReconnection() {
|
|
|
163
194
|
*/
|
|
164
195
|
function connectDB() {
|
|
165
196
|
return __awaiter(this, void 0, void 0, function () {
|
|
166
|
-
var mongoUri, closeError_1, options, error_1, errorMessage, closeError_2;
|
|
197
|
+
var mongoUri, closeError_1, options, error_1, errorMessage, errorStack, errorName, closeError_2;
|
|
167
198
|
return __generator(this, function (_a) {
|
|
168
199
|
switch (_a.label) {
|
|
169
200
|
case 0:
|
|
@@ -210,6 +241,11 @@ function connectDB() {
|
|
|
210
241
|
return [3 /*break*/, 7];
|
|
211
242
|
case 6:
|
|
212
243
|
closeError_1 = _a.sent();
|
|
244
|
+
// Log close errors instead of suppressing them
|
|
245
|
+
console.warn('⚠️ Error closing existing MongoDB connection:', (closeError_1 === null || closeError_1 === void 0 ? void 0 : closeError_1.message) || closeError_1);
|
|
246
|
+
if (closeError_1 === null || closeError_1 === void 0 ? void 0 : closeError_1.stack) {
|
|
247
|
+
console.warn(' Stack:', closeError_1.stack);
|
|
248
|
+
}
|
|
213
249
|
return [3 /*break*/, 7];
|
|
214
250
|
case 7:
|
|
215
251
|
options = {
|
|
@@ -238,7 +274,18 @@ function connectDB() {
|
|
|
238
274
|
error_1 = _a.sent();
|
|
239
275
|
isConnecting = false;
|
|
240
276
|
errorMessage = (error_1 === null || error_1 === void 0 ? void 0 : error_1.message) || 'Unknown error';
|
|
241
|
-
|
|
277
|
+
errorStack = (error_1 === null || error_1 === void 0 ? void 0 : error_1.stack) || 'No stack trace available';
|
|
278
|
+
errorName = (error_1 === null || error_1 === void 0 ? void 0 : error_1.name) || 'Error';
|
|
279
|
+
console.error('❌ MongoDB connection failed:');
|
|
280
|
+
console.error(" Error Name: ".concat(errorName));
|
|
281
|
+
console.error(" Error Message: ".concat(errorMessage));
|
|
282
|
+
console.error(" Error Stack: ".concat(errorStack));
|
|
283
|
+
if (error_1 === null || error_1 === void 0 ? void 0 : error_1.code) {
|
|
284
|
+
console.error(" Error Code: ".concat(error_1.code));
|
|
285
|
+
}
|
|
286
|
+
if (error_1 === null || error_1 === void 0 ? void 0 : error_1.codeName) {
|
|
287
|
+
console.error(" Error Code Name: ".concat(error_1.codeName));
|
|
288
|
+
}
|
|
242
289
|
_a.label = 10;
|
|
243
290
|
case 10:
|
|
244
291
|
_a.trys.push([10, 13, , 14]);
|
|
@@ -250,8 +297,20 @@ function connectDB() {
|
|
|
250
297
|
case 12: return [3 /*break*/, 14];
|
|
251
298
|
case 13:
|
|
252
299
|
closeError_2 = _a.sent();
|
|
300
|
+
// Log close errors instead of suppressing them
|
|
301
|
+
console.error('❌ Error closing MongoDB connection:', (closeError_2 === null || closeError_2 === void 0 ? void 0 : closeError_2.message) || closeError_2);
|
|
302
|
+
if (closeError_2 === null || closeError_2 === void 0 ? void 0 : closeError_2.stack) {
|
|
303
|
+
console.error(' Stack:', closeError_2.stack);
|
|
304
|
+
}
|
|
253
305
|
return [3 /*break*/, 14];
|
|
254
306
|
case 14:
|
|
307
|
+
// Send immediate alert on first connection failure (critical issue)
|
|
308
|
+
if (connectionRetryCount === 0) {
|
|
309
|
+
console.error('🚨 CRITICAL: MongoDB connection failed on first attempt. Sending immediate alert...');
|
|
310
|
+
sendMongoDBConnectionAlert('CRITICAL: Initial connection failure', error_1).catch(function (alertError) {
|
|
311
|
+
console.error('❌ Failed to send immediate alert:', (alertError === null || alertError === void 0 ? void 0 : alertError.message) || alertError);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
255
314
|
// Only attempt retry if we haven't exceeded max attempts
|
|
256
315
|
if (connectionRetryCount < MAX_RETRY_ATTEMPTS) {
|
|
257
316
|
attemptReconnection();
|
|
@@ -259,7 +318,10 @@ function connectDB() {
|
|
|
259
318
|
else {
|
|
260
319
|
// Send alert email if we've reached max attempts and haven't sent it yet
|
|
261
320
|
if (!alertEmailSent) {
|
|
262
|
-
|
|
321
|
+
console.error('🚨 CRITICAL: MongoDB connection failed after maximum retry attempts. Sending alert...');
|
|
322
|
+
sendMongoDBConnectionAlert('CRITICAL: Maximum retry attempts reached', error_1).catch(function (alertError) {
|
|
323
|
+
console.error('❌ Failed to send max retry alert:', (alertError === null || alertError === void 0 ? void 0 : alertError.message) || alertError);
|
|
324
|
+
});
|
|
263
325
|
alertEmailSent = true;
|
|
264
326
|
}
|
|
265
327
|
// After max attempts, schedule a longer wait before retrying
|
|
@@ -274,31 +336,45 @@ function connectDB() {
|
|
|
274
336
|
/**
|
|
275
337
|
* Send email alert to Cloud IDE team about MongoDB connection failure
|
|
276
338
|
* This function works without requiring MongoDB connection
|
|
339
|
+
* @param severity - Alert severity level (e.g., 'CRITICAL', 'WARNING')
|
|
340
|
+
* @param error - Optional error object for detailed error information
|
|
277
341
|
*/
|
|
278
342
|
function sendMongoDBConnectionAlert() {
|
|
279
|
-
return __awaiter(this,
|
|
280
|
-
var recipientEmail, serverName, mongoUri,
|
|
343
|
+
return __awaiter(this, arguments, void 0, function (severity, error) {
|
|
344
|
+
var subject, body, recipientEmail, serverName_1, serverName, mongoUri, errorDetails, emailGatewayUrl, emailGatewayApiKey, senderEmail, axios, emailPayload, emailError_1, error_2;
|
|
345
|
+
if (severity === void 0) { severity = 'WARNING'; }
|
|
281
346
|
return __generator(this, function (_a) {
|
|
282
347
|
switch (_a.label) {
|
|
283
348
|
case 0:
|
|
284
|
-
|
|
349
|
+
subject = '';
|
|
350
|
+
body = '';
|
|
351
|
+
_a.label = 1;
|
|
352
|
+
case 1:
|
|
353
|
+
_a.trys.push([1, 8, , 9]);
|
|
285
354
|
recipientEmail = process.env.CLOUD_IDE_ALERT_EMAIL || process.env.SYSTEM_ALERT_EMAIL;
|
|
286
355
|
if (!recipientEmail) {
|
|
287
356
|
console.warn('⚠️ MongoDB alert email not sent: CLOUD_IDE_ALERT_EMAIL or SYSTEM_ALERT_EMAIL not configured');
|
|
357
|
+
serverName_1 = process.env.SERVER_NAME || process.env.NODE_ENV || 'Unknown';
|
|
358
|
+
subject = "\uD83D\uDEA8 ".concat(severity, ": MongoDB Connection Failure - ").concat(serverName_1);
|
|
359
|
+
body = "MongoDB connection alert - email recipient not configured. Please check CLOUD_IDE_ALERT_EMAIL or SYSTEM_ALERT_EMAIL environment variable.";
|
|
360
|
+
logAlertToFile(severity, subject, body, error);
|
|
288
361
|
return [2 /*return*/];
|
|
289
362
|
}
|
|
290
363
|
serverName = process.env.SERVER_NAME || process.env.NODE_ENV || 'Unknown';
|
|
291
364
|
mongoUri = process.env.MONGODB_URI ?
|
|
292
365
|
process.env.MONGODB_URI.replace(/\/\/([^:]+):([^@]+)@/, '//***:***@') : // Mask credentials
|
|
293
366
|
'Not configured';
|
|
294
|
-
|
|
295
|
-
|
|
367
|
+
errorDetails = error ? "\nError Details:\n- Error Name: ".concat((error === null || error === void 0 ? void 0 : error.name) || 'Unknown', "\n- Error Message: ").concat((error === null || error === void 0 ? void 0 : error.message) || 'No error message', "\n- Error Code: ").concat((error === null || error === void 0 ? void 0 : error.code) || 'N/A', "\n- Error Code Name: ").concat((error === null || error === void 0 ? void 0 : error.codeName) || 'N/A', "\n").concat((error === null || error === void 0 ? void 0 : error.stack) ? "- Error Stack: ".concat(error.stack.substring(0, 500), "...") : '', "\n ") : '';
|
|
368
|
+
subject = "\uD83D\uDEA8 ".concat(severity, ": MongoDB Connection Failure - ").concat(serverName);
|
|
369
|
+
body = "\n".concat(severity, ": MongoDB 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- Severity: ").concat(severity, "\n\nConnection Status:\n- Retry Attempts: ").concat(connectionRetryCount, "/").concat(MAX_RETRY_ATTEMPTS, "\n- Connection State: ").concat(mongoose.connection.readyState === 0 ? 'Disconnected' :
|
|
296
370
|
mongoose.connection.readyState === 1 ? 'Connected' :
|
|
297
|
-
mongoose.connection.readyState === 2 ? 'Connecting' : 'Unknown', "\n
|
|
371
|
+
mongoose.connection.readyState === 2 ? 'Connecting' : 'Unknown', "\n- Is Connecting: ").concat(isConnecting ? 'Yes' : 'No', "\n\n").concat(errorDetails, "\n\nAction Required:\n").concat(severity === 'CRITICAL' ?
|
|
372
|
+
'⚠️ CRITICAL: The system cannot connect to MongoDB. Database operations are failing.' :
|
|
373
|
+
"The system has failed to connect to MongoDB after ".concat(connectionRetryCount, " retry attempts."), "\n\nPlease check immediately:\n1. MongoDB server status (Atlas cluster, local server, etc.)\n2. Network connectivity and firewall rules\n3. IP whitelist in MongoDB Atlas (if using Atlas)\n4. MongoDB URI configuration and credentials\n5. MongoDB authentication credentials validity\n6. Server resources (memory, CPU, disk space)\n\nCommon Issues:\n- IP address not whitelisted in MongoDB Atlas\n- Network connectivity problems\n- MongoDB server is down or unreachable\n- Incorrect connection string or credentials\n- Firewall blocking MongoDB port (usually 27017)\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
374
|
emailGatewayUrl = process.env.EMAIL_GATEWAY_URL;
|
|
299
375
|
emailGatewayApiKey = process.env.EMAIL_GATEWAY_API_KEY;
|
|
300
376
|
senderEmail = process.env.EMAIL_SENDER || process.env.SYSTEM_EMAIL || 'noreply@cloudide.com';
|
|
301
|
-
if (!(emailGatewayUrl && emailGatewayApiKey)) return [3 /*break*/,
|
|
377
|
+
if (!(emailGatewayUrl && emailGatewayApiKey)) return [3 /*break*/, 6];
|
|
302
378
|
axios = require('axios');
|
|
303
379
|
emailPayload = {
|
|
304
380
|
to: recipientEmail,
|
|
@@ -307,9 +383,9 @@ function sendMongoDBConnectionAlert() {
|
|
|
307
383
|
body: body,
|
|
308
384
|
html: body.replace(/\n/g, '<br>') // Convert newlines to HTML breaks
|
|
309
385
|
};
|
|
310
|
-
_a.label =
|
|
311
|
-
case
|
|
312
|
-
_a.trys.push([
|
|
386
|
+
_a.label = 2;
|
|
387
|
+
case 2:
|
|
388
|
+
_a.trys.push([2, 4, , 5]);
|
|
313
389
|
return [4 /*yield*/, axios.post(emailGatewayUrl, emailPayload, {
|
|
314
390
|
headers: {
|
|
315
391
|
'Content-Type': 'application/json',
|
|
@@ -318,31 +394,91 @@ function sendMongoDBConnectionAlert() {
|
|
|
318
394
|
},
|
|
319
395
|
timeout: 10000 // 10 second timeout
|
|
320
396
|
})];
|
|
321
|
-
case
|
|
397
|
+
case 3:
|
|
322
398
|
_a.sent();
|
|
323
399
|
console.log("\uD83D\uDCE7 MongoDB connection failure alert email sent to ".concat(recipientEmail));
|
|
324
|
-
return [3 /*break*/,
|
|
325
|
-
case
|
|
400
|
+
return [3 /*break*/, 5];
|
|
401
|
+
case 4:
|
|
326
402
|
emailError_1 = _a.sent();
|
|
327
403
|
console.error('❌ Failed to send alert email via gateway:', (emailError_1 === null || emailError_1 === void 0 ? void 0 : emailError_1.message) || emailError_1);
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
404
|
+
// Fallback: Log to file when email fails
|
|
405
|
+
logAlertToFile(severity, subject, body, emailError_1);
|
|
406
|
+
return [3 /*break*/, 5];
|
|
407
|
+
case 5: return [3 /*break*/, 7];
|
|
408
|
+
case 6:
|
|
331
409
|
console.warn('⚠️ Alert email not sent: EMAIL_GATEWAY_URL and EMAIL_GATEWAY_API_KEY not configured');
|
|
332
410
|
console.warn('⚠️ Please configure email gateway environment variables for MongoDB connection failure alerts');
|
|
333
411
|
console.warn("\u26A0\uFE0F Alert details would have been sent to: ".concat(recipientEmail));
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
412
|
+
// Fallback: Log to file when email gateway not configured
|
|
413
|
+
logAlertToFile(severity, subject, body, error);
|
|
414
|
+
_a.label = 7;
|
|
415
|
+
case 7: return [3 /*break*/, 9];
|
|
416
|
+
case 8:
|
|
337
417
|
error_2 = _a.sent();
|
|
338
418
|
// Don't throw - this is a non-critical operation
|
|
339
419
|
console.error('❌ Failed to send MongoDB connection alert email:', (error_2 === null || error_2 === void 0 ? void 0 : error_2.message) || error_2);
|
|
340
|
-
|
|
341
|
-
|
|
420
|
+
// Fallback: Log to file when everything fails
|
|
421
|
+
logAlertToFile(severity, subject || 'MongoDB Connection Alert', body || 'MongoDB connection issue detected', error_2);
|
|
422
|
+
return [3 /*break*/, 9];
|
|
423
|
+
case 9: return [2 /*return*/];
|
|
342
424
|
}
|
|
343
425
|
});
|
|
344
426
|
});
|
|
345
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* Log alert to file (fallback when email fails)
|
|
430
|
+
* This ensures critical alerts are never lost
|
|
431
|
+
*/
|
|
432
|
+
function logAlertToFile(severity, subject, body, error) {
|
|
433
|
+
var _a, _b;
|
|
434
|
+
try {
|
|
435
|
+
// Log directory - create in project root/logs/alerts
|
|
436
|
+
var logDir = path.join(process.cwd(), 'logs', 'alerts');
|
|
437
|
+
// Ensure directory exists
|
|
438
|
+
if (!fs.existsSync(logDir)) {
|
|
439
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
440
|
+
}
|
|
441
|
+
// Get log file path for today (YYYY-MM-DD format)
|
|
442
|
+
var today = new Date();
|
|
443
|
+
var dateStr = today.toISOString().split('T')[0];
|
|
444
|
+
var logFilePath = path.join(logDir, "mongodb-alerts-".concat(dateStr, ".log"));
|
|
445
|
+
// Format log entry
|
|
446
|
+
var now = new Date();
|
|
447
|
+
var timestamp = now.toISOString();
|
|
448
|
+
var dateTime = now.toLocaleString('en-US', {
|
|
449
|
+
timeZone: 'UTC',
|
|
450
|
+
dateStyle: 'full',
|
|
451
|
+
timeStyle: 'long'
|
|
452
|
+
});
|
|
453
|
+
var logEntry = "\n".concat('='.repeat(80), "\nMONGODB ALERT LOG ENTRY\n").concat('='.repeat(80), "\nTimestamp: ").concat(timestamp, "\nDate & Time: ").concat(dateTime, "\nSeverity: ").concat(severity, "\nSubject: ").concat(subject, "\n\n").concat(body, "\n\n");
|
|
454
|
+
// Add error details if provided
|
|
455
|
+
if (error) {
|
|
456
|
+
logEntry += "\nERROR DETAILS:\n".concat('-'.repeat(80), "\n- Error Name: ").concat((error === null || error === void 0 ? void 0 : error.name) || 'Unknown', "\n- Error Message: ").concat((error === null || error === void 0 ? void 0 : error.message) || 'No error message', "\n- Error Code: ").concat((error === null || error === void 0 ? void 0 : error.code) || 'N/A', "\n- Error Code Name: ").concat((error === null || error === void 0 ? void 0 : error.codeName) || 'N/A', "\n");
|
|
457
|
+
if (error === null || error === void 0 ? void 0 : error.stack) {
|
|
458
|
+
logEntry += "- Error Stack:\n".concat(error.stack, "\n");
|
|
459
|
+
}
|
|
460
|
+
if (error === null || error === void 0 ? void 0 : error.response) {
|
|
461
|
+
logEntry += "- HTTP Response Status: ".concat(((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) || 'N/A', "\n");
|
|
462
|
+
logEntry += "- HTTP Response Data: ".concat(JSON.stringify(((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) || {}, null, 2), "\n");
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
logEntry += "".concat('='.repeat(80), "\n\n");
|
|
466
|
+
// Append to log file
|
|
467
|
+
fs.appendFileSync(logFilePath, logEntry, 'utf8');
|
|
468
|
+
console.log("\uD83D\uDCDD Alert logged to file: ".concat(logFilePath));
|
|
469
|
+
}
|
|
470
|
+
catch (fileError) {
|
|
471
|
+
// If file logging fails, at least log to console
|
|
472
|
+
console.error('❌ Failed to write alert to log file:', (fileError === null || fileError === void 0 ? void 0 : fileError.message) || fileError);
|
|
473
|
+
console.error('📝 Alert details (console fallback):');
|
|
474
|
+
console.error(" Severity: ".concat(severity));
|
|
475
|
+
console.error(" Subject: ".concat(subject));
|
|
476
|
+
console.error(" Body: ".concat(body));
|
|
477
|
+
if (error) {
|
|
478
|
+
console.error(" Error: ".concat((error === null || error === void 0 ? void 0 : error.message) || error));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
346
482
|
// Event listener for success and error
|
|
347
483
|
var customUUID = function () {
|
|
348
484
|
var _a, _b, _c;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IAcademicsBonafideRequest } from "cloud-ide-lms-model";
|
|
2
|
+
import mongoose from "mongoose";
|
|
3
|
+
declare const CAcademicsBonafideRequest: mongoose.Model<IAcademicsBonafideRequest, {}, {}, {}, mongoose.Document<unknown, {}, IAcademicsBonafideRequest, {}> & IAcademicsBonafideRequest & Required<{
|
|
4
|
+
_id: string;
|
|
5
|
+
}> & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export { CAcademicsBonafideRequest };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CAcademicsBonafideRequest = void 0;
|
|
4
|
+
var mongoose_1 = require("mongoose");
|
|
5
|
+
/* SCHEMA START */
|
|
6
|
+
var academics_bonafide_request = new mongoose_1.Schema({
|
|
7
|
+
abnr_request_number: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true,
|
|
10
|
+
unique: true,
|
|
11
|
+
maxlength: 50,
|
|
12
|
+
trim: true,
|
|
13
|
+
comment: "Auto-generated request number (e.g., BNF-2025-001234)"
|
|
14
|
+
},
|
|
15
|
+
abnr_student_id: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
maxlength: 50,
|
|
19
|
+
trim: true,
|
|
20
|
+
comment: "Student ID"
|
|
21
|
+
},
|
|
22
|
+
abnr_student_id_auth: {
|
|
23
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
24
|
+
ref: "auth_user_mst",
|
|
25
|
+
required: true,
|
|
26
|
+
comment: "Student user ID"
|
|
27
|
+
},
|
|
28
|
+
abnr_purpose: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true,
|
|
31
|
+
maxlength: 500,
|
|
32
|
+
trim: true,
|
|
33
|
+
comment: "Purpose of bonafide certificate"
|
|
34
|
+
},
|
|
35
|
+
abnr_request_date: {
|
|
36
|
+
type: Date,
|
|
37
|
+
required: true,
|
|
38
|
+
default: Date.now,
|
|
39
|
+
comment: "Request submission date"
|
|
40
|
+
},
|
|
41
|
+
abnr_status_id_sygms: {
|
|
42
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
43
|
+
ref: "core_general_master",
|
|
44
|
+
required: true,
|
|
45
|
+
comment: "Request status (from BONAFIDE_STATUS type)"
|
|
46
|
+
},
|
|
47
|
+
abnr_current_step: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 1,
|
|
50
|
+
comment: "Current workflow step"
|
|
51
|
+
},
|
|
52
|
+
abnr_workflow_id_wfrg: {
|
|
53
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
54
|
+
ref: "core_workflow_registry",
|
|
55
|
+
required: true,
|
|
56
|
+
comment: "Workflow reference"
|
|
57
|
+
},
|
|
58
|
+
abnr_requested_by_user: {
|
|
59
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
60
|
+
ref: "auth_user_mst",
|
|
61
|
+
required: true,
|
|
62
|
+
comment: "User who created the request"
|
|
63
|
+
},
|
|
64
|
+
abnr_soft_copy_id_cyfm: {
|
|
65
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
66
|
+
ref: "core_file_manager",
|
|
67
|
+
comment: "Generated soft copy PDF"
|
|
68
|
+
},
|
|
69
|
+
abnr_stamped_copy_id_cyfm: {
|
|
70
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
71
|
+
ref: "core_file_manager",
|
|
72
|
+
comment: "Stamped hard copy scan"
|
|
73
|
+
},
|
|
74
|
+
abnr_completed_date: {
|
|
75
|
+
type: Date,
|
|
76
|
+
comment: "Date when request was completed"
|
|
77
|
+
},
|
|
78
|
+
abnr_entity_id_syen: {
|
|
79
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
80
|
+
ref: "core_system_entity",
|
|
81
|
+
required: true,
|
|
82
|
+
comment: "Entity reference"
|
|
83
|
+
},
|
|
84
|
+
abnr_isactive: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: true,
|
|
87
|
+
comment: "Active status"
|
|
88
|
+
}
|
|
89
|
+
}, { collection: 'academics_bonafide_request' });
|
|
90
|
+
// Indexes for performance optimization
|
|
91
|
+
academics_bonafide_request.index({ abnr_request_number: 1 });
|
|
92
|
+
academics_bonafide_request.index({ abnr_student_id_auth: 1, abnr_isactive: 1 });
|
|
93
|
+
academics_bonafide_request.index({ abnr_status_id_sygms: 1, abnr_isactive: 1 });
|
|
94
|
+
academics_bonafide_request.index({ abnr_workflow_id_wfrg: 1, abnr_current_step: 1 });
|
|
95
|
+
academics_bonafide_request.index({ abnr_entity_id_syen: 1, abnr_isactive: 1 });
|
|
96
|
+
academics_bonafide_request.index({ abnr_request_date: -1 });
|
|
97
|
+
var CAcademicsBonafideRequest = mongoose_1.default.model("academics_bonafide_request", academics_bonafide_request);
|
|
98
|
+
exports.CAcademicsBonafideRequest = CAcademicsBonafideRequest;
|
|
@@ -20,3 +20,4 @@ __exportStar(require("./aca_class_program_master"), exports);
|
|
|
20
20
|
__exportStar(require("./aca_class_program_term"), exports);
|
|
21
21
|
__exportStar(require("./aca_prg_trm_section"), exports);
|
|
22
22
|
__exportStar(require("./aca_class_prg_branch"), exports);
|
|
23
|
+
__exportStar(require("./academics_bonafide_request"), exports);
|
|
@@ -75,5 +75,16 @@ var auth_user_mst = new mongoose_1.Schema({
|
|
|
75
75
|
type: Boolean
|
|
76
76
|
}
|
|
77
77
|
}, { collection: 'auth_user_mst' });
|
|
78
|
+
// Indexes for performance optimization
|
|
79
|
+
// Compound index for user listing queries (sorting and filtering)
|
|
80
|
+
auth_user_mst.index({ user_fullname: 1, user_username: 1 });
|
|
81
|
+
// Index for email search queries
|
|
82
|
+
auth_user_mst.index({ user_emailid: 1 });
|
|
83
|
+
// Index for username search (already unique, but explicit index for clarity)
|
|
84
|
+
auth_user_mst.index({ user_username: 1 });
|
|
85
|
+
// Index for fullname search
|
|
86
|
+
auth_user_mst.index({ user_fullname: 1 });
|
|
87
|
+
// Index for active user filtering
|
|
88
|
+
auth_user_mst.index({ user_isactive: 1 });
|
|
78
89
|
var CUser = mongoose_1.default.model('auth_user_mst', auth_user_mst);
|
|
79
90
|
exports.CUser = CUser;
|
|
@@ -39,5 +39,11 @@ var core_department = new mongoose_1.Schema({
|
|
|
39
39
|
required: true
|
|
40
40
|
}
|
|
41
41
|
}, { collection: 'core_department' });
|
|
42
|
+
// Indexes for performance optimization
|
|
43
|
+
// Index for entity-based department lookups
|
|
44
|
+
core_department.index({ sydept_entity_id_syen: 1, sydept_isactive: 1 });
|
|
45
|
+
// Index for active department filtering
|
|
46
|
+
core_department.index({ sydept_isactive: 1 });
|
|
47
|
+
// Note: _id is automatically indexed by MongoDB
|
|
42
48
|
var CCoreSydept = mongoose_1.default.model("core_department", core_department);
|
|
43
49
|
exports.CCoreSydept = CCoreSydept;
|
|
@@ -49,5 +49,11 @@ var core_designation = new mongoose_1.Schema({
|
|
|
49
49
|
required: true
|
|
50
50
|
}
|
|
51
51
|
}, { collection: 'core_designation' });
|
|
52
|
+
// Indexes for performance optimization
|
|
53
|
+
// Index for entity-based designation lookups
|
|
54
|
+
core_designation.index({ desg_entity_id_syen: 1, sydsg_isactive: 1 });
|
|
55
|
+
// Index for active designation filtering
|
|
56
|
+
core_designation.index({ sydsg_isactive: 1 });
|
|
57
|
+
// Note: _id is automatically indexed by MongoDB
|
|
52
58
|
var CCoreSydsg = mongoose_1.default.model("core_designation", core_designation);
|
|
53
59
|
exports.CCoreSydsg = CCoreSydsg;
|
|
@@ -49,5 +49,16 @@ var core_entity_mapping = new mongoose_1.Schema({
|
|
|
49
49
|
default: true
|
|
50
50
|
},
|
|
51
51
|
}, { collection: 'core_entity_mapping' });
|
|
52
|
+
// Indexes for performance optimization
|
|
53
|
+
// Compound index for user listing queries with entity filtering (most common query pattern)
|
|
54
|
+
core_entity_mapping.index({ syenm_id_user: 1, syenm_entity_id_syen: 1, syenm_isactive: 1 });
|
|
55
|
+
// Index for user-based lookups
|
|
56
|
+
core_entity_mapping.index({ syenm_id_user: 1, syenm_isactive: 1 });
|
|
57
|
+
// Index for entity-based lookups
|
|
58
|
+
core_entity_mapping.index({ syenm_entity_id_syen: 1, syenm_isactive: 1 });
|
|
59
|
+
// Index for role lookups
|
|
60
|
+
core_entity_mapping.index({ syenm_role_id_syusrol: 1 });
|
|
61
|
+
// Index for active mappings only
|
|
62
|
+
core_entity_mapping.index({ syenm_isactive: 1 });
|
|
52
63
|
var CCoreSyenm = mongoose_1.default.model("core_entity_mapping", core_entity_mapping);
|
|
53
64
|
exports.CCoreSyenm = CCoreSyenm;
|
|
@@ -26,5 +26,11 @@ var core_user_role = new mongoose_1.Schema({
|
|
|
26
26
|
default: true
|
|
27
27
|
}
|
|
28
28
|
}, { collection: 'core_user_role' });
|
|
29
|
+
// Indexes for performance optimization
|
|
30
|
+
// Index for active role filtering
|
|
31
|
+
core_user_role.index({ syusrol_isactive: 1 });
|
|
32
|
+
// Index for entity-based role lookups
|
|
33
|
+
core_user_role.index({ syusrol_role_entity_id_syen: 1, syusrol_isactive: 1 });
|
|
34
|
+
// Note: _id is automatically indexed by MongoDB
|
|
29
35
|
var CCoreUserRole = mongoose_1.default.model("core_user_role", core_user_role);
|
|
30
36
|
exports.CCoreUserRole = CCoreUserRole;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICoreWorkflowApproverRules } from "cloud-ide-lms-model";
|
|
2
|
+
import mongoose from "mongoose";
|
|
3
|
+
declare const CCoreWorkflowApproverRules: mongoose.Model<ICoreWorkflowApproverRules, {}, {}, {}, mongoose.Document<unknown, {}, ICoreWorkflowApproverRules, {}> & ICoreWorkflowApproverRules & Required<{
|
|
4
|
+
_id: string;
|
|
5
|
+
}> & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export { CCoreWorkflowApproverRules };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CCoreWorkflowApproverRules = void 0;
|
|
4
|
+
var mongoose_1 = require("mongoose");
|
|
5
|
+
/* SCHEMA START */
|
|
6
|
+
var core_workflow_approver_rules = new mongoose_1.Schema({
|
|
7
|
+
wfar_workflow_config_id_wfcfg: {
|
|
8
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
9
|
+
ref: "core_workflow_config",
|
|
10
|
+
required: true,
|
|
11
|
+
comment: "Workflow config reference"
|
|
12
|
+
},
|
|
13
|
+
wfar_approval_group_id: {
|
|
14
|
+
type: String,
|
|
15
|
+
maxlength: 50,
|
|
16
|
+
trim: true,
|
|
17
|
+
comment: "Group identifier for complex approval logic (e.g., 'group_a', 'group_b')"
|
|
18
|
+
},
|
|
19
|
+
wfar_group_approval_type_id_sygms: {
|
|
20
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
21
|
+
ref: "core_general_master",
|
|
22
|
+
comment: "Approval type for this group (ANY, ALL, SEQUENTIAL)"
|
|
23
|
+
},
|
|
24
|
+
wfar_rule_type_id_sygms: {
|
|
25
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
26
|
+
ref: "core_general_master",
|
|
27
|
+
required: true,
|
|
28
|
+
comment: "Primary rule type (from WORKFLOW_RULE_TYPE)"
|
|
29
|
+
},
|
|
30
|
+
wfar_rule_value: {
|
|
31
|
+
type: String,
|
|
32
|
+
maxlength: 200,
|
|
33
|
+
trim: true,
|
|
34
|
+
comment: "ID or code based on rule_type"
|
|
35
|
+
},
|
|
36
|
+
wfar_rule_operator_id_sygms: {
|
|
37
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
38
|
+
ref: "core_general_master",
|
|
39
|
+
required: true,
|
|
40
|
+
comment: "Operator (from WORKFLOW_RULE_OPERATOR: include, exclude)"
|
|
41
|
+
},
|
|
42
|
+
wfar_combined_filters: {
|
|
43
|
+
type: Object,
|
|
44
|
+
comment: "Combined filters for targeted approver selection (designation + department, etc.)"
|
|
45
|
+
},
|
|
46
|
+
wfar_priority: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 1,
|
|
49
|
+
comment: "Rule priority (lower = higher priority)"
|
|
50
|
+
},
|
|
51
|
+
wfar_condition: {
|
|
52
|
+
type: Object,
|
|
53
|
+
comment: "JSON condition for conditional routing"
|
|
54
|
+
},
|
|
55
|
+
wfar_is_optional: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
comment: "Is this an optional approver group"
|
|
59
|
+
},
|
|
60
|
+
wfar_min_approvals: {
|
|
61
|
+
type: Number,
|
|
62
|
+
comment: "Minimum approvals required from this group (for optional groups)"
|
|
63
|
+
},
|
|
64
|
+
wfar_valid_from_date: {
|
|
65
|
+
type: Date,
|
|
66
|
+
comment: "Rule valid from date (for time-based approver assignment)"
|
|
67
|
+
},
|
|
68
|
+
wfar_valid_to_date: {
|
|
69
|
+
type: Date,
|
|
70
|
+
comment: "Rule valid to date (for time-based approver assignment)"
|
|
71
|
+
},
|
|
72
|
+
wfar_isactive: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: true,
|
|
75
|
+
comment: "Rule is active"
|
|
76
|
+
}
|
|
77
|
+
}, { collection: 'core_workflow_approver_rules' });
|
|
78
|
+
// Indexes for performance optimization
|
|
79
|
+
core_workflow_approver_rules.index({ wfar_workflow_config_id_wfcfg: 1, wfar_isactive: 1 });
|
|
80
|
+
core_workflow_approver_rules.index({ wfar_approval_group_id: 1 });
|
|
81
|
+
core_workflow_approver_rules.index({ wfar_rule_type_id_sygms: 1, wfar_rule_value: 1 });
|
|
82
|
+
var CCoreWorkflowApproverRules = mongoose_1.default.model("core_workflow_approver_rules", core_workflow_approver_rules);
|
|
83
|
+
exports.CCoreWorkflowApproverRules = CCoreWorkflowApproverRules;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICoreWorkflowConfig } from "cloud-ide-lms-model";
|
|
2
|
+
import mongoose from "mongoose";
|
|
3
|
+
declare const CCoreWorkflowConfig: mongoose.Model<ICoreWorkflowConfig, {}, {}, {}, mongoose.Document<unknown, {}, ICoreWorkflowConfig, {}> & ICoreWorkflowConfig & Required<{
|
|
4
|
+
_id: string;
|
|
5
|
+
}> & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export { CCoreWorkflowConfig };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CCoreWorkflowConfig = void 0;
|
|
4
|
+
var mongoose_1 = require("mongoose");
|
|
5
|
+
/* SCHEMA START */
|
|
6
|
+
var core_workflow_config = new mongoose_1.Schema({
|
|
7
|
+
wfcfg_workflow_id_wfrg: {
|
|
8
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
9
|
+
ref: "core_workflow_registry",
|
|
10
|
+
required: true,
|
|
11
|
+
comment: "Workflow reference"
|
|
12
|
+
},
|
|
13
|
+
wfcfg_step_number: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true,
|
|
16
|
+
comment: "Step sequence (1, 2, 3...)"
|
|
17
|
+
},
|
|
18
|
+
wfcfg_step_name: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
maxlength: 100,
|
|
22
|
+
trim: true,
|
|
23
|
+
comment: "Step display name"
|
|
24
|
+
},
|
|
25
|
+
wfcfg_approval_type_id_sygms: {
|
|
26
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
27
|
+
ref: "core_general_master",
|
|
28
|
+
comment: "Approval logic type (from WORKFLOW_APPROVAL_TYPE)"
|
|
29
|
+
},
|
|
30
|
+
wfcfg_approval_logic: {
|
|
31
|
+
type: Object,
|
|
32
|
+
comment: "Complex approval logic configuration (for group-based approvals)"
|
|
33
|
+
},
|
|
34
|
+
wfcfg_allow_edit: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
comment: "Can approver edit component values"
|
|
38
|
+
},
|
|
39
|
+
wfcfg_allow_reject: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true,
|
|
42
|
+
comment: "Can approver reject"
|
|
43
|
+
},
|
|
44
|
+
wfcfg_allow_request_changes: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true,
|
|
47
|
+
comment: "Can approver request changes"
|
|
48
|
+
},
|
|
49
|
+
wfcfg_timeout_hours: {
|
|
50
|
+
type: Number,
|
|
51
|
+
comment: "Auto-escalation timeout in hours"
|
|
52
|
+
},
|
|
53
|
+
wfcfg_escalation_step: {
|
|
54
|
+
type: Number,
|
|
55
|
+
comment: "Step to escalate to if timeout"
|
|
56
|
+
},
|
|
57
|
+
wfcfg_use_fallback: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
comment: "Use fallback rules if no rules match"
|
|
61
|
+
},
|
|
62
|
+
wfcfg_valid_from_date: {
|
|
63
|
+
type: Date,
|
|
64
|
+
comment: "Step valid from date (for time-based rules)"
|
|
65
|
+
},
|
|
66
|
+
wfcfg_valid_to_date: {
|
|
67
|
+
type: Date,
|
|
68
|
+
comment: "Step valid to date (for time-based rules)"
|
|
69
|
+
},
|
|
70
|
+
wfcfg_isactive: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true,
|
|
73
|
+
comment: "Step is active"
|
|
74
|
+
},
|
|
75
|
+
wfcfg_fallback_user_id_auth: {
|
|
76
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
77
|
+
ref: "auth_user_mst",
|
|
78
|
+
comment: "Fallback approver user"
|
|
79
|
+
},
|
|
80
|
+
wfcfg_fallback_designation_id: {
|
|
81
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
82
|
+
comment: "Fallback approver designation"
|
|
83
|
+
},
|
|
84
|
+
wfcfg_fallback_department_id: {
|
|
85
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
86
|
+
comment: "Fallback approver department"
|
|
87
|
+
},
|
|
88
|
+
wfcfg_fallback_role_id: {
|
|
89
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
90
|
+
ref: "core_user_role",
|
|
91
|
+
comment: "Fallback approver role"
|
|
92
|
+
},
|
|
93
|
+
wfcfg_notify_all_approvers: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: true,
|
|
96
|
+
comment: "Notify all matching approvers"
|
|
97
|
+
}
|
|
98
|
+
}, { collection: 'core_workflow_config' });
|
|
99
|
+
// Indexes for performance optimization
|
|
100
|
+
core_workflow_config.index({ wfcfg_workflow_id_wfrg: 1, wfcfg_step_number: 1 });
|
|
101
|
+
core_workflow_config.index({ wfcfg_workflow_id_wfrg: 1, wfcfg_isactive: 1 });
|
|
102
|
+
var CCoreWorkflowConfig = mongoose_1.default.model("core_workflow_config", core_workflow_config);
|
|
103
|
+
exports.CCoreWorkflowConfig = CCoreWorkflowConfig;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICoreWorkflowRegistry } from "cloud-ide-lms-model";
|
|
2
|
+
import mongoose from "mongoose";
|
|
3
|
+
declare const CCoreWorkflowRegistry: mongoose.Model<ICoreWorkflowRegistry, {}, {}, {}, mongoose.Document<unknown, {}, ICoreWorkflowRegistry, {}> & ICoreWorkflowRegistry & Required<{
|
|
4
|
+
_id: string;
|
|
5
|
+
}> & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export { CCoreWorkflowRegistry };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CCoreWorkflowRegistry = void 0;
|
|
4
|
+
var mongoose_1 = require("mongoose");
|
|
5
|
+
/* SCHEMA START */
|
|
6
|
+
var core_workflow_registry = new mongoose_1.Schema({
|
|
7
|
+
wfrg_workflow_code: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true,
|
|
10
|
+
unique: true,
|
|
11
|
+
maxlength: 40,
|
|
12
|
+
trim: true,
|
|
13
|
+
comment: "Unique workflow identifier"
|
|
14
|
+
},
|
|
15
|
+
wfrg_title: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
maxlength: 100,
|
|
19
|
+
trim: true,
|
|
20
|
+
comment: "Workflow display name"
|
|
21
|
+
},
|
|
22
|
+
wfrg_desc: {
|
|
23
|
+
type: String,
|
|
24
|
+
maxlength: 500,
|
|
25
|
+
trim: true,
|
|
26
|
+
comment: "Description"
|
|
27
|
+
},
|
|
28
|
+
wfrg_category_id_sygms: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "core_general_master",
|
|
31
|
+
comment: "Category (Bonafide, Fee Refund, etc.) - Reference to core_general_master with type 'WORKFLOW_CATEGORY'"
|
|
32
|
+
},
|
|
33
|
+
wfrg_entity_id_syen: {
|
|
34
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
35
|
+
ref: "core_system_entity",
|
|
36
|
+
comment: "Entity-specific configuration"
|
|
37
|
+
},
|
|
38
|
+
wfrg_page_id_sypg: {
|
|
39
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
40
|
+
ref: "core_system_pages",
|
|
41
|
+
comment: "Associated page"
|
|
42
|
+
},
|
|
43
|
+
wfrg_menu_id_syme: {
|
|
44
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
45
|
+
ref: "core_system_menu",
|
|
46
|
+
comment: "Associated menu (alternative to page)"
|
|
47
|
+
},
|
|
48
|
+
wfrg_component_selector: {
|
|
49
|
+
type: String,
|
|
50
|
+
maxlength: 200,
|
|
51
|
+
trim: true,
|
|
52
|
+
comment: "Angular component selector (e.g., 'app-bonafide-form')"
|
|
53
|
+
},
|
|
54
|
+
wfrg_component_path: {
|
|
55
|
+
type: String,
|
|
56
|
+
maxlength: 500,
|
|
57
|
+
trim: true,
|
|
58
|
+
comment: "Module path for lazy loading"
|
|
59
|
+
},
|
|
60
|
+
wfrg_query_params: {
|
|
61
|
+
type: Object,
|
|
62
|
+
comment: "Default query parameters for component"
|
|
63
|
+
},
|
|
64
|
+
wfrg_view_mode_id_sygms: {
|
|
65
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
66
|
+
ref: "core_general_master",
|
|
67
|
+
comment: "View mode (from WORKFLOW_VIEW_MODE type)"
|
|
68
|
+
},
|
|
69
|
+
wfrg_trigger_type_id_sygms: {
|
|
70
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
71
|
+
ref: "core_general_master",
|
|
72
|
+
comment: "Trigger type (from WORKFLOW_TRIGGER_TYPE)"
|
|
73
|
+
},
|
|
74
|
+
wfrg_trigger_condition: {
|
|
75
|
+
type: Object,
|
|
76
|
+
comment: "Condition for conditional triggers"
|
|
77
|
+
},
|
|
78
|
+
wfrg_auto_initialize: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true,
|
|
81
|
+
comment: "Auto-initialize on submission"
|
|
82
|
+
},
|
|
83
|
+
wfrg_isactive: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: true,
|
|
86
|
+
comment: "Workflow is active and can be used"
|
|
87
|
+
},
|
|
88
|
+
wfrg_valid_from_date: {
|
|
89
|
+
type: Date,
|
|
90
|
+
comment: "Workflow valid from date (for time-based activation)"
|
|
91
|
+
},
|
|
92
|
+
wfrg_valid_to_date: {
|
|
93
|
+
type: Date,
|
|
94
|
+
comment: "Workflow valid to date (for time-based deactivation)"
|
|
95
|
+
},
|
|
96
|
+
wfrg_reinitialize_on_edit: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: true,
|
|
99
|
+
comment: "Re-initialize workflow when form is re-edited"
|
|
100
|
+
},
|
|
101
|
+
wfrg_notify_approvers_on_final_status: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: true,
|
|
104
|
+
comment: "Notify all approvers of final status"
|
|
105
|
+
},
|
|
106
|
+
wfrg_show_approver_names: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: true,
|
|
109
|
+
comment: "Show approver names in notifications/history"
|
|
110
|
+
},
|
|
111
|
+
wfrg_mask_approver_info: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
114
|
+
comment: "Mask approver information (for sensitive cases)"
|
|
115
|
+
},
|
|
116
|
+
wfrg_configuration: {
|
|
117
|
+
type: Object,
|
|
118
|
+
comment: "Additional JSON configuration"
|
|
119
|
+
}
|
|
120
|
+
}, { collection: 'core_workflow_registry' });
|
|
121
|
+
// Indexes for performance optimization
|
|
122
|
+
core_workflow_registry.index({ wfrg_workflow_code: 1 });
|
|
123
|
+
core_workflow_registry.index({ wfrg_category_id_sygms: 1, wfrg_entity_id_syen: 1, wfrg_isactive: 1 });
|
|
124
|
+
core_workflow_registry.index({ wfrg_page_id_sypg: 1, wfrg_isactive: 1 });
|
|
125
|
+
core_workflow_registry.index({ wfrg_menu_id_syme: 1, wfrg_isactive: 1 });
|
|
126
|
+
core_workflow_registry.index({ wfrg_entity_id_syen: 1, wfrg_isactive: 1 });
|
|
127
|
+
var CCoreWorkflowRegistry = mongoose_1.default.model("core_workflow_registry", core_workflow_registry);
|
|
128
|
+
exports.CCoreWorkflowRegistry = CCoreWorkflowRegistry;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICoreWorkflowTransactionHistory } from "cloud-ide-lms-model";
|
|
2
|
+
import mongoose from "mongoose";
|
|
3
|
+
declare const CCoreWorkflowTransactionHistory: mongoose.Model<ICoreWorkflowTransactionHistory, {}, {}, {}, mongoose.Document<unknown, {}, ICoreWorkflowTransactionHistory, {}> & ICoreWorkflowTransactionHistory & Required<{
|
|
4
|
+
_id: string;
|
|
5
|
+
}> & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export { CCoreWorkflowTransactionHistory };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CCoreWorkflowTransactionHistory = void 0;
|
|
4
|
+
var mongoose_1 = require("mongoose");
|
|
5
|
+
/* SCHEMA START */
|
|
6
|
+
var core_workflow_transaction_history = new mongoose_1.Schema({
|
|
7
|
+
wfth_workflow_id_wfrg: {
|
|
8
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
9
|
+
ref: "core_workflow_registry",
|
|
10
|
+
required: true,
|
|
11
|
+
comment: "Workflow reference"
|
|
12
|
+
},
|
|
13
|
+
wfth_request_id: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
maxlength: 100,
|
|
17
|
+
trim: true,
|
|
18
|
+
comment: "Reference to request (table name + _id)"
|
|
19
|
+
},
|
|
20
|
+
wfth_request_table: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
maxlength: 100,
|
|
24
|
+
trim: true,
|
|
25
|
+
comment: "Source table name"
|
|
26
|
+
},
|
|
27
|
+
wfth_step_number: {
|
|
28
|
+
type: Number,
|
|
29
|
+
required: true,
|
|
30
|
+
comment: "Workflow step"
|
|
31
|
+
},
|
|
32
|
+
wfth_action_type_id_sygms: {
|
|
33
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
34
|
+
ref: "core_general_master",
|
|
35
|
+
required: true,
|
|
36
|
+
comment: "Action type (from WORKFLOW_ACTION_TYPE)"
|
|
37
|
+
},
|
|
38
|
+
wfth_action_by_user: {
|
|
39
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
40
|
+
ref: "auth_user_mst",
|
|
41
|
+
required: true,
|
|
42
|
+
comment: "User who performed the action"
|
|
43
|
+
},
|
|
44
|
+
wfth_action_date: {
|
|
45
|
+
type: Date,
|
|
46
|
+
required: true,
|
|
47
|
+
default: Date.now,
|
|
48
|
+
comment: "Action date and time"
|
|
49
|
+
},
|
|
50
|
+
wfth_comments: {
|
|
51
|
+
type: String,
|
|
52
|
+
maxlength: 1000,
|
|
53
|
+
trim: true,
|
|
54
|
+
comment: "Action comments"
|
|
55
|
+
},
|
|
56
|
+
wfth_previous_values: {
|
|
57
|
+
type: Object,
|
|
58
|
+
comment: "Previous component values (if edited)"
|
|
59
|
+
},
|
|
60
|
+
wfth_new_values: {
|
|
61
|
+
type: Object,
|
|
62
|
+
comment: "New component values (if edited)"
|
|
63
|
+
},
|
|
64
|
+
wfth_attachments: {
|
|
65
|
+
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
66
|
+
ref: "core_file_manager",
|
|
67
|
+
comment: "Attachments related to this action"
|
|
68
|
+
},
|
|
69
|
+
wfth_notification_sent: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
comment: "Whether notification was sent"
|
|
73
|
+
},
|
|
74
|
+
wfth_entity_id_syen: {
|
|
75
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
76
|
+
ref: "core_system_entity",
|
|
77
|
+
comment: "Entity reference"
|
|
78
|
+
}
|
|
79
|
+
}, { collection: 'core_workflow_transaction_history' });
|
|
80
|
+
// Indexes for performance optimization
|
|
81
|
+
core_workflow_transaction_history.index({ wfth_workflow_id_wfrg: 1, wfth_request_id: 1 });
|
|
82
|
+
core_workflow_transaction_history.index({ wfth_request_table: 1, wfth_request_id: 1 });
|
|
83
|
+
core_workflow_transaction_history.index({ wfth_action_by_user: 1, wfth_action_date: -1 });
|
|
84
|
+
core_workflow_transaction_history.index({ wfth_action_date: -1 });
|
|
85
|
+
var CCoreWorkflowTransactionHistory = mongoose_1.default.model("core_workflow_transaction_history", core_workflow_transaction_history);
|
|
86
|
+
exports.CCoreWorkflowTransactionHistory = CCoreWorkflowTransactionHistory;
|
|
@@ -36,6 +36,10 @@ import { CCoreEntityUdise } from './core_entity_udise';
|
|
|
36
36
|
import { CCoreBoardExamPattern } from './core_board_exam_pattern';
|
|
37
37
|
import { CCoreBoardGradeSystem } from './core_board_grade_system';
|
|
38
38
|
import { CCoreDashboardCards } from './core_dashboard_cards';
|
|
39
|
+
import { CCoreWorkflowRegistry } from './core_workflow_registry';
|
|
40
|
+
import { CCoreWorkflowConfig } from './core_workflow_config';
|
|
41
|
+
import { CCoreWorkflowApproverRules } from './core_workflow_approver_rules';
|
|
42
|
+
import { CCoreWorkflowTransactionHistory } from './core_workflow_transaction_history';
|
|
39
43
|
export * from './core_user_contact_addresses';
|
|
40
44
|
export * from './core_entity_access_pass_management';
|
|
41
45
|
export { CCoreSypg, CCoreSytm, CCoreSyme, CCoreSylog, CCoreSyen, CCoreSyco, CCoreFinancialConfig, CCoreSypin, CCoreSyptb, CCoreSypgr, CCoreSype, CCoreSygms, CCoreSygmt, CCoreSyenm, CCoreCyfm, CCoreSyctr, CCoreSynat,
|
|
@@ -80,4 +84,12 @@ CCoreBoardGradeSystem,
|
|
|
80
84
|
/** User Type Mapping schemas */
|
|
81
85
|
CCoreUserTypeMapping,
|
|
82
86
|
/** Dashboard Cards schemas */
|
|
83
|
-
CCoreDashboardCards
|
|
87
|
+
CCoreDashboardCards,
|
|
88
|
+
/** Workflow Registry schemas */
|
|
89
|
+
CCoreWorkflowRegistry,
|
|
90
|
+
/** Workflow Config schemas */
|
|
91
|
+
CCoreWorkflowConfig,
|
|
92
|
+
/** Workflow Approver Rules schemas */
|
|
93
|
+
CCoreWorkflowApproverRules,
|
|
94
|
+
/** Workflow Transaction History schemas */
|
|
95
|
+
CCoreWorkflowTransactionHistory };
|
package/lib/schema/core/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.CCoreDashboardCards = exports.CCoreUserTypeMapping = exports.CCoreBoardGradeSystem = exports.CCoreBoardExamPattern = exports.CCoreEntityUdise = exports.CCoreSchoolBoardAffiliation = exports.CCoreEducationBoard = exports.CCoreUserRoleExceptions = exports.CCoreUserRoleRights = exports.CCoreUserRole = exports.CCoreUserFamilyDetails = exports.CCoreUserDocuments = exports.CCoreSydept = exports.CCoreSydsgl = exports.CCoreSydsg = exports.CCoreSycr = exports.CCoreSypn = exports.CCoreSyoth = exports.CCoreSyupth = exports.CCoreSyth = exports.CCoreSylang = exports.CCoreSynat = exports.CCoreSyctr = exports.CCoreCyfm = exports.CCoreSyenm = exports.CCoreSygmt = exports.CCoreSygms = exports.CCoreSype = exports.CCoreSypgr = exports.CCoreSyptb = exports.CCoreSypin = exports.CCoreFinancialConfig = exports.CCoreSyco = exports.CCoreSyen = exports.CCoreSylog = exports.CCoreSyme = exports.CCoreSytm = exports.CCoreSypg = void 0;
|
|
17
|
+
exports.CCoreWorkflowTransactionHistory = exports.CCoreWorkflowApproverRules = exports.CCoreWorkflowConfig = exports.CCoreWorkflowRegistry = exports.CCoreDashboardCards = exports.CCoreUserTypeMapping = exports.CCoreBoardGradeSystem = exports.CCoreBoardExamPattern = exports.CCoreEntityUdise = exports.CCoreSchoolBoardAffiliation = exports.CCoreEducationBoard = exports.CCoreUserRoleExceptions = exports.CCoreUserRoleRights = exports.CCoreUserRole = exports.CCoreUserFamilyDetails = exports.CCoreUserDocuments = exports.CCoreSydept = exports.CCoreSydsgl = exports.CCoreSydsg = exports.CCoreSycr = exports.CCoreSypn = exports.CCoreSyoth = exports.CCoreSyupth = exports.CCoreSyth = exports.CCoreSylang = exports.CCoreSynat = exports.CCoreSyctr = exports.CCoreCyfm = exports.CCoreSyenm = exports.CCoreSygmt = exports.CCoreSygms = exports.CCoreSype = exports.CCoreSypgr = exports.CCoreSyptb = exports.CCoreSypin = exports.CCoreFinancialConfig = exports.CCoreSyco = exports.CCoreSyen = exports.CCoreSylog = exports.CCoreSyme = exports.CCoreSytm = exports.CCoreSypg = void 0;
|
|
18
18
|
var core_system_pages_1 = require("./core_system_pages");
|
|
19
19
|
Object.defineProperty(exports, "CCoreSypg", { enumerable: true, get: function () { return core_system_pages_1.CCoreSypg; } });
|
|
20
20
|
var core_system_pages_theme_1 = require("./core_system_pages_theme");
|
|
@@ -91,5 +91,13 @@ var core_board_grade_system_1 = require("./core_board_grade_system");
|
|
|
91
91
|
Object.defineProperty(exports, "CCoreBoardGradeSystem", { enumerable: true, get: function () { return core_board_grade_system_1.CCoreBoardGradeSystem; } });
|
|
92
92
|
var core_dashboard_cards_1 = require("./core_dashboard_cards");
|
|
93
93
|
Object.defineProperty(exports, "CCoreDashboardCards", { enumerable: true, get: function () { return core_dashboard_cards_1.CCoreDashboardCards; } });
|
|
94
|
+
var core_workflow_registry_1 = require("./core_workflow_registry");
|
|
95
|
+
Object.defineProperty(exports, "CCoreWorkflowRegistry", { enumerable: true, get: function () { return core_workflow_registry_1.CCoreWorkflowRegistry; } });
|
|
96
|
+
var core_workflow_config_1 = require("./core_workflow_config");
|
|
97
|
+
Object.defineProperty(exports, "CCoreWorkflowConfig", { enumerable: true, get: function () { return core_workflow_config_1.CCoreWorkflowConfig; } });
|
|
98
|
+
var core_workflow_approver_rules_1 = require("./core_workflow_approver_rules");
|
|
99
|
+
Object.defineProperty(exports, "CCoreWorkflowApproverRules", { enumerable: true, get: function () { return core_workflow_approver_rules_1.CCoreWorkflowApproverRules; } });
|
|
100
|
+
var core_workflow_transaction_history_1 = require("./core_workflow_transaction_history");
|
|
101
|
+
Object.defineProperty(exports, "CCoreWorkflowTransactionHistory", { enumerable: true, get: function () { return core_workflow_transaction_history_1.CCoreWorkflowTransactionHistory; } });
|
|
94
102
|
__exportStar(require("./core_user_contact_addresses"), exports);
|
|
95
103
|
__exportStar(require("./core_entity_access_pass_management"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"cloud-ide-lms-model": "^1.
|
|
3
|
+
"cloud-ide-lms-model": "^1.1.8",
|
|
4
4
|
"dotenv": "^16.5.0",
|
|
5
5
|
"mongoose": "^8.15.0"
|
|
6
6
|
},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"typescript": "^5.8.3"
|
|
10
10
|
},
|
|
11
11
|
"name": "cloud-ide-model-schema",
|
|
12
|
-
"version": "1.1.
|
|
12
|
+
"version": "1.1.144",
|
|
13
13
|
"description": "Pachage for schema management of Cloud IDEsys LMS",
|
|
14
14
|
"main": "lib/index.js",
|
|
15
15
|
"types": "lib/index.d.ts",
|