scheduler-node-models 1.0.78 → 1.0.81

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.
Files changed (144) hide show
  1. package/package.json +22 -4
  2. package/general/emailer.d.ts +0 -1
  3. package/general/emailer.js +0 -31
  4. package/general/general.d.ts +0 -12
  5. package/general/general.js +0 -2
  6. package/general/index.d.ts +0 -4
  7. package/general/index.js +0 -20
  8. package/general/report.d.ts +0 -12
  9. package/general/report.js +0 -70
  10. package/general/reportStyle.d.ts +0 -0
  11. package/general/reportStyle.js +0 -1
  12. package/general/viewstate.d.ts +0 -5
  13. package/general/viewstate.js +0 -9
  14. package/index.d.ts +0 -0
  15. package/metrics/images.d.ts +0 -22
  16. package/metrics/images.js +0 -33
  17. package/metrics/index.d.ts +0 -5
  18. package/metrics/index.js +0 -21
  19. package/metrics/mission.d.ts +0 -47
  20. package/metrics/mission.js +0 -81
  21. package/metrics/missionSensorOutage.d.ts +0 -11
  22. package/metrics/missionSensorOutage.js +0 -14
  23. package/metrics/missionsensor.d.ts +0 -67
  24. package/metrics/missionsensor.js +0 -128
  25. package/metrics/outage.d.ts +0 -43
  26. package/metrics/outage.js +0 -55
  27. package/metrics/reports/drawSummary.d.ts +0 -24
  28. package/metrics/reports/drawSummary.js +0 -311
  29. package/metrics/reports/index.d.ts +0 -5
  30. package/metrics/reports/index.js +0 -21
  31. package/metrics/reports/missionDay.d.ts +0 -8
  32. package/metrics/reports/missionDay.js +0 -23
  33. package/metrics/reports/missionSummary.d.ts +0 -25
  34. package/metrics/reports/missionSummary.js +0 -421
  35. package/metrics/reports/missionType.d.ts +0 -20
  36. package/metrics/reports/missionType.js +0 -314
  37. package/metrics/reports/outageDay.d.ts +0 -8
  38. package/metrics/reports/outageDay.js +0 -23
  39. package/metrics/systemdata/classifications.d.ts +0 -18
  40. package/metrics/systemdata/classifications.js +0 -23
  41. package/metrics/systemdata/communications.d.ts +0 -21
  42. package/metrics/systemdata/communications.js +0 -40
  43. package/metrics/systemdata/dcgs.d.ts +0 -19
  44. package/metrics/systemdata/dcgs.js +0 -29
  45. package/metrics/systemdata/exploitations.d.ts +0 -18
  46. package/metrics/systemdata/exploitations.js +0 -23
  47. package/metrics/systemdata/groundSystems.d.ts +0 -86
  48. package/metrics/systemdata/groundSystems.js +0 -143
  49. package/metrics/systemdata/index.d.ts +0 -7
  50. package/metrics/systemdata/index.js +0 -23
  51. package/metrics/systemdata/platform.d.ts +0 -124
  52. package/metrics/systemdata/platform.js +0 -176
  53. package/metrics/systemdata/systeminfo.d.ts +0 -28
  54. package/metrics/systemdata/systeminfo.js +0 -64
  55. package/scheduler/employees/assignment.d.ts +0 -139
  56. package/scheduler/employees/assignment.js +0 -304
  57. package/scheduler/employees/balance.d.ts +0 -35
  58. package/scheduler/employees/balance.js +0 -39
  59. package/scheduler/employees/companyinfo.d.ts +0 -16
  60. package/scheduler/employees/companyinfo.js +0 -6
  61. package/scheduler/employees/contact.d.ts +0 -36
  62. package/scheduler/employees/contact.js +0 -40
  63. package/scheduler/employees/employee.d.ts +0 -420
  64. package/scheduler/employees/employee.js +0 -1862
  65. package/scheduler/employees/employeename.d.ts +0 -48
  66. package/scheduler/employees/employeename.js +0 -97
  67. package/scheduler/employees/index.d.ts +0 -14
  68. package/scheduler/employees/index.js +0 -30
  69. package/scheduler/employees/labor.d.ts +0 -31
  70. package/scheduler/employees/labor.js +0 -39
  71. package/scheduler/employees/leave.d.ts +0 -58
  72. package/scheduler/employees/leave.js +0 -73
  73. package/scheduler/employees/leaverequest.d.ts +0 -105
  74. package/scheduler/employees/leaverequest.js +0 -226
  75. package/scheduler/employees/specialty.d.ts +0 -35
  76. package/scheduler/employees/specialty.js +0 -40
  77. package/scheduler/employees/variation.d.ts +0 -80
  78. package/scheduler/employees/variation.js +0 -132
  79. package/scheduler/employees/web.d.ts +0 -6
  80. package/scheduler/employees/web.js +0 -2
  81. package/scheduler/employees/work.d.ts +0 -96
  82. package/scheduler/employees/work.js +0 -133
  83. package/scheduler/employees/workday.d.ts +0 -91
  84. package/scheduler/employees/workday.js +0 -170
  85. package/scheduler/labor/index.d.ts +0 -2
  86. package/scheduler/labor/index.js +0 -18
  87. package/scheduler/labor/laborcode.d.ts +0 -33
  88. package/scheduler/labor/laborcode.js +0 -55
  89. package/scheduler/labor/workcode.d.ts +0 -28
  90. package/scheduler/labor/workcode.js +0 -35
  91. package/scheduler/reports/chargeStatus.d.ts +0 -66
  92. package/scheduler/reports/chargeStatus.js +0 -702
  93. package/scheduler/reports/cofsReports.d.ts +0 -11
  94. package/scheduler/reports/cofsReports.js +0 -36
  95. package/scheduler/reports/enterpriseSchedule.d.ts +0 -18
  96. package/scheduler/reports/enterpriseSchedule.js +0 -159
  97. package/scheduler/reports/index.d.ts +0 -4
  98. package/scheduler/reports/index.js +0 -20
  99. package/scheduler/reports/scheduleReport.d.ts +0 -17
  100. package/scheduler/reports/scheduleReport.js +0 -311
  101. package/scheduler/sites/index.d.ts +0 -1
  102. package/scheduler/sites/index.js +0 -17
  103. package/scheduler/sites/reports/cofsReport.d.ts +0 -41
  104. package/scheduler/sites/reports/cofsReport.js +0 -104
  105. package/scheduler/sites/reports/forecast.d.ts +0 -57
  106. package/scheduler/sites/reports/forecast.js +0 -205
  107. package/scheduler/sites/reports/index.d.ts +0 -4
  108. package/scheduler/sites/reports/index.js +0 -20
  109. package/scheduler/sites/reports/period.d.ts +0 -11
  110. package/scheduler/sites/reports/period.js +0 -27
  111. package/scheduler/sites/reports/section.d.ts +0 -63
  112. package/scheduler/sites/reports/section.js +0 -174
  113. package/scheduler/sites/site.d.ts +0 -39
  114. package/scheduler/sites/site.js +0 -61
  115. package/scheduler/sites/workcenters/index.d.ts +0 -3
  116. package/scheduler/sites/workcenters/index.js +0 -19
  117. package/scheduler/sites/workcenters/position.d.ts +0 -27
  118. package/scheduler/sites/workcenters/position.js +0 -36
  119. package/scheduler/sites/workcenters/shift.d.ts +0 -32
  120. package/scheduler/sites/workcenters/shift.js +0 -47
  121. package/scheduler/sites/workcenters/workcenter.d.ts +0 -43
  122. package/scheduler/sites/workcenters/workcenter.js +0 -123
  123. package/scheduler/teams/company/company.d.ts +0 -99
  124. package/scheduler/teams/company/company.js +0 -256
  125. package/scheduler/teams/company/holiday.d.ts +0 -55
  126. package/scheduler/teams/company/holiday.js +0 -108
  127. package/scheduler/teams/company/index.d.ts +0 -3
  128. package/scheduler/teams/company/index.js +0 -19
  129. package/scheduler/teams/company/modperiod.d.ts +0 -21
  130. package/scheduler/teams/company/modperiod.js +0 -24
  131. package/scheduler/teams/contact.d.ts +0 -18
  132. package/scheduler/teams/contact.js +0 -23
  133. package/scheduler/teams/index.d.ts +0 -3
  134. package/scheduler/teams/index.js +0 -19
  135. package/scheduler/teams/specialty.d.ts +0 -18
  136. package/scheduler/teams/specialty.js +0 -23
  137. package/scheduler/teams/team.d.ts +0 -95
  138. package/scheduler/teams/team.js +0 -351
  139. package/users/index.d.ts +0 -2
  140. package/users/index.js +0 -18
  141. package/users/user.d.ts +0 -130
  142. package/users/user.js +0 -254
  143. package/users/web.d.ts +0 -22
  144. package/users/web.js +0 -2
