scheduler-node-models 1.2.1 → 1.2.3
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/general/emailer.d.ts +1 -0
- package/general/emailer.js +31 -0
- package/general/general.d.ts +12 -0
- package/general/general.js +2 -0
- package/general/index.d.ts +5 -0
- package/general/index.js +21 -0
- package/general/logger.d.ts +10 -0
- package/general/logger.js +90 -0
- package/general/report.d.ts +25 -0
- package/general/report.js +76 -0
- package/general/viewstate.d.ts +5 -0
- package/general/viewstate.js +9 -0
- package/index.d.ts +0 -0
- package/index.js +1 -0
- package/metrics/images.d.ts +22 -0
- package/metrics/images.js +33 -0
- package/metrics/index.d.ts +5 -0
- package/metrics/index.js +21 -0
- package/metrics/mission.d.ts +47 -0
- package/metrics/mission.js +81 -0
- package/metrics/missionSensorOutage.d.ts +11 -0
- package/metrics/missionSensorOutage.js +14 -0
- package/metrics/missionsensor.d.ts +67 -0
- package/metrics/missionsensor.js +128 -0
- package/metrics/outage.d.ts +43 -0
- package/metrics/outage.js +55 -0
- package/metrics/systemdata/classifications.d.ts +18 -0
- package/metrics/systemdata/classifications.js +23 -0
- package/metrics/systemdata/communications.d.ts +21 -0
- package/metrics/systemdata/communications.js +40 -0
- package/metrics/systemdata/dcgs.d.ts +19 -0
- package/metrics/systemdata/dcgs.js +29 -0
- package/metrics/systemdata/exploitations.d.ts +18 -0
- package/metrics/systemdata/exploitations.js +23 -0
- package/metrics/systemdata/groundSystems.d.ts +86 -0
- package/metrics/systemdata/groundSystems.js +143 -0
- package/metrics/systemdata/index.d.ts +7 -0
- package/metrics/systemdata/index.js +23 -0
- package/metrics/systemdata/platform.d.ts +124 -0
- package/metrics/systemdata/platform.js +176 -0
- package/metrics/systemdata/systeminfo.d.ts +28 -0
- package/metrics/systemdata/systeminfo.js +64 -0
- package/package.json +4 -4
- package/scheduler/employees/assignment.d.ts +139 -0
- package/scheduler/employees/assignment.js +304 -0
- package/scheduler/employees/balance.d.ts +35 -0
- package/scheduler/employees/balance.js +39 -0
- package/scheduler/employees/companyinfo.d.ts +16 -0
- package/scheduler/employees/companyinfo.js +6 -0
- package/scheduler/employees/contact.d.ts +36 -0
- package/scheduler/employees/contact.js +40 -0
- package/scheduler/employees/employee.d.ts +427 -0
- package/scheduler/employees/employee.js +1887 -0
- package/scheduler/employees/employeename.d.ts +48 -0
- package/scheduler/employees/employeename.js +97 -0
- package/scheduler/employees/index.d.ts +14 -0
- package/scheduler/employees/index.js +30 -0
- package/scheduler/employees/labor.d.ts +31 -0
- package/scheduler/employees/labor.js +39 -0
- package/scheduler/employees/leave.d.ts +58 -0
- package/scheduler/employees/leave.js +73 -0
- package/scheduler/employees/leaverequest.d.ts +105 -0
- package/scheduler/employees/leaverequest.js +226 -0
- package/scheduler/employees/specialty.d.ts +35 -0
- package/scheduler/employees/specialty.js +40 -0
- package/scheduler/employees/variation.d.ts +80 -0
- package/scheduler/employees/variation.js +132 -0
- package/scheduler/employees/web.d.ts +6 -0
- package/scheduler/employees/web.js +2 -0
- package/scheduler/employees/work.d.ts +96 -0
- package/scheduler/employees/work.js +133 -0
- package/scheduler/employees/workday.d.ts +91 -0
- package/scheduler/employees/workday.js +170 -0
- package/scheduler/labor/index.d.ts +2 -0
- package/scheduler/labor/index.js +18 -0
- package/scheduler/labor/laborcode.d.ts +33 -0
- package/scheduler/labor/laborcode.js +55 -0
- package/scheduler/labor/workcode.d.ts +28 -0
- package/scheduler/labor/workcode.js +35 -0
- package/scheduler/sites/index.d.ts +1 -0
- package/scheduler/sites/index.js +17 -0
- package/scheduler/sites/reports/cofsReport.d.ts +41 -0
- package/scheduler/sites/reports/cofsReport.js +104 -0
- package/scheduler/sites/reports/forecast.d.ts +57 -0
- package/scheduler/sites/reports/forecast.js +205 -0
- package/scheduler/sites/reports/index.d.ts +4 -0
- package/scheduler/sites/reports/index.js +20 -0
- package/scheduler/sites/reports/period.d.ts +11 -0
- package/scheduler/sites/reports/period.js +27 -0
- package/scheduler/sites/reports/section.d.ts +63 -0
- package/scheduler/sites/reports/section.js +186 -0
- package/scheduler/sites/site.d.ts +39 -0
- package/scheduler/sites/site.js +68 -0
- package/scheduler/sites/workcenters/index.d.ts +3 -0
- package/scheduler/sites/workcenters/index.js +19 -0
- package/scheduler/sites/workcenters/position.d.ts +27 -0
- package/scheduler/sites/workcenters/position.js +36 -0
- package/scheduler/sites/workcenters/shift.d.ts +32 -0
- package/scheduler/sites/workcenters/shift.js +47 -0
- package/scheduler/sites/workcenters/workcenter.d.ts +43 -0
- package/scheduler/sites/workcenters/workcenter.js +123 -0
- package/scheduler/teams/company/company.d.ts +99 -0
- package/scheduler/teams/company/company.js +256 -0
- package/scheduler/teams/company/holiday.d.ts +61 -0
- package/scheduler/teams/company/holiday.js +116 -0
- package/scheduler/teams/company/index.d.ts +3 -0
- package/scheduler/teams/company/index.js +19 -0
- package/scheduler/teams/company/modperiod.d.ts +21 -0
- package/scheduler/teams/company/modperiod.js +24 -0
- package/scheduler/teams/contact.d.ts +18 -0
- package/scheduler/teams/contact.js +23 -0
- package/scheduler/teams/index.d.ts +3 -0
- package/scheduler/teams/index.js +19 -0
- package/scheduler/teams/specialty.d.ts +18 -0
- package/scheduler/teams/specialty.js +23 -0
- package/scheduler/teams/team.d.ts +95 -0
- package/scheduler/teams/team.js +351 -0
- package/users/index.d.ts +2 -0
- package/users/index.js +18 -0
- package/users/question.d.ts +47 -0
- package/users/question.js +68 -0
- package/users/user.d.ts +150 -0
- package/users/user.js +304 -0
- package/users/web.d.ts +49 -0
- package/users/web.js +2 -0
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,351 @@
|
|
|
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
ADDED
package/users/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface provides the framework for the security question.
|
|
3
|
+
* Namely, a security question and its encrypted answer.
|
|
4
|
+
*/
|
|
5
|
+
export interface ISecurityQuestion {
|
|
6
|
+
id: number;
|
|
7
|
+
question: string;
|
|
8
|
+
answer: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This class defines a security question object, which implements the
|
|
12
|
+
* security question interface of question and answer. It also includes
|
|
13
|
+
* function to update the question and answer, plus provides a method
|
|
14
|
+
* of comparing the answer with one provided.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SecurityQuestion implements ISecurityQuestion {
|
|
17
|
+
id: number;
|
|
18
|
+
question: string;
|
|
19
|
+
answer: string;
|
|
20
|
+
constructor(q?: ISecurityQuestion);
|
|
21
|
+
/**
|
|
22
|
+
* This function is used in sorting the security questions, by
|
|
23
|
+
* first comparing their identified, then the question.
|
|
24
|
+
* @param other (optional) the other security question to be compared to
|
|
25
|
+
* @returns A numeric value for whether the question is before (-1)
|
|
26
|
+
* or after (1)
|
|
27
|
+
*/
|
|
28
|
+
compareTo(other?: SecurityQuestion): number;
|
|
29
|
+
/**
|
|
30
|
+
* This function is used to update either the question or answer which
|
|
31
|
+
* is provided in the value. If the field is answer, the value is
|
|
32
|
+
* saved encrypted of its lower case equivalent.
|
|
33
|
+
* @param field A string value to indicate which object field is to be updated
|
|
34
|
+
* @param value A string value for the update.
|
|
35
|
+
*/
|
|
36
|
+
update(field: string, value: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* This function will check a provided answer, during reset, with the
|
|
39
|
+
* answer in this object. It will submit a lower case value for checking
|
|
40
|
+
* because the answer is orginally the lower case value of the provided
|
|
41
|
+
* answer.
|
|
42
|
+
* @param value A string value used during comparision.
|
|
43
|
+
* @returns A boolean value for whether or not the given value is equal to
|
|
44
|
+
* the saved value.
|
|
45
|
+
*/
|
|
46
|
+
compare(value: string): boolean;
|
|
47
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SecurityQuestion = void 0;
|
|
4
|
+
const bcrypt_ts_1 = require("bcrypt-ts");
|
|
5
|
+
/**
|
|
6
|
+
* This class defines a security question object, which implements the
|
|
7
|
+
* security question interface of question and answer. It also includes
|
|
8
|
+
* function to update the question and answer, plus provides a method
|
|
9
|
+
* of comparing the answer with one provided.
|
|
10
|
+
*/
|
|
11
|
+
class SecurityQuestion {
|
|
12
|
+
id;
|
|
13
|
+
question;
|
|
14
|
+
answer;
|
|
15
|
+
constructor(q) {
|
|
16
|
+
this.id = (q) ? q.id : 0;
|
|
17
|
+
this.question = (q) ? q.question : '';
|
|
18
|
+
this.answer = (q) ? q.answer : '';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This function is used in sorting the security questions, by
|
|
22
|
+
* first comparing their identified, then the question.
|
|
23
|
+
* @param other (optional) the other security question to be compared to
|
|
24
|
+
* @returns A numeric value for whether the question is before (-1)
|
|
25
|
+
* or after (1)
|
|
26
|
+
*/
|
|
27
|
+
compareTo(other) {
|
|
28
|
+
if (other) {
|
|
29
|
+
if (this.id === other.id) {
|
|
30
|
+
return (this.question < other.question) ? -1 : 1;
|
|
31
|
+
}
|
|
32
|
+
return (this.id < other.id) ? -1 : 1;
|
|
33
|
+
}
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This function is used to update either the question or answer which
|
|
38
|
+
* is provided in the value. If the field is answer, the value is
|
|
39
|
+
* saved encrypted of its lower case equivalent.
|
|
40
|
+
* @param field A string value to indicate which object field is to be updated
|
|
41
|
+
* @param value A string value for the update.
|
|
42
|
+
*/
|
|
43
|
+
update(field, value) {
|
|
44
|
+
switch (field.toLowerCase()) {
|
|
45
|
+
case "question":
|
|
46
|
+
this.question = value;
|
|
47
|
+
break;
|
|
48
|
+
case "answer":
|
|
49
|
+
const salt = (0, bcrypt_ts_1.genSaltSync)(12);
|
|
50
|
+
const result = (0, bcrypt_ts_1.hashSync)(value.toLowerCase(), salt);
|
|
51
|
+
this.answer = result;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* This function will check a provided answer, during reset, with the
|
|
57
|
+
* answer in this object. It will submit a lower case value for checking
|
|
58
|
+
* because the answer is orginally the lower case value of the provided
|
|
59
|
+
* answer.
|
|
60
|
+
* @param value A string value used during comparision.
|
|
61
|
+
* @returns A boolean value for whether or not the given value is equal to
|
|
62
|
+
* the saved value.
|
|
63
|
+
*/
|
|
64
|
+
compare(value) {
|
|
65
|
+
return (0, bcrypt_ts_1.compareSync)(value.toLowerCase(), this.answer);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SecurityQuestion = SecurityQuestion;
|