tabletcommand-backend-models 5.17.4 → 5.17.8

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,13 +1,11 @@
1
1
  import * as uuid from "uuid";
2
2
  import {
3
- createSchema,
4
3
  createModel,
4
+ createSchema,
5
5
  currentDate,
6
- DocumentTypeFromSchema,
7
- FieldsOfDocument,
8
- MongooseModule,
9
6
  ItemTypeFromTypeSchemaFunction,
10
7
  ModelTypeFromTypeSchemaFunction,
8
+ MongooseModule,
11
9
  ReplaceModelReturnType,
12
10
  } from "../helpers";
13
11
 
@@ -31,6 +29,265 @@ export async function ManagedIncidentModule(mongoose: MongooseModule) {
31
29
  type: Number,
32
30
  default: 0,
33
31
  },
32
+ user: {
33
+ type: String,
34
+ default: "",
35
+ },
36
+ }, {
37
+ _id: false,
38
+ id: false,
39
+ });
40
+
41
+ const AssignmentItem = createSchema(Schema, {
42
+ name: {
43
+ type: String,
44
+ default: "",
45
+ },
46
+ uuid: {
47
+ type: String,
48
+ default: uuid.v4,
49
+ },
50
+ }, {
51
+ _id: false,
52
+ id: false,
53
+ });
54
+
55
+ const IncidentUnit = createSchema(Schema, {
56
+ active: {
57
+ type: Boolean,
58
+ default: true,
59
+ },
60
+ air_time: {
61
+ type: String,
62
+ default: "",
63
+ },
64
+ assignment: {
65
+ type: AssignmentItem,
66
+ },
67
+ AlarmAtDispatch: {
68
+ type: Number,
69
+ default: 0,
70
+ },
71
+ api_unit_dispatch_number: {
72
+ type: String,
73
+ default: "",
74
+ },
75
+ checked: {
76
+ type: Boolean,
77
+ default: false,
78
+ },
79
+ column_position: {
80
+ type: Number,
81
+ default: 0,
82
+ },
83
+ group_position: {
84
+ type: Number,
85
+ default: 0,
86
+ },
87
+ incident_position: {
88
+ type: Number,
89
+ default: 0,
90
+ },
91
+ isSupervisor: {
92
+ type: Boolean,
93
+ default: false,
94
+ },
95
+ is_part_of_group: {
96
+ type: Boolean,
97
+ default: false,
98
+ },
99
+ location_on_map: {
100
+ type: String,
101
+ default: "",
102
+ },
103
+ // Currently not set
104
+ // modified: {
105
+ // type: Date,
106
+ // default: currentDate,
107
+ // },
108
+ modified_date: {
109
+ type: String,
110
+ default: "",
111
+ },
112
+ modified_unix_date: {
113
+ type: Number,
114
+ default: 0,
115
+ },
116
+ note: {
117
+ type: String,
118
+ default: "",
119
+ },
120
+ personnelOnScene: {
121
+ type: Number,
122
+ default: 0,
123
+ },
124
+ // Personnel?: Personnel[]
125
+ status: {
126
+ type: String,
127
+ default: "",
128
+ },
129
+ status_unix_date: {
130
+ type: Number,
131
+ default: 0,
132
+ },
133
+ time: {
134
+ type: String,
135
+ default: "",
136
+ },
137
+ UnitID: {
138
+ type: String,
139
+ default: "",
140
+ },
141
+ warning: {
142
+ type: Number,
143
+ default: 0,
144
+ },
145
+ }, {
146
+ _id: false,
147
+ id: false,
148
+ });
149
+
150
+ const IncidentGroup = createSchema(Schema, {
151
+ location_on_map: {
152
+ type: String,
153
+ default: "",
154
+ },
155
+ name: {
156
+ type: String,
157
+ default: "",
158
+ },
159
+ note: {
160
+ type: String,
161
+ default: "",
162
+ },
163
+ position: {
164
+ type: Number,
165
+ default: 0,
166
+ },
167
+ type: {
168
+ type: Number,
169
+ default: 0,
170
+ },
171
+ type_text: {
172
+ type: String,
173
+ default: "",
174
+ },
175
+ units: {
176
+ type: [IncidentUnit],
177
+ default: [],
178
+ },
179
+ uuid: {
180
+ type: String,
181
+ default: uuid.v4,
182
+ },
183
+ }, {
184
+ _id: false,
185
+ id: false,
186
+ });
187
+
188
+ const IncidentHazard = createSchema(Schema, {
189
+ location_on_scene: {
190
+ type: String,
191
+ default: "",
192
+ },
193
+ name: {
194
+ type: String,
195
+ default: "",
196
+ },
197
+ radius: {
198
+ type: Number,
199
+ default: 0,
200
+ },
201
+ time: {
202
+ type: Number,
203
+ default: 0,
204
+ },
205
+ }, {
206
+ _id: false,
207
+ id: false,
208
+ });
209
+
210
+ const IncidentChecklistItem = createSchema(Schema, {
211
+ active: {
212
+ type: Boolean,
213
+ default: true
214
+ },
215
+ checked: {
216
+ type: Boolean,
217
+ default: false
218
+ },
219
+ isMandatory: {
220
+ type: Boolean,
221
+ default: false
222
+ },
223
+ modified_date: {
224
+ type: String,
225
+ default: "",
226
+ },
227
+ name: {
228
+ type: String,
229
+ default: "",
230
+ },
231
+ position: {
232
+ type: Number,
233
+ default: 0,
234
+ },
235
+ uuid: {
236
+ type: String,
237
+ default: "",
238
+ },
239
+ }, {
240
+ _id: false,
241
+ id: false,
242
+ });
243
+
244
+ const IncidentChecklist = createSchema(Schema, {
245
+ active: {
246
+ type: Boolean,
247
+ default: true
248
+ },
249
+ built_in: {
250
+ type: Boolean,
251
+ default: false
252
+ },
253
+ isMandatory: {
254
+ type: Boolean,
255
+ default: false
256
+ },
257
+ items: {
258
+ type: [IncidentChecklistItem],
259
+ default: [],
260
+ },
261
+ modified_date: {
262
+ type: String,
263
+ default: "",
264
+ },
265
+ name: {
266
+ type: String,
267
+ default: "",
268
+ },
269
+ position: {
270
+ type: Number,
271
+ default: 0,
272
+ },
273
+ uuid: {
274
+ type: String,
275
+ default: "",
276
+ },
277
+ }, {
278
+ _id: false,
279
+ id: false,
280
+ });
281
+
282
+ const RadioChannel = createSchema(Schema, {
283
+ name: {
284
+ type: String,
285
+ default: "",
286
+ },
287
+ channel: {
288
+ type: String,
289
+ default: "",
290
+ },
34
291
  }, {
35
292
  _id: false,
36
293
  id: false,
@@ -65,6 +322,15 @@ export async function ManagedIncidentModule(mongoose: MongooseModule) {
65
322
  par_unix_time: Number,
66
323
  watch_unix_start_time: Number,
67
324
  watch_unix_pause_time: Number,
325
+ start_time: {
326
+ type: String,
327
+ },
328
+ end_time: {
329
+ type: String,
330
+ },
331
+ modified_date: {
332
+ type: String,
333
+ },
68
334
 
69
335
  modified_unix_date: {
70
336
  type: Number,
@@ -84,35 +350,79 @@ export async function ManagedIncidentModule(mongoose: MongooseModule) {
84
350
  default: "",
85
351
  },
86
352
 
87
- location: String,
88
- last_view: String,
89
- preference_location: String,
353
+ active: Boolean,
90
354
  address: String,
91
- name: String,
92
- cross_streets: String,
93
355
  api_incident_number: String,
94
- CommonPlaceName: String,
95
- TacticalChannel: String,
96
- TacticalAltChannel: String,
97
- active: Boolean,
98
- slave_map_changed: Boolean,
99
- managed: Boolean,
100
- is_closed: Boolean,
101
- source: String,
102
356
  CallerNumber: String,
103
357
  CommandChannel: String,
358
+ CommonPlaceName: String,
359
+ cross_streets: String,
360
+ deviceTime: {
361
+ type: String,
362
+ default: "",
363
+ },
104
364
  extended: {
105
365
  type: Boolean,
106
366
  default: false
107
367
  },
368
+ FireMap: {
369
+ type: String,
370
+ default: "",
371
+ },
372
+ is_closed: {
373
+ type: Boolean,
374
+ default: false
375
+ },
376
+ last_view: String,
377
+ location: String,
378
+ MapPages: {
379
+ type: String,
380
+ default: "",
381
+ },
382
+ managed: {
383
+ type: Boolean,
384
+ default: true,
385
+ },
386
+ name: String,
387
+ preference_location: String,
388
+ serverTime: {
389
+ type: String,
390
+ default: "",
391
+ },
392
+ slave_map_changed: Boolean,
393
+ source: String,
394
+ TacticalAltChannel: String,
395
+ TacticalChannel: String,
108
396
 
109
- // Incident Notes
110
- notes: {
111
- type: [HistoryItem],
397
+ checklists: {
398
+ type: [IncidentChecklist],
399
+ default: [],
400
+ },
401
+ groups: {
402
+ type: [IncidentGroup],
403
+ default: [],
404
+ },
405
+ hazards: {
406
+ type: [IncidentHazard],
407
+ default: [],
112
408
  },
113
409
  // Incident History
114
410
  history: {
115
411
  type: [HistoryItem],
412
+ default: [],
413
+ },
414
+ // Incident Notes
415
+ notes: {
416
+ type: [HistoryItem],
417
+ default: [],
418
+ },
419
+ radioChannels: {
420
+ type: [RadioChannel],
421
+ default: [],
422
+ },
423
+ units: {
424
+ type: [IncidentUnit],
425
+ default: [],
116
426
  },
117
427
 
118
428
  // Training
@@ -124,15 +434,6 @@ export async function ManagedIncidentModule(mongoose: MongooseModule) {
124
434
  type: Boolean,
125
435
  default: true,
126
436
  },
127
- start_time: {
128
- type: String,
129
- },
130
- end_time: {
131
- type: String,
132
- },
133
- modified_date: {
134
- type: String,
135
- },
136
437
  }, {
137
438
  collection: "massive_incident_managed",
138
439
  });
@@ -141,13 +442,6 @@ export async function ManagedIncidentModule(mongoose: MongooseModule) {
141
442
  modelSchema.set("toJSON", {
142
443
  virtuals: true,
143
444
  versionKey: false,
144
- transform(doc: DocumentTypeFromSchema<typeof modelSchema>, ret: FieldsOfDocument<DocumentTypeFromSchema<typeof modelSchema>>) {
145
- ret.id = ret._id;
146
- },
147
- });
148
-
149
- modelSchema.virtual("id").get(function (this: DocumentTypeFromSchema<typeof modelSchema>) {
150
- return this._id.toString();
151
445
  });
152
446
 
153
447
  return createModel(mongoose, "ManagedIncident", modelSchema);
@@ -165,9 +165,9 @@ export async function UserModule(mongoose: MongooseModule) {
165
165
  type: String,
166
166
  default: "",
167
167
  },
168
- tokenExpireDate: {
169
- type: Number,
170
- default: 0,
168
+ tokenExpireAt: {
169
+ type: Date,
170
+ default: currentDate,
171
171
  },
172
172
  shareLocationPhone: {
173
173
  type: Boolean,
@@ -206,7 +206,8 @@ export async function UserModule(mongoose: MongooseModule) {
206
206
  type: Number,
207
207
  },
208
208
  defaultCenter: {
209
- type: [Number]
209
+ type: [Number],
210
+ default: [],
210
211
  },
211
212
  defaultMap: {
212
213
  type: String