tabletcommand-backend-models 7.2.11 → 7.2.13

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.
@@ -1,6 +1,11 @@
1
1
  import * as uuid from "uuid";
2
+ import { Model } from "mongoose";
2
3
  import { mongooseLeanVirtuals } from "mongoose-lean-virtuals";
3
4
 
5
+ import {
6
+ AccountIndustry,
7
+ } from "../constants";
8
+
4
9
  import {
5
10
  currentDate,
6
11
  MongooseModule,
@@ -8,7 +13,7 @@ import {
8
13
  } from "../helpers";
9
14
  import ColorModule from "./schema/color";
10
15
  import PubNubTokenSchema from "./schema/pubnub-token";
11
- import { Model } from "mongoose";
16
+ import { ColorSchemaType } from "../types/color";
12
17
  import {
13
18
  AudioStreamGroupType,
14
19
  AudioStreamType,
@@ -21,8 +26,6 @@ import {
21
26
  ForwardFieldsType,
22
27
  ForwardingConfigType,
23
28
  ForwardingConnectionType,
24
- VehicleStatusWebhookConnectionType,
25
- VehicleStatusWebhookConfigType,
26
29
  GSTConfigType,
27
30
  IncidentReplayType,
28
31
  IncidentTypeType,
@@ -31,6 +34,8 @@ import {
31
34
  IntterraConnectionType,
32
35
  IntterraFieldsType,
33
36
  LicensingType,
37
+ ManagedIncidentModeItem,
38
+ ManagedIncidentPriorityItem,
34
39
  Mark43ConfigType,
35
40
  Mark43ProcessCommentConfigType,
36
41
  Mark43ProcessConfigType,
@@ -48,12 +53,14 @@ import {
48
53
  SomewearType,
49
54
  StatusMappingConfigType,
50
55
  StatusMappingObjectConfigType,
51
- WebDisclaimerType
56
+ VehicleStatusWebhookConfigType,
57
+ VehicleStatusWebhookConnectionType,
58
+ WebDisclaimerType,
52
59
  } from "../types/department";
53
60
 
54
61
  export interface Department extends DepartmentType, Record<string, unknown> { }
55
62
 
56
- const Mark43StatusConfigDefault = {
63
+ export const Mark43StatusConfigDefault = {
57
64
  TimeDispatched: ["D"],
58
65
  TimeEnroute: ["EN"],
59
66
  TimeStaged: ["ST"],
@@ -63,7 +70,7 @@ const Mark43StatusConfigDefault = {
63
70
  TimeArrived: ["ATS", "A"],
64
71
  };
65
72
 
66
- const IntterraFieldsDefault = [
73
+ export const IntterraFieldsDefault = [
67
74
  {
68
75
  "key": "IncidentNumber",
69
76
  "value": "incidentId",
@@ -117,7 +124,7 @@ const IntterraFieldsDefault = [
117
124
 
118
125
  // If any of the following fields are updated/added/deleted,
119
126
  // make sure to update the database records, before/after release (script/query)
120
- const FireMapperConfigurationDefault = {
127
+ export const FireMapperConfigurationDefault = {
121
128
  enabled: false,
122
129
  layerRefreshInterval: 15,
123
130
  proLicenseCount: 0,
@@ -151,7 +158,7 @@ const FireMapperConfigurationDefault = {
151
158
  staticLayer: [],
152
159
  };
153
160
 
154
- const LicensingDefault = {
161
+ export const LicensingDefault = {
155
162
  "tcPro2Way": 0,
156
163
  "tcPro1Way": 0,
157
164
  "tcMobile": 0,
@@ -161,7 +168,7 @@ const LicensingDefault = {
161
168
  "tcStreams": 0
162
169
  };
163
170
 
164
- const SafetyPriorityKeywordDefault = [
171
+ export const SafetyPriorityKeywordDefault = [
165
172
  {
166
173
  "keywords": [],
167
174
  "priority": 0,
@@ -179,48 +186,48 @@ const SafetyPriorityKeywordDefault = [
179
186
  }
180
187
  ];
181
188
 
182
- const FirstArrivingConfigDefault = {
189
+ export const FirstArrivingConfigDefault = {
183
190
  "token": "",
184
191
  "apiUrl": "",
185
192
  };
186
193
 
187
- const IntterraConfigDefault = {
194
+ export const IntterraConfigDefault = {
188
195
  "enabled": false,
189
196
  "connections": [],
190
197
  "incidentWebhookEnabled": false,
191
198
  };
192
199
 
193
- const ForwardingConfigDefault = {
200
+ export const ForwardingConfigDefault = {
194
201
  "enabled": false,
195
202
  "connections": [],
196
203
  };
197
204
 
198
- const VehicleStatusWebhookConfigDefault = {
205
+ export const VehicleStatusWebhookConfigDefault = {
199
206
  "enabled": false,
200
207
  "connections": [],
201
208
  };
202
209
 
203
- const IncidentReplayDefault = {
210
+ export const IncidentReplayDefault = {
204
211
  "enabled": false,
205
212
  "replays": [],
206
213
  };
207
214
 
208
- const SomewearDefault = {
215
+ export const SomewearDefault = {
209
216
  "enabled": false,
210
217
  };
211
218
 
212
- const GSTConfigDefault = {
219
+ export const GSTConfigDefault = {
213
220
  "enabled": false,
214
221
  "code": "",
215
222
  };
216
223
 
217
- const SkymiraConfigDefault = {
224
+ export const SkymiraConfigDefault = {
218
225
  "enabled": false,
219
226
  "token": "",
220
227
  "locationsUrl": "",
221
228
  };
222
229
 
223
- const Mark43ConfigDefault = {
230
+ export const Mark43ConfigDefault = {
224
231
  "baseUrl": "",
225
232
  "authToken": "",
226
233
  "apiToken": "",
@@ -228,16 +235,16 @@ const Mark43ConfigDefault = {
228
235
  "enabled": false,
229
236
  };
230
237
 
231
- const SimpleSenseConfigDefault = {
238
+ export const SimpleSenseConfigDefault = {
232
239
  "token": "",
233
240
  };
234
241
 
235
- const WebDisclaimerDefault = {
242
+ export const WebDisclaimerDefault = {
236
243
  "message": "",
237
244
  "enabled": false
238
245
  };
239
246
 
240
- const RestrictedCommentsDefault = {
247
+ export const RestrictedCommentsDefault = {
241
248
  enabled: false,
242
249
  callTypesAllowed: [],
243
250
  statusesAllowed: [],
@@ -249,7 +256,7 @@ const RestrictedCommentsDefault = {
249
256
  restrictedMessage: "RESTRICTED"
250
257
  };
251
258
 
252
- const StatusMappingConfigDefault = {
259
+ export const StatusMappingConfigDefault = {
253
260
  TimeDispatched: {
254
261
  "status": "Unit Dispatched",
255
262
  "statusCode": "DSP"
@@ -289,7 +296,7 @@ const StatusMappingConfigDefault = {
289
296
  }
290
297
  };
291
298
 
292
- const ForwardFieldsDefault = [
299
+ export const ForwardFieldsDefault = [
293
300
  {
294
301
  "key": "IncidentNumber",
295
302
  "value": "IncidentNumber",
@@ -341,7 +348,7 @@ const ForwardFieldsDefault = [
341
348
  }
342
349
  ];
343
350
 
344
- const VehicleStatusWebhookFieldsDefault = [
351
+ export const VehicleStatusWebhookFieldsDefault = [
345
352
  {
346
353
  "key": "responseTime",
347
354
  "value": "responseTime",
@@ -386,11 +393,32 @@ const VehicleStatusWebhookFieldsDefault = [
386
393
  }
387
394
  ];
388
395
 
389
- const SamsaraConfigurationDefault = {
396
+ export const SamsaraConfigurationDefault = {
390
397
  enabled: false,
391
398
  token: "",
392
399
  };
393
400
 
401
+ export const OrientationMarkerColorDefault: ColorSchemaType = {
402
+ background: "#FC2125",
403
+ text: "#FFFFFF",
404
+ };
405
+
406
+ export const ManagedIncidentModeDefault: ManagedIncidentModeItem[] = [
407
+ { title: "Investigative", color: { background: "#283593", text: "#F5F5F5" }, position: 1 },
408
+ { title: "Offensive", color: { background: "#00695C", text: "#F5F5F5" }, position: 2 },
409
+ { title: "Defensive", color: { background: "#827717", text: "#F5F5F5" }, position: 3 },
410
+ { title: "Combination", color: { background: "#F57F17", text: "#F5F5F5" }, position: 4 },
411
+ { title: "Marginal", color: { background: "#1B5E20", text: "#F5F5F5" }, position: 5 },
412
+ { title: "Transitional", color: { background: "#4E342E", text: "#F3E5F5" }, position: 6 },
413
+ ];
414
+
415
+ export const ManagedIncidentPriorityDefault: ManagedIncidentModeItem[] = [
416
+ { title: "Life", color: { background: "#6A1B9A", text: "#F5F5F5" }, position: 1 },
417
+ { title: "Stabilization", color: { background: "#EDE7F6", text: "#00695C" }, position: 2 },
418
+ { title: "Property", color: { background: "#FFF3E0", text: "#BF360C" }, position: 3 },
419
+ { title: "Environment", color: { background: "#DCEDC8", text: "#424242" }, position: 4 },
420
+ ];
421
+
394
422
  export default async function DepartmentModule(mongoose: MongooseModule) {
395
423
  const { Schema } = mongoose;
396
424
  const PubNubToken = PubNubTokenSchema(mongoose);
@@ -1237,6 +1265,32 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
1237
1265
  id: false,
1238
1266
  });
1239
1267
 
1268
+ const ManagedIncidentModeItemSchema = new Schema<ManagedIncidentModeItem>({
1269
+ title: {
1270
+ type: String,
1271
+ },
1272
+ color: {
1273
+ type: Color,
1274
+ },
1275
+ position: {
1276
+ type: Number,
1277
+ default: 1,
1278
+ },
1279
+ });
1280
+
1281
+ const ManagedIncidentPriorityItemSchema = new Schema<ManagedIncidentPriorityItem>({
1282
+ title: {
1283
+ type: String,
1284
+ },
1285
+ color: {
1286
+ type: Color,
1287
+ },
1288
+ position: {
1289
+ type: Number,
1290
+ default: 1,
1291
+ },
1292
+ });
1293
+
1240
1294
  // Main schema
1241
1295
  const modelSchema = new Schema<DepartmentType>({
1242
1296
  _id: {
@@ -1327,6 +1381,7 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
1327
1381
  },
1328
1382
  orientationMarkerColor: {
1329
1383
  type: Color,
1384
+ default: OrientationMarkerColorDefault,
1330
1385
  },
1331
1386
  rosteringEnabled: {
1332
1387
  type: Boolean,
@@ -1749,6 +1804,20 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
1749
1804
  type: VehicleStatusWebhookConfig,
1750
1805
  default: VehicleStatusWebhookConfigDefault,
1751
1806
  },
1807
+
1808
+ managedIncidentMode: {
1809
+ type: [ManagedIncidentModeItemSchema],
1810
+ default: ManagedIncidentModeDefault,
1811
+ },
1812
+ managedIncidentPriority: {
1813
+ type: [ManagedIncidentPriorityItemSchema],
1814
+ default: ManagedIncidentPriorityDefault,
1815
+ },
1816
+
1817
+ industry: {
1818
+ type: String,
1819
+ default: AccountIndustry.Fire,
1820
+ },
1752
1821
  }, {
1753
1822
  autoIndex: false,
1754
1823
  timestamps: {
@@ -1,4 +1,7 @@
1
1
  import { Types } from "mongoose";
2
+ import {
3
+ AccountIndustry,
4
+ } from "../constants";
2
5
 
3
6
  export interface EncryptedDataType {
4
7
  iv: string,
@@ -91,7 +94,8 @@ export interface AgencyType {
91
94
  cronConfig: AgencyCronConfigType,
92
95
  crossStaffing: CrossStaffedUnitType[],
93
96
  departmentId: Types.ObjectId,
94
- domain: string
97
+ domain: string,
98
+ industry?: AccountIndustry,
95
99
  licensing: AgencyLicensing,
96
100
  modified_unix_date: number,
97
101
  modified: Date,
@@ -1,6 +1,7 @@
1
1
  import { Types } from "mongoose";
2
2
  import { ColorSchemaType } from "./color";
3
3
  import { PubNubTokenSchemaType } from "./pubnub-token";
4
+ import { AccountIndustry } from "../constants";
4
5
 
5
6
  export interface Mark43StatusConfigType {
6
7
  TimeDispatched: string[],
@@ -325,6 +326,18 @@ export type AccountConfigurationZonehaven = {
325
326
  fadeZoomLevel: number,
326
327
  };
327
328
 
329
+ export type ManagedIncidentPriorityItem = {
330
+ title: string,
331
+ color: ColorSchemaType,
332
+ position: number,
333
+ };
334
+
335
+ export type ManagedIncidentModeItem = {
336
+ title: string,
337
+ color: ColorSchemaType,
338
+ position: number,
339
+ };
340
+
328
341
  export interface DepartmentType {
329
342
  _id: Types.ObjectId,
330
343
  id?: string,
@@ -370,11 +383,14 @@ export interface DepartmentType {
370
383
  incidentReplay: IncidentReplayType,
371
384
  incidentTypes: IncidentTypeType[],
372
385
  incidentVehicleStatus: IncidentVehicleStatusConfigType,
373
- intterra: IntterraConfigType
386
+ industry: AccountIndustry,
387
+ intterra: IntterraConfigType,
374
388
  licensing: LicensingType,
375
389
  locationStaleMinutes: number,
376
390
  logOffEnabled: boolean,
377
391
  mark43: Mark43ConfigType
392
+ managedIncidentMode: ManagedIncidentModeItem[],
393
+ managedIncidentPriority: ManagedIncidentPriorityItem[],
378
394
  minPasswordLength: number,
379
395
  modified_unix_date: number,
380
396
  modified: Date,