@@ -1,95 +0,0 @@
1
- import { ObjectId } from "mongodb";
2
- import { IWorkcode, Workcode } from "../labor";
3
- import { ISite, Site } from "../sites";
4
- import { Company, ICompany } from "./company";
5
- import { Contact, IContact } from "./contact";
6
- import { ISpecialty, Specialty } from "./specialty";
7
- export interface ITeam {
8
- _id?: ObjectId;
9
- id?: string;
10
- name: string;
11
- workcodes: IWorkcode[];
12
- sites: ISite[];
13
- companies?: ICompany[];
14
- contacttypes?: IContact[];
15
- specialties?: ISpecialty[];
16
- }
17
- export declare class Team implements ITeam {
18
- id: string;
19
- name: string;
20
- workcodes: Workcode[];
21
- sites: Site[];
22
- companies: Company[];
23
- contacttypes: Contact[];
24
- specialties: Specialty[];
25
- constructor(team?: ITeam);
26
- /**
27
- * Workcode section (CRUD)
28
- */
29
- /**
30
- * This function will add a new work code to the team's work/leave code list.
31
- * @param id The string value for the use code and identifier for the work or leave
32
- * code.
33
- * @param title The string value for the short explanation of the code.
34
- * @param start The numeric value for the hour the work shift normally starts work.
35
- * @param shift The string value for any paycode designator
36
- * @param isLeave A boolean value to signify if the code is for leaves
37
- * @param text A string 6-character hexadecimal value for the color of text for this
38
- * code.
39
- * @param back A string 6-character hexadecimal value for the color of the background
40
- * for this code.
41
- * @param search (optional) A string value to search time records to recognize the code.
42
- */
43
- addWorkcode(id: string, title: string, start: number, shift: string, isLeave: boolean, text: string, back: string, search?: string): void;
44
- /**
45
- * This function is used to update a single work/leave code, based on the identifier,
46
- * a field designator and value for that field.
47
- * @param id The string value for the identifier of the code to change
48
- * @param field The string value to identify the field/data member to update
49
- * @param value The string value for the new value.
50
- */
51
- updateWorkcode(id: string, field: string, value: string): void;
52
- /**
53
- * This function will delete
54
- * @param id The string value for the identifier of the work/leave code to delete
55
- */
56
- deleteWorkcode(id: string): void;
57
- /**
58
- * Contact Types section
59
- */
60
- /**
61
- * This function will add a new contact type, after checking to ensure the contact type
62
- * name isn't already listed
63
- * @param name The string value for the new contact type.
64
- */
65
- addContactType(name: string): void;
66
- /**
67
- * This function will be used to update a contact type within the list
68
- * @param id The numeric identifer for the contact type.
69
- * @param field The string value to identify the data member to update
70
- * @param value The string value for the modification.
71
- */
72
- updateContactType(id: number, field: string, value: string): void;
73
- /**
74
- * This function will remove a designated contact type by identifier from the list.
75
- * @param id The numeric identifier to the designated contact type.
76
- */
77
- deleteContactType(id: number): void;
78
- /**
79
- * This function will add a new specialty type, if the name isn't already in the list.
80
- * @param name The string value for the new specialty name.
81
- */
82
- addSpecialtyType(name: string): void;
83
- /**
84
- * This function will update a specialty type within the list
85
- * @param id The numeric value for the identifier for the contact type to update
86
- * @param field The string value for the field/data member to update
87
- * @param value The string value for the new value.
88
- */
89
- updateSpecialtyType(id: number, field: string, value: string): void;
90
- /**
91
- * This function will remove a specialty type from the list.
92
- * @param id The numeric value for the identifier to remove.
93
- */
94
- deleteSpecialtyType(id: number): void;
95
- }
@@ -1,351 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Team = void 0;
4
- const labor_1 = require("../labor");
5
- const sites_1 = require("../sites");
6
- const company_1 = require("./company");
7
- const contact_1 = require("./contact");
8
- const specialty_1 = require("./specialty");
9
- class Team {
10
- id;
11
- name;
12
- workcodes;
13
- sites;
14
- companies;
15
- contacttypes;
16
- specialties;
17
- constructor(team) {
18
- this.id = (team && team.id) ? team.id : '';
19
- if (this.id === '') {
20
- this.id = (team && team._id) ? team._id.toString() : '';
21
- }
22
- this.name = (team) ? team.name : '';
23
- this.workcodes = [];
24
- if (team && team.workcodes.length > 0) {
25
- team.workcodes.forEach(wc => {
26
- this.workcodes.push(new labor_1.Workcode(wc));
27
- });
28
- this.workcodes.sort((a, b) => a.compareTo(b));
29
- }
30
- this.sites = [];
31
- if (team && team.sites.length > 0) {
32
- team.sites.forEach(site => {
33
- this.sites.push(new sites_1.Site(site));
34
- });
35
- this.sites.sort((a, b) => a.compareTo(b));
36
- }
37
- this.companies = [];
38
- if (team && team.companies && team.companies.length > 0) {
39
- team.companies.forEach(co => {
40
- this.companies.push(new company_1.Company(co));
41
- });
42
- this.companies.sort((a, b) => a.compareTo(b));
43
- }
44
- this.contacttypes = [];
45
- if (team && team.contacttypes && team.contacttypes.length > 0) {
46
- team.contacttypes.forEach(ct => {
47
- this.contacttypes.push(new contact_1.Contact(ct));
48
- });
49
- this.contacttypes.sort((a, b) => a.compareTo(b));
50
- }
51
- this.specialties = [];
52
- if (team && team.specialties && team.specialties.length > 0) {
53
- team.specialties.forEach(sp => {
54
- this.specialties.push(new specialty_1.Specialty(sp));
55
- });
56
- this.specialties.sort((a, b) => a.compareTo(b));
57
- }
58
- }
59
- /**
60
- * Workcode section (CRUD)
61
- */
62
- /**
63
- * This function will add a new work code to the team's work/leave code list.
64
- * @param id The string value for the use code and identifier for the work or leave
65
- * code.
66
- * @param title The string value for the short explanation of the code.
67
- * @param start The numeric value for the hour the work shift normally starts work.
68
- * @param shift The string value for any paycode designator
69
- * @param isLeave A boolean value to signify if the code is for leaves
70
- * @param text A string 6-character hexadecimal value for the color of text for this
71
- * code.
72
- * @param back A string 6-character hexadecimal value for the color of the background
73
- * for this code.
74
- * @param search (optional) A string value to search time records to recognize the code.
75
- */
76
- addWorkcode(id, title, start, shift, isLeave, text, back, search) {
77
- if (id !== '') {
78
- let found = false;
79
- this.workcodes.forEach((wc, w) => {
80
- if (wc.id.toLowerCase() === id.toLowerCase()) {
81
- found = true;
82
- const code = new labor_1.Workcode({
83
- id: id,
84
- title: title,
85
- start: start,
86
- shiftCode: shift,
87
- isLeave: isLeave,
88
- textcolor: text,
89
- backcolor: back,
90
- search: search
91
- });
92
- this.workcodes[w] = code;
93
- }
94
- });
95
- if (!found) {
96
- const code = new labor_1.Workcode({
97
- id: id,
98
- title: title,
99
- start: start,
100
- shiftCode: shift,
101
- isLeave: isLeave,
102
- textcolor: text,
103
- backcolor: back,
104
- search: search
105
- });
106
- this.workcodes.push(code);
107
- }
108
- this.workcodes.sort((a, b) => a.compareTo(b));
109
- }
110
- }
111
- /**
112
- * This function is used to update a single work/leave code, based on the identifier,
113
- * a field designator and value for that field.
114
- * @param id The string value for the identifier of the code to change
115
- * @param field The string value to identify the field/data member to update
116
- * @param value The string value for the new value.
117
- */
118
- updateWorkcode(id, field, value) {
119
- this.workcodes.forEach((wc, w) => {
120
- if (wc.id.toLowerCase() === id.toLowerCase()) {
121
- switch (field.toLowerCase()) {
122
- case "id":
123
- wc.id = value;
124
- break;
125
- case "title":
126
- wc.title = value;
127
- break;
128
- case "start":
129
- case "starthour":
130
- wc.start = Number(value);
131
- break;
132
- case "shift":
133
- case "shiftcode":
134
- wc.shiftCode = value;
135
- break;
136
- case "isleave":
137
- case "leave":
138
- wc.isLeave = (value.toLowerCase() === 'true');
139
- break;
140
- case "textcolor":
141
- case "text":
142
- wc.textcolor = value.substring(0, 6);
143
- break;
144
- case "backcolor":
145
- case "back":
146
- case "background":
147
- wc.backcolor = value.substring(0, 6);
148
- break;
149
- case "search":
150
- if (value === '') {
151
- wc.search = undefined;
152
- }
153
- else {
154
- wc.search = value;
155
- }
156
- }
157
- this.workcodes[w] = wc;
158
- }
159
- });
160
- this.workcodes.sort((a, b) => a.compareTo(b));
161
- }
162
- /**
163
- * This function will delete
164
- * @param id The string value for the identifier of the work/leave code to delete
165
- */
166
- deleteWorkcode(id) {
167
- let found = -1;
168
- this.workcodes.forEach((wc, w) => {
169
- if (wc.id.toLowerCase() === id.toLowerCase()) {
170
- found = w;
171
- }
172
- });
173
- if (found >= 0) {
174
- this.workcodes.splice(found, 1);
175
- this.workcodes.sort((a, b) => a.compareTo(b));
176
- }
177
- }
178
- /**
179
- * Contact Types section
180
- */
181
- /**
182
- * This function will add a new contact type, after checking to ensure the contact type
183
- * name isn't already listed
184
- * @param name The string value for the new contact type.
185
- */
186
- addContactType(name) {
187
- let next = 0;
188
- let sort = -1;
189
- let found = false;
190
- this.contacttypes.forEach(ct => {
191
- if (ct.name.toLowerCase() === name.toLowerCase()) {
192
- found = true;
193
- }
194
- if (ct.id > next) {
195
- next = ct.id;
196
- }
197
- if (ct.sort > sort) {
198
- sort = ct.sort;
199
- }
200
- });
201
- if (!found) {
202
- this.contacttypes.push(new contact_1.Contact({
203
- id: next + 1,
204
- name: name,
205
- sort: sort + 1
206
- }));
207
- this.contacttypes.sort((a, b) => a.compareTo(b));
208
- }
209
- }
210
- /**
211
- * This function will be used to update a contact type within the list
212
- * @param id The numeric identifer for the contact type.
213
- * @param field The string value to identify the data member to update
214
- * @param value The string value for the modification.
215
- */
216
- updateContactType(id, field, value) {
217
- this.contacttypes.sort((a, b) => a.compareTo(b));
218
- this.contacttypes.forEach((ct, c) => {
219
- if (ct.id === id) {
220
- switch (field.toLowerCase()) {
221
- case "name":
222
- case "title":
223
- ct.name = value;
224
- break;
225
- case "move":
226
- case "sort":
227
- if (value.toLowerCase().substring(0, 2) === 'up') {
228
- if (c > 0) {
229
- const other = this.contacttypes[c - 1];
230
- const old = other.sort;
231
- other.sort = ct.sort;
232
- ct.sort = old;
233
- this.contacttypes[c - 1] = other;
234
- }
235
- }
236
- else {
237
- if (c < this.contacttypes.length - 1) {
238
- const other = this.contacttypes[c + 1];
239
- const old = other.sort;
240
- other.sort = ct.sort;
241
- ct.sort = old;
242
- this.contacttypes[c + 1] = other;
243
- }
244
- }
245
- break;
246
- }
247
- this.contacttypes[c] = ct;
248
- }
249
- });
250
- }
251
- /**
252
- * This function will remove a designated contact type by identifier from the list.
253
- * @param id The numeric identifier to the designated contact type.
254
- */
255
- deleteContactType(id) {
256
- let found = -1;
257
- this.contacttypes.forEach((ct, c) => {
258
- if (ct.id === id) {
259
- found = c;
260
- }
261
- });
262
- if (found >= 0) {
263
- this.contacttypes.splice(found, 1);
264
- }
265
- }
266
- /**
267
- * This function will add a new specialty type, if the name isn't already in the list.
268
- * @param name The string value for the new specialty name.
269
- */
270
- addSpecialtyType(name) {
271
- let next = 0;
272
- let sort = -1;
273
- let found = false;
274
- this.specialties.forEach(sp => {
275
- if (sp.name.toLowerCase() === name.toLowerCase()) {
276
- found = true;
277
- }
278
- if (sp.id > next) {
279
- next = sp.id;
280
- }
281
- if (sp.sort > sort) {
282
- sort = sp.sort;
283
- }
284
- });
285
- if (!found) {
286
- this.specialties.push(new specialty_1.Specialty({
287
- id: next + 1,
288
- name: name,
289
- sort: sort + 1
290
- }));
291
- this.specialties.sort((a, b) => a.compareTo(b));
292
- }
293
- }
294
- /**
295
- * This function will update a specialty type within the list
296
- * @param id The numeric value for the identifier for the contact type to update
297
- * @param field The string value for the field/data member to update
298
- * @param value The string value for the new value.
299
- */
300
- updateSpecialtyType(id, field, value) {
301
- this.specialties.sort((a, b) => a.compareTo(b));
302
- this.specialties.forEach((ct, c) => {
303
- if (ct.id === id) {
304
- switch (field.toLowerCase()) {
305
- case "name":
306
- case "title":
307
- ct.name = value;
308
- break;
309
- case "move":
310
- case "sort":
311
- if (value.toLowerCase().substring(0, 2) === 'up') {
312
- if (c > 0) {
313
- const other = this.specialties[c - 1];
314
- const old = other.sort;
315
- other.sort = ct.sort;
316
- ct.sort = old;
317
- this.specialties[c - 1] = other;
318
- }
319
- }
320
- else {
321
- if (c < this.specialties.length - 1) {
322
- const other = this.specialties[c + 1];
323
- const old = other.sort;
324
- other.sort = ct.sort;
325
- ct.sort = old;
326
- this.specialties[c + 1] = other;
327
- }
328
- }
329
- break;
330
- }
331
- this.specialties[c] = ct;
332
- }
333
- });
334
- }
335
- /**
336
- * This function will remove a specialty type from the list.
337
- * @param id The numeric value for the identifier to remove.
338
- */
339
- deleteSpecialtyType(id) {
340
- let found = -1;
341
- this.specialties.forEach((ct, c) => {
342
- if (ct.id === id) {
343
- found = c;
344
- }
345
- });
346
- if (found >= 0) {
347
- this.specialties.splice(found, 1);
348
- }
349
- }
350
- }
351
- exports.Team = Team;
package/users/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './user';
2
- export * from './web';
package/users/index.js DELETED
@@ -1,18 +0,0 @@
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("./user"), exports);
18
- __exportStar(require("./web"), exports);
package/users/user.d.ts DELETED
@@ -1,130 +0,0 @@
1
- import { ObjectId } from "mongodb";
2
- /**
3
- * The user class and interface.
4
- */
5
- /**
6
- * This interface ensures all the required fields are present to represent the user and
7
- * its class object.
8
- */
9
- export interface IUser {
10
- _id?: ObjectId;
11
- emailAddress: string;
12
- password?: string;
13
- passwordExpires: Date;
14
- badAttempts: number;
15
- firstName: string;
16
- middleName?: string;
17
- lastName: string;
18
- workgroups: string[];
19
- resettoken?: string;
20
- resettokenexp?: Date;
21
- additionalEmails?: string[];
22
- }
23
- /**
24
- * This class represents a user and all the actions available to the user object.
25
- * The main class members are:
26
- * id (primary key),
27
- * email address (used in authentication and email messages for reset),
28
- * password (authentication), password expires (old use -
29
- * to determine the when the password would expire, but new use is to track when
30
- * created to allow for the warning to change after 90 days and requiring after 1 year),
31
- * badAttempts (count of number of mismatch of password since last known good
32
- * authentication),
33
- * first, middle and last names (name - middle is optional),
34
- * workgroups (string array to provide identificationn of permission within an
35
- * application),
36
- * resetToken and resettokenexp (a storage location or a reset token used in forgot
37
- * password change, plus token expiration date/time the reset token expires)
38
- */
39
- export declare class User implements IUser {
40
- _id: ObjectId;
41
- emailAddress: string;
42
- password?: string;
43
- passwordExpires: Date;
44
- badAttempts: number;
45
- firstName: string;
46
- middleName?: string;
47
- lastName: string;
48
- workgroups: string[];
49
- resettoken?: string;
50
- resettokenexp?: Date;
51
- additionalEmails: string[];
52
- constructor(user?: IUser);
53
- /**
54
- * This function is used to sort this class' objects into an ordered list. The order
55
- * is determined by last, first and middle names
56
- * @param other Another user object used during comparison
57
- * @returns a numeric value to show the object is before or after the other object.
58
- * -1 is for before and 1 is for after.
59
- */
60
- compareTo(other?: User): number;
61
- /**
62
- * This function provides a copy of the user object to the web client. We don't want to
63
- * pass the password, reset token or expiration date/time.
64
- * @returns A new User interface for passing
65
- */
66
- cloneForOutput(): IUser;
67
- /**
68
- * This function will reset the password, bad attemtps and expiration date. The new
69
- * password will be excrypted for storage.
70
- * @param passwd The string value for the new password
71
- */
72
- setPassword(passwd: string): void;
73
- /**
74
- * This function will be used in authentication to verify if the password provided is
75
- * equivelent to the stored one.
76
- * @param pwd The string value to compare against the encrypted password.
77
- * @throws An error if the account is locked or there is a mismatch with the password.
78
- */
79
- checkPassword(pwd: string): void;
80
- /**
81
- * This function will provide a random 16 character password.
82
- * @returns A string value representing the new random password.
83
- */
84
- createRandomPassword(): string;
85
- /**
86
- * This function will unlock the user account to allow for access.
87
- */
88
- unlock(): void;
89
- /**
90
- * This function will provide the user's name in the form first middle and last.
91
- * @returns A string value for the user's name.
92
- */
93
- getFullName(): string;
94
- /**
95
- * This function will provide the user's name in the form first last.
96
- * @returns A string value for the user's name.
97
- */
98
- getFirstLast(): string;
99
- /**
100
- * This function will provide the user's name in the form last, first.
101
- * @returns A string value for the user's name.
102
- */
103
- getLastFirst(): string;
104
- /**
105
- * This function will create a random string used as a token to reset the user's
106
- * password when the user had forgotten it. It will be emailed to the user's
107
- * email addresses. The token will be good for 1 hour, so an expiration date/time
108
- * is also set.
109
- * @returns A string value for the reset token.
110
- */
111
- createResetToken(): string;
112
- /**
113
- * This function will verify the provided string token in comparison to that recorded
114
- * in the user's record. The process also checks to ensure the token isn't expired.
115
- * @param token A string value for the comparison token.
116
- * @returns A boolean value to indicate if the token matches and not expired.
117
- */
118
- checkResetToken(token: string): boolean;
119
- /**
120
- * This function will add a new email address, if it isn't already in the list
121
- * @param email The string value for the email to add.
122
- */
123
- addAdditionalEmail(email: string): void;
124
- /**
125
- * This function will remove an email address from the user's additional email
126
- * address list.
127
- * @param email The string value for the email to remove.
128
- */
129
- deleteAdditionalEmail(email: string): void;
130
- }