scheduler-services 1.3.6
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/buildInitial.d.ts +7 -0
- package/buildInitial.js +190 -0
- package/buildInitial.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.js +22 -0
- package/index.js.map +1 -0
- package/logPosting.d.ts +1 -0
- package/logPosting.js +19 -0
- package/logPosting.js.map +1 -0
- package/logging.d.ts +9 -0
- package/logging.js +44 -0
- package/logging.js.map +1 -0
- package/mongoconnect.d.ts +12 -0
- package/mongoconnect.js +65 -0
- package/mongoconnect.js.map +1 -0
- package/package.json +33 -0
- package/sqldb.d.ts +5 -0
- package/sqldb.js +18 -0
- package/sqldb.js.map +1 -0
package/buildInitial.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildInitial = void 0;
|
|
4
|
+
const mongodb_1 = require("mongodb");
|
|
5
|
+
const mongoconnect_1 = require("./mongoconnect");
|
|
6
|
+
const employees_1 = require("scheduler-models/scheduler/employees");
|
|
7
|
+
const users_1 = require("scheduler-models/users");
|
|
8
|
+
const teams_1 = require("scheduler-models/scheduler/teams");
|
|
9
|
+
const sqldb_1 = require("./sqldb");
|
|
10
|
+
const sites_1 = require("scheduler-models/scheduler/sites");
|
|
11
|
+
class BuildInitial {
|
|
12
|
+
employeeID;
|
|
13
|
+
initialData;
|
|
14
|
+
constructor(empID) {
|
|
15
|
+
this.employeeID = (empID) ? empID : '';
|
|
16
|
+
this.initialData = {};
|
|
17
|
+
}
|
|
18
|
+
async build() {
|
|
19
|
+
let conn;
|
|
20
|
+
try {
|
|
21
|
+
if (this.employeeID === '') {
|
|
22
|
+
throw new Error("Employee not assigned");
|
|
23
|
+
}
|
|
24
|
+
if (mongoconnect_1.collections.employees) {
|
|
25
|
+
const query = { _id: new mongodb_1.ObjectId(this.employeeID) };
|
|
26
|
+
const iEmp = await mongoconnect_1.collections.employees.findOne(query);
|
|
27
|
+
if (iEmp) {
|
|
28
|
+
this.initialData.employee = new employees_1.Employee(iEmp);
|
|
29
|
+
if (mongoconnect_1.collections.users) {
|
|
30
|
+
const iUser = await mongoconnect_1.collections.users.findOne(query);
|
|
31
|
+
if (iUser) {
|
|
32
|
+
this.initialData.employee.user = new users_1.User(iUser);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new Error('User not found');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
throw new Error('User collection unavailable');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new Error('Employee not found');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
throw new Error('Employee collection unavailable');
|
|
48
|
+
}
|
|
49
|
+
const now = new Date();
|
|
50
|
+
const start = new Date(Date.UTC(now.getFullYear() - 1, 0, 1));
|
|
51
|
+
const end = new Date(Date.UTC(now.getFullYear() + 1, 0, 1));
|
|
52
|
+
if (this.initialData.employee) {
|
|
53
|
+
if (mongoconnect_1.collections.teams) {
|
|
54
|
+
const query = { _id: new mongodb_1.ObjectId(this.initialData.employee.team) };
|
|
55
|
+
const iTeam = await mongoconnect_1.collections.teams.findOne(query);
|
|
56
|
+
if (iTeam) {
|
|
57
|
+
this.initialData.team = new teams_1.Team(iTeam);
|
|
58
|
+
const employeeIDList = [];
|
|
59
|
+
const empTeamQuery = { team: new mongodb_1.ObjectId(this.initialData.employee.team) };
|
|
60
|
+
if (mongoconnect_1.collections.employees) {
|
|
61
|
+
const empCursor = mongoconnect_1.collections.employees.find(empTeamQuery);
|
|
62
|
+
const empArray = await empCursor.toArray();
|
|
63
|
+
const empPromises = empArray.map(async (iEmp) => {
|
|
64
|
+
const emp = new employees_1.Employee(iEmp);
|
|
65
|
+
if (emp.isActiveBetween(start, end)) {
|
|
66
|
+
this.initialData.team?.sites.forEach((site, s) => {
|
|
67
|
+
if (site.id.toLowerCase() === emp.site.toLowerCase()) {
|
|
68
|
+
if (!site.employees) {
|
|
69
|
+
site.employees = [];
|
|
70
|
+
}
|
|
71
|
+
if (site.employees) {
|
|
72
|
+
site.employees.push(new employees_1.Employee(emp));
|
|
73
|
+
}
|
|
74
|
+
if (this.initialData.team) {
|
|
75
|
+
this.initialData.team.sites[s] = site;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
employeeIDList.push(emp.id);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
await Promise.allSettled(empPromises);
|
|
83
|
+
}
|
|
84
|
+
if (employeeIDList.length > 0) {
|
|
85
|
+
if (sqldb_1.mdbConnection.pool) {
|
|
86
|
+
conn = await sqldb_1.mdbConnection.pool.getConnection();
|
|
87
|
+
const sql = 'SELECT * FROM employeeWork WHERE employeeID IN (?) and '
|
|
88
|
+
+ "dateworked >= ? and dateworked < ? ORDER BY employeeID, dateworked, "
|
|
89
|
+
+ "chargenumber, extension, paycode;";
|
|
90
|
+
const listVals = [employeeIDList, start, end];
|
|
91
|
+
const results = await conn.query(sql, listVals);
|
|
92
|
+
const workPromises = results.map(async (row) => {
|
|
93
|
+
if (this.initialData.team) {
|
|
94
|
+
let found = false;
|
|
95
|
+
this.initialData.team.sites.forEach((site, s) => {
|
|
96
|
+
if (!found) {
|
|
97
|
+
if (site.employees) {
|
|
98
|
+
site.employees.forEach((emp, e) => {
|
|
99
|
+
if (!found) {
|
|
100
|
+
if (emp.id && emp.id === row.employeeID) {
|
|
101
|
+
found = true;
|
|
102
|
+
if (!emp.work) {
|
|
103
|
+
emp.work = [];
|
|
104
|
+
}
|
|
105
|
+
if (emp.work) {
|
|
106
|
+
emp.work.push(new employees_1.Work({
|
|
107
|
+
dateworked: new Date(row.dateworked),
|
|
108
|
+
chargenumber: row.chargenumber,
|
|
109
|
+
extension: row.extension,
|
|
110
|
+
paycode: Number(row.paycode),
|
|
111
|
+
modtime: (row.modtime === '1' || row.modtime === 1),
|
|
112
|
+
hours: Number(row.hours)
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
if (site.employees) {
|
|
116
|
+
site.employees[e] = emp;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
if (found && this.initialData.team) {
|
|
122
|
+
this.initialData.team.sites[s] = site;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
await Promise.allSettled(workPromises);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
throw new Error('Employee Team not found');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw new Error('Team collection unavailable');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
throw new Error('No initial employee to pull team');
|
|
143
|
+
}
|
|
144
|
+
if (this.initialData.team) {
|
|
145
|
+
let found = false;
|
|
146
|
+
this.initialData.team.sites.forEach(site => {
|
|
147
|
+
if (!found && this.initialData.employee) {
|
|
148
|
+
const tUser = new users_1.User(this.initialData.employee.user);
|
|
149
|
+
if (site.id.toLowerCase() === this.initialData.employee?.site.toLowerCase()) {
|
|
150
|
+
this.initialData.site = new sites_1.Site(site);
|
|
151
|
+
if (site.employees) {
|
|
152
|
+
site.employees.forEach(emp => {
|
|
153
|
+
if (!found && this.initialData.employee
|
|
154
|
+
&& emp.id === this.initialData.employee.id) {
|
|
155
|
+
this.initialData.employee = new employees_1.Employee(emp);
|
|
156
|
+
this.initialData.employee.user = tUser;
|
|
157
|
+
found = true;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (!this.initialData.questions) {
|
|
166
|
+
this.initialData.questions = [];
|
|
167
|
+
const sql = "SELECT * FROM questions ORDER BY id;";
|
|
168
|
+
const results = await conn?.query(sql);
|
|
169
|
+
results.forEach((row) => {
|
|
170
|
+
if (this.initialData.questions) {
|
|
171
|
+
this.initialData.questions.push(new users_1.SecurityQuestion({
|
|
172
|
+
id: Number(row.id),
|
|
173
|
+
question: row.question
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
console.log(err);
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
if (conn)
|
|
184
|
+
conn.release();
|
|
185
|
+
}
|
|
186
|
+
return this.initialData;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.BuildInitial = BuildInitial;
|
|
190
|
+
//# sourceMappingURL=buildInitial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildInitial.js","sourceRoot":"","sources":["../src/buildInitial.ts"],"names":[],"mappings":";;;AACA,qCAAmC;AAEnC,iDAA6C;AAC7C,oEAAiF;AACjF,kDAAuE;AACvE,4DAA+D;AAC/D,mCAAwC;AACxC,4DAAwD;AAGxD,MAAa,YAAY;IACf,UAAU,CAAS;IACnB,WAAW,CAAkB;IAErC,YAAY,KAAc;QACxB,IAAI,CAAC,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,EAAG,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAgC,CAAC;QACrC,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,UAAU,KAAK,EAAE,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YAED,IAAI,0BAAW,CAAC,SAAS,EAAE,CAAC;gBAC1B,MAAM,KAAK,GAAG,EAAE,GA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1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./buildInitial"), exports);
|
|
18
|
+
__exportStar(require("./logging"), exports);
|
|
19
|
+
__exportStar(require("./logPosting"), exports);
|
|
20
|
+
__exportStar(require("./mongoconnect"), exports);
|
|
21
|
+
__exportStar(require("./sqldb"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,4CAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B;AAC/B,0CAAwB"}
|
package/logPosting.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function postMessage(application: string, message: string): void;
|
package/logPosting.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postMessage = postMessage;
|
|
4
|
+
function postMessage(application, message) {
|
|
5
|
+
const postData = {
|
|
6
|
+
application: application,
|
|
7
|
+
message: message
|
|
8
|
+
};
|
|
9
|
+
if (process.env.logurl) {
|
|
10
|
+
fetch(process.env.logurl, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': 'application/json'
|
|
14
|
+
},
|
|
15
|
+
body: JSON.stringify(postData)
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=logPosting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logPosting.js","sourceRoot":"","sources":["../src/logPosting.ts"],"names":[],"mappings":";;AAAA,kCAeC;AAfD,SAAgB,WAAW,CAAC,WAAmB,EAAE,OAAe;IAC9D,MAAM,QAAQ,GAAG;QACf,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,OAAO;KACjB,CAAC;IAEF,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;YACxB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/logging.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LogEntry, Logger } from 'scheduler-models/general';
|
|
2
|
+
export declare const logConnection: {
|
|
3
|
+
log?: Logger;
|
|
4
|
+
employeeLog?: Logger;
|
|
5
|
+
siteLog?: Logger;
|
|
6
|
+
teamLog?: Logger;
|
|
7
|
+
};
|
|
8
|
+
export declare function createLogs(application: string): Promise<void>;
|
|
9
|
+
export declare function postLogEntry(application: string, message: string): Promise<LogEntry>;
|
package/logging.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logConnection = void 0;
|
|
4
|
+
exports.createLogs = createLogs;
|
|
5
|
+
exports.postLogEntry = postLogEntry;
|
|
6
|
+
const general_1 = require("scheduler-models/general");
|
|
7
|
+
const sqldb_1 = require("./sqldb");
|
|
8
|
+
exports.logConnection = {};
|
|
9
|
+
async function createLogs(application) {
|
|
10
|
+
exports.logConnection.log = new general_1.Logger(`${process.env.LOG_DIR}/${application}/process_${(new Date().toDateString())}.log`);
|
|
11
|
+
exports.logConnection.employeeLog = new general_1.Logger(`${process.env.LOG_DIR}/${application}/employee_${(new Date().toDateString())}.log`);
|
|
12
|
+
exports.logConnection.siteLog = new general_1.Logger(`${process.env.LOG_DIR}/${application}/site_${(new Date().toDateString())}.log`);
|
|
13
|
+
exports.logConnection.teamLog = new general_1.Logger(`${process.env.LOG_DIR}/${application}/team_${(new Date().toDateString())}.log`);
|
|
14
|
+
}
|
|
15
|
+
async function postLogEntry(application, message) {
|
|
16
|
+
let conn;
|
|
17
|
+
let logEntry = new general_1.LogEntry();
|
|
18
|
+
try {
|
|
19
|
+
if (sqldb_1.mdbConnection.pool) {
|
|
20
|
+
conn = await sqldb_1.mdbConnection.pool.getConnection();
|
|
21
|
+
const entryDate = new Date();
|
|
22
|
+
const insert = `INSERT INTO logentries VALUES ( ?, ?, ?)`;
|
|
23
|
+
const values = [entryDate, application, message];
|
|
24
|
+
const query = `SELECT * FROM logentries ORDER BY application, messageid;`;
|
|
25
|
+
await conn.query(insert, values);
|
|
26
|
+
logEntry = new general_1.LogEntry({
|
|
27
|
+
date: entryDate,
|
|
28
|
+
entry: message
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
throw new Error('No database connection');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
if (conn)
|
|
40
|
+
conn.release();
|
|
41
|
+
}
|
|
42
|
+
return logEntry;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=logging.js.map
|
package/logging.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;;AAUA,gCASC;AAED,oCA4BC;AAjDD,sDAA4D;AAC5D,mCAAwC;AAE3B,QAAA,aAAa,GAKtB,EAAE,CAAA;AAEC,KAAK,UAAU,UAAU,CAAC,WAAmB;IAClD,qBAAa,CAAC,GAAG,GAAG,IAAI,gBAAM,CAC9B,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,WAAW,YAAY,CAAC,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC;IACpF,qBAAa,CAAC,WAAW,GAAG,IAAI,gBAAM,CACtC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,WAAW,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC;IACrF,qBAAa,CAAC,OAAO,GAAG,IAAI,gBAAM,CAClC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,WAAW,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC;IACjF,qBAAa,CAAC,OAAO,GAAG,IAAI,gBAAM,CAClC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,WAAW,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC;AACnF,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,WAAmB,EAAE,OAAe;IACrE,IAAI,IAAI,CAAC;IACT,IAAI,QAAQ,GAAG,IAAI,kBAAQ,EAAE,CAAC;IAC9B,IAAI,CAAC;QACH,IAAI,qBAAa,CAAC,IAAI,EAAE,CAAC;YAEvB,IAAI,GAAG,MAAM,qBAAa,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAChD,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;YAG7B,MAAM,MAAM,GAAG,0CAA0C,CAAC;YAC1D,MAAM,MAAM,GAAG,CAAE,SAAS,EAAE,WAAW,EAAE,OAAO,CAAE,CAAC;YACnD,MAAM,KAAK,GAAG,2DAA2D,CAAC;YAC1E,MAAM,IAAI,CAAC,KAAK,CAAQ,MAAM,EAAE,MAAM,CAAC,CAAC;YAExC,QAAQ,GAAG,IAAI,kBAAQ,CAAC;gBACtB,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,OAAO;aACf,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,CAAC;IACZ,CAAC;YAAS,CAAC;QACT,IAAI,IAAI;YAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Collection } from 'mongodb';
|
|
2
|
+
export declare const collections: {
|
|
3
|
+
users?: Collection;
|
|
4
|
+
employees?: Collection;
|
|
5
|
+
work?: Collection;
|
|
6
|
+
notifications?: Collection;
|
|
7
|
+
teams?: Collection;
|
|
8
|
+
help?: Collection;
|
|
9
|
+
missions?: Collection;
|
|
10
|
+
outages?: Collection;
|
|
11
|
+
};
|
|
12
|
+
export declare function connectToDB(): Promise<void>;
|
package/mongoconnect.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collections = void 0;
|
|
4
|
+
exports.connectToDB = connectToDB;
|
|
5
|
+
const mongodb_1 = require("mongodb");
|
|
6
|
+
exports.collections = {};
|
|
7
|
+
async function connectToDB() {
|
|
8
|
+
const uri = `mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@`
|
|
9
|
+
+ `${process.env.MONGO_SERVER}:${process.env.MONGO_PORT}?`
|
|
10
|
+
+ `${process.env.MONGO_APPEND}`;
|
|
11
|
+
if (uri) {
|
|
12
|
+
try {
|
|
13
|
+
const client = new mongodb_1.MongoClient(uri);
|
|
14
|
+
await client.connect();
|
|
15
|
+
console.log('Connected to database');
|
|
16
|
+
const db = client.db('scheduler');
|
|
17
|
+
let users = client.db('authenticate').collection("users");
|
|
18
|
+
if (!users) {
|
|
19
|
+
users = await db.createCollection("users");
|
|
20
|
+
}
|
|
21
|
+
exports.collections.users = users;
|
|
22
|
+
let employees = db.collection("employees");
|
|
23
|
+
if (!employees) {
|
|
24
|
+
employees = await db.createCollection("employees");
|
|
25
|
+
}
|
|
26
|
+
exports.collections.employees = employees;
|
|
27
|
+
let work = db.collection('employeework');
|
|
28
|
+
if (!work) {
|
|
29
|
+
work = await db.createCollection("employeework");
|
|
30
|
+
}
|
|
31
|
+
exports.collections.work = work;
|
|
32
|
+
let notifications = db.collection("notifications");
|
|
33
|
+
if (!notifications) {
|
|
34
|
+
notifications = await db.createCollection("notifications");
|
|
35
|
+
}
|
|
36
|
+
exports.collections.notifications = notifications;
|
|
37
|
+
let teams = await db.collection('teams');
|
|
38
|
+
if (!teams) {
|
|
39
|
+
teams = await db.createCollection('teams');
|
|
40
|
+
}
|
|
41
|
+
exports.collections.teams = teams;
|
|
42
|
+
let help = await db.collection('help');
|
|
43
|
+
if (!help) {
|
|
44
|
+
help = await db.createCollection('help');
|
|
45
|
+
}
|
|
46
|
+
exports.collections.help = help;
|
|
47
|
+
const metricsDB = client.db('metrics2');
|
|
48
|
+
let missions = metricsDB.collection('missions');
|
|
49
|
+
if (!missions) {
|
|
50
|
+
missions = await db.createCollection('missions');
|
|
51
|
+
}
|
|
52
|
+
exports.collections.missions = missions;
|
|
53
|
+
let outages = metricsDB.collection('outages');
|
|
54
|
+
if (!outages) {
|
|
55
|
+
outages = await metricsDB.createCollection('outages');
|
|
56
|
+
}
|
|
57
|
+
exports.collections.outages = outages;
|
|
58
|
+
console.log('Successfully connected to collections');
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.log(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=mongoconnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongoconnect.js","sourceRoot":"","sources":["../src/mongoconnect.ts"],"names":[],"mappings":";;;AAaA,kCA2DC;AAxED,qCAAsD;AAEzC,QAAA,WAAW,GASpB,EAAE,CAAA;AAEC,KAAK,UAAU,WAAW;IAC/B,MAAM,GAAG,GAAG,aAAa,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG;UAC5E,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG;UACxD,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;IAClC,IAAI,GAAG,EAAE,CAAC;QACR,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,qBAAW,CAAC,GAAG,CAAC,CAAC;YACpC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YAErC,MAAM,EAAE,GAAO,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;YACtC,IAAI,KAAK,GAAe,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACtE,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,KAAK,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC7C,CAAC;YACD,mBAAW,CAAC,KAAK,GAAG,KAAK,CAAC;Y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,GAAe,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YAC5D,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,QAAQ,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACnD,CAAC;YACD,mBAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAChC,IAAI,OAAO,GAAe,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,GAAG,MAAM,SAAS,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACxD,CAAC;YACD,mBAAW,CAAC,OAAO,GAAG,OAAO,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "scheduler-services",
|
|
3
|
+
"version": "1.3.6",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"/"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"description": "",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/adm-zip": "^0.5.7",
|
|
19
|
+
"@types/express": "^5.0.6",
|
|
20
|
+
"@types/multer": "^2.0.0",
|
|
21
|
+
"@types/nodemailer": "^7.0.0",
|
|
22
|
+
"typescript": "^5.9.2"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"adm-zip": "^0.5.16",
|
|
26
|
+
"bcrypt-ts": "^7.1.0",
|
|
27
|
+
"exceljs": "^4.4.0",
|
|
28
|
+
"express": "^5.2.1",
|
|
29
|
+
"multer": "^2.0.2",
|
|
30
|
+
"nodemailer": "^7.0.5",
|
|
31
|
+
"uuid": "^13.0.0"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/sqldb.d.ts
ADDED
package/sqldb.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mdbConnection = void 0;
|
|
4
|
+
exports.createPool = createPool;
|
|
5
|
+
const mariadb = require("mariadb");
|
|
6
|
+
exports.mdbConnection = {};
|
|
7
|
+
async function createPool() {
|
|
8
|
+
exports.mdbConnection.pool = await mariadb.createPool({
|
|
9
|
+
host: process.env.MYSQL_SERVER,
|
|
10
|
+
port: (process.env.MYSQL_PORT) ? Number(process.env.MYSQL_PORT) : 3306,
|
|
11
|
+
user: process.env.MYSQL_USER,
|
|
12
|
+
password: process.env.MYSQL_PASSWORD,
|
|
13
|
+
database: 'scheduler',
|
|
14
|
+
connectionLimit: 5
|
|
15
|
+
});
|
|
16
|
+
console.log('Connected to mariadb');
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=sqldb.js.map
|
package/sqldb.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqldb.js","sourceRoot":"","sources":["../src/sqldb.ts"],"names":[],"mappings":";;;AAMA,gCAUC;AAhBD,mCAAmC;AAEtB,QAAA,aAAa,GAEtB,EAAE,CAAC;AAEA,KAAK,UAAU,UAAU;IAC9B,qBAAa,CAAC,IAAI,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;QAC5C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QAC9B,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;QACtE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QACpC,QAAQ,EAAE,WAAW;QACrB,eAAe,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACtC,CAAC"}
|