@platform-modules/foreign-ministry 1.3.334 → 1.3.335
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/.env +9 -4
- package/dist/helpers/sla-request-status.helper.d.ts +3 -0
- package/dist/helpers/sla-request-status.helper.js +36 -0
- package/dist/models/EmbassyEvaluationDepartmentSettingModel.d.ts +14 -0
- package/dist/models/EmbassyEvaluationDepartmentSettingModel.js +56 -0
- package/dist/models/EvaluationMastersModel.d.ts +16 -0
- package/dist/models/EvaluationMastersModel.js +67 -0
- package/dist/models/EvaluationQuestionMasterModel.d.ts +10 -0
- package/dist/models/EvaluationQuestionMasterModel.js +42 -0
- package/dist/models/EvaluationSectionMasterModel.d.ts +7 -0
- package/dist/models/EvaluationSectionMasterModel.js +36 -0
- package/dist/models/EvaluationWorkflowModel.d.ts +60 -0
- package/dist/models/EvaluationWorkflowModel.js +215 -0
- package/dist/models/IneligibleForEvaluationModel.d.ts +8 -0
- package/dist/models/IneligibleForEvaluationModel.js +44 -0
- package/dist/models/MissionTravelClassConfigModel.d.ts +10 -0
- package/dist/models/MissionTravelClassConfigModel.js +50 -0
- package/dist/models/MissionTravelPerdiemModel.d.ts +10 -0
- package/dist/models/MissionTravelPerdiemModel.js +54 -0
- package/dist/models/SlaApprovalsViewModel.js +47 -47
- package/dist/models/SlaMyRequestsViewModel.js +52 -52
- package/dist/models/SlaRequestModel.d.ts +4 -2
- package/dist/models/SlaRequestModel.js +4 -2
- package/dist/models/UuidAuditModel.d.ts +9 -0
- package/dist/models/UuidAuditModel.js +41 -0
- package/package.json +1 -1
- package/scripts/check-column-types.js +38 -38
- package/scripts/check-service-tables.js +42 -42
- package/scripts/sync-sla-reports-sql.js +95 -95
- package/sql/sla-reports-sync.manifest.json +8 -7
- package/sql/sla_reports_admin_procedures.sql +283 -283
- package/sql/sla_reports_approvals_workbook.sql +383 -383
- package/sql/sla_reports_procedures.sql +874 -874
- package/sql/sla_requests_status_to_varchar.sql +28 -0
- package/sql/vw_sla_approvals.sql +108 -108
- package/sql/vw_sla_my_requests.sql +55 -55
- package/src/data-source.ts +686 -686
- package/src/helpers/employee-evaluation-request.utils.ts +178 -178
- package/src/helpers/evaluation-eligibility.utils.ts +126 -126
- package/src/index.ts +617 -617
- package/src/models/DiplomaticAcademyRequestModel.ts +80 -80
- package/src/models/DocumentationFileModel.ts +40 -40
- package/src/models/EmbassyEvaluationCycleModel.ts +45 -45
- package/src/models/EmbassyEvaluationRequestModel.ts +59 -59
- package/src/models/EmployeeEvaluationAnswerModel.ts +26 -26
- package/src/models/EvaluationEligibilitySettingModel.ts +51 -51
- package/src/models/EvaluationFormModel.ts +44 -44
- package/src/models/LMSExternalEntityTrainedPersonModel.ts +45 -45
- package/src/models/LanguageCourseRequestModel.ts +67 -67
- package/src/models/LeaveApprovalsModel.ts +66 -66
- package/src/models/LeaveConfigModel.ts +71 -71
- package/src/models/MissionTravelApprovalModel.ts +101 -101
- package/src/models/MissionTravelAttachmentModel.ts +56 -56
- package/src/models/MissionTravelChatModel.ts +52 -52
- package/src/models/MissionTravelPersonModel.ts +105 -105
- package/src/models/MissionTravelWorkflowModel.ts +54 -54
- package/src/models/ProjectContactsModel.ts +51 -51
- package/src/models/ProjectFaqModel.ts +36 -36
- package/src/models/ProjectInvoicesModel.ts +41 -41
- package/src/models/ProjectModel.ts +75 -75
- package/src/models/ProjectTasksModel.ts +75 -75
- package/src/models/ServiceSlaApprovalModel.ts +63 -63
- package/src/models/ServicesNotificationConfigsModel.ts +55 -55
- package/src/models/SlaApprovalsViewModel.ts +135 -135
- package/src/models/SlaMyRequestsViewModel.ts +172 -172
- package/src/models/SlaRequestModel.ts +57 -55
- package/src/sla-report-views.ts +3 -3
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Applies SLA report views + stored procedures to PostgreSQL (idempotent CREATE OR REPLACE).
|
|
3
|
-
*
|
|
4
|
-
* Env (shared_models/.env or Reports_Service/.env):
|
|
5
|
-
* DB_HOST / TYPEORM_HOST
|
|
6
|
-
* DB_PORT / TYPEORM_PORT
|
|
7
|
-
* DB_USER / TYPEORM_USERNAME
|
|
8
|
-
* DB_PASS / TYPEORM_PASSWORD
|
|
9
|
-
* DB_NAME / TYPEORM_DATABASE
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* node scripts/sync-sla-reports-sql.js
|
|
13
|
-
* npm run sync:sla-sql (from shared_models)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const fs = require('fs');
|
|
17
|
-
const path = require('path');
|
|
18
|
-
const { Client } = require('pg');
|
|
19
|
-
|
|
20
|
-
function loadEnvFiles() {
|
|
21
|
-
const dotenv = require('dotenv');
|
|
22
|
-
const sharedRoot = path.resolve(__dirname, '..');
|
|
23
|
-
const reportsEnv = path.resolve(sharedRoot, '..', 'Reports_Service', '.env');
|
|
24
|
-
const sharedEnv = path.join(sharedRoot, '.env');
|
|
25
|
-
|
|
26
|
-
// Reports_Service defaults first; shared_models/.env wins (FM DB for sync:sla-sql).
|
|
27
|
-
if (fs.existsSync(reportsEnv)) {
|
|
28
|
-
dotenv.config({ path: reportsEnv });
|
|
29
|
-
}
|
|
30
|
-
if (fs.existsSync(sharedEnv)) {
|
|
31
|
-
dotenv.config({ path: sharedEnv, override: true });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getDbConfig() {
|
|
36
|
-
const host = (process.env.TYPEORM_HOST || process.env.DB_HOST || '').trim();
|
|
37
|
-
const port = parseInt(process.env.TYPEORM_PORT || process.env.DB_PORT || '5432', 10);
|
|
38
|
-
const user = (process.env.TYPEORM_USERNAME || process.env.DB_USER || '').trim();
|
|
39
|
-
const password = process.env.TYPEORM_PASSWORD || process.env.DB_PASS || '';
|
|
40
|
-
const database = (process.env.TYPEORM_DATABASE || process.env.DB_NAME || '').trim();
|
|
41
|
-
|
|
42
|
-
if (!host || !user || !database) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
'Missing DB config. Set TYPEORM_* in Reports_Service/.env or DB_* in shared_models/.env'
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return { host, port, user, password, database };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function main() {
|
|
52
|
-
const skipSync = process.argv.includes('--skip');
|
|
53
|
-
if (skipSync || process.env.SKIP_SLA_SQL_SYNC === 'true') {
|
|
54
|
-
console.log('[sync-sla-reports-sql] skipped (SKIP_SLA_SQL_SYNC or --skip)');
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
loadEnvFiles();
|
|
59
|
-
const config = getDbConfig();
|
|
60
|
-
const sqlDir = path.join(__dirname, '..', 'sql');
|
|
61
|
-
const manifestPath = path.join(sqlDir, 'sla-reports-sync.manifest.json');
|
|
62
|
-
|
|
63
|
-
if (!fs.existsSync(manifestPath)) {
|
|
64
|
-
throw new Error(`Manifest not found: ${manifestPath}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const files = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
68
|
-
if (!Array.isArray(files) || files.length === 0) {
|
|
69
|
-
throw new Error('sla-reports-sync.manifest.json must be a non-empty array');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const client = new Client(config);
|
|
73
|
-
await client.connect();
|
|
74
|
-
console.log(`[sync-sla-reports-sql] connected to ${config.host}/${config.database}`);
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
for (const file of files) {
|
|
78
|
-
const filePath = path.join(sqlDir, file);
|
|
79
|
-
if (!fs.existsSync(filePath)) {
|
|
80
|
-
throw new Error(`SQL file missing: ${filePath}`);
|
|
81
|
-
}
|
|
82
|
-
const sql = fs.readFileSync(filePath, 'utf8');
|
|
83
|
-
await client.query(sql);
|
|
84
|
-
console.log(`[sync-sla-reports-sql] applied ${file}`);
|
|
85
|
-
}
|
|
86
|
-
console.log('[sync-sla-reports-sql] done');
|
|
87
|
-
} finally {
|
|
88
|
-
await client.end();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
main().catch((err) => {
|
|
93
|
-
console.error('[sync-sla-reports-sql] failed:', err.message);
|
|
94
|
-
process.exit(1);
|
|
95
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* Applies SLA report views + stored procedures to PostgreSQL (idempotent CREATE OR REPLACE).
|
|
3
|
+
*
|
|
4
|
+
* Env (shared_models/.env or Reports_Service/.env):
|
|
5
|
+
* DB_HOST / TYPEORM_HOST
|
|
6
|
+
* DB_PORT / TYPEORM_PORT
|
|
7
|
+
* DB_USER / TYPEORM_USERNAME
|
|
8
|
+
* DB_PASS / TYPEORM_PASSWORD
|
|
9
|
+
* DB_NAME / TYPEORM_DATABASE
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* node scripts/sync-sla-reports-sql.js
|
|
13
|
+
* npm run sync:sla-sql (from shared_models)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const { Client } = require('pg');
|
|
19
|
+
|
|
20
|
+
function loadEnvFiles() {
|
|
21
|
+
const dotenv = require('dotenv');
|
|
22
|
+
const sharedRoot = path.resolve(__dirname, '..');
|
|
23
|
+
const reportsEnv = path.resolve(sharedRoot, '..', 'Reports_Service', '.env');
|
|
24
|
+
const sharedEnv = path.join(sharedRoot, '.env');
|
|
25
|
+
|
|
26
|
+
// Reports_Service defaults first; shared_models/.env wins (FM DB for sync:sla-sql).
|
|
27
|
+
if (fs.existsSync(reportsEnv)) {
|
|
28
|
+
dotenv.config({ path: reportsEnv });
|
|
29
|
+
}
|
|
30
|
+
if (fs.existsSync(sharedEnv)) {
|
|
31
|
+
dotenv.config({ path: sharedEnv, override: true });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getDbConfig() {
|
|
36
|
+
const host = (process.env.TYPEORM_HOST || process.env.DB_HOST || '').trim();
|
|
37
|
+
const port = parseInt(process.env.TYPEORM_PORT || process.env.DB_PORT || '5432', 10);
|
|
38
|
+
const user = (process.env.TYPEORM_USERNAME || process.env.DB_USER || '').trim();
|
|
39
|
+
const password = process.env.TYPEORM_PASSWORD || process.env.DB_PASS || '';
|
|
40
|
+
const database = (process.env.TYPEORM_DATABASE || process.env.DB_NAME || '').trim();
|
|
41
|
+
|
|
42
|
+
if (!host || !user || !database) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
'Missing DB config. Set TYPEORM_* in Reports_Service/.env or DB_* in shared_models/.env'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { host, port, user, password, database };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function main() {
|
|
52
|
+
const skipSync = process.argv.includes('--skip');
|
|
53
|
+
if (skipSync || process.env.SKIP_SLA_SQL_SYNC === 'true') {
|
|
54
|
+
console.log('[sync-sla-reports-sql] skipped (SKIP_SLA_SQL_SYNC or --skip)');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
loadEnvFiles();
|
|
59
|
+
const config = getDbConfig();
|
|
60
|
+
const sqlDir = path.join(__dirname, '..', 'sql');
|
|
61
|
+
const manifestPath = path.join(sqlDir, 'sla-reports-sync.manifest.json');
|
|
62
|
+
|
|
63
|
+
if (!fs.existsSync(manifestPath)) {
|
|
64
|
+
throw new Error(`Manifest not found: ${manifestPath}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const files = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
68
|
+
if (!Array.isArray(files) || files.length === 0) {
|
|
69
|
+
throw new Error('sla-reports-sync.manifest.json must be a non-empty array');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const client = new Client(config);
|
|
73
|
+
await client.connect();
|
|
74
|
+
console.log(`[sync-sla-reports-sql] connected to ${config.host}/${config.database}`);
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
for (const file of files) {
|
|
78
|
+
const filePath = path.join(sqlDir, file);
|
|
79
|
+
if (!fs.existsSync(filePath)) {
|
|
80
|
+
throw new Error(`SQL file missing: ${filePath}`);
|
|
81
|
+
}
|
|
82
|
+
const sql = fs.readFileSync(filePath, 'utf8');
|
|
83
|
+
await client.query(sql);
|
|
84
|
+
console.log(`[sync-sla-reports-sql] applied ${file}`);
|
|
85
|
+
}
|
|
86
|
+
console.log('[sync-sla-reports-sql] done');
|
|
87
|
+
} finally {
|
|
88
|
+
await client.end();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main().catch((err) => {
|
|
93
|
+
console.error('[sync-sla-reports-sql] failed:', err.message);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
[
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
1
|
+
[
|
|
2
|
+
"sla_requests_status_to_varchar.sql",
|
|
3
|
+
"vw_sla_my_requests.sql",
|
|
4
|
+
"vw_sla_approvals.sql",
|
|
5
|
+
"sla_reports_procedures.sql",
|
|
6
|
+
"sla_reports_approvals_workbook.sql",
|
|
7
|
+
"sla_reports_admin_procedures.sql"
|
|
8
|
+
]
|