tabletcommand-backend-models 5.17.26 → 5.17.29

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 (40) hide show
  1. package/.eslintrc.js +1 -3
  2. package/build/index.js +5 -1
  3. package/build/index.js.map +1 -1
  4. package/build/models/arcgis-group.js +1 -6
  5. package/build/models/arcgis-group.js.map +1 -1
  6. package/build/models/esri.js +3 -3
  7. package/build/models/esri.js.map +1 -1
  8. package/build/models/location.js +6 -1
  9. package/build/models/location.js.map +1 -1
  10. package/build/models/user.js +4 -0
  11. package/build/models/user.js.map +1 -1
  12. package/build/test/arcgis-group.js +95 -0
  13. package/build/test/arcgis-group.js.map +1 -0
  14. package/build/test/config.js +12 -0
  15. package/build/test/config.js.map +1 -0
  16. package/build/test/mock.js +974 -0
  17. package/build/test/mock.js.map +1 -0
  18. package/definitions/models/arcgis-group.d.ts +0 -46
  19. package/definitions/models/arcgis-group.d.ts.map +1 -1
  20. package/definitions/models/esri.d.ts +4 -4
  21. package/definitions/models/location.d.ts.map +1 -1
  22. package/definitions/models/user.d.ts +1 -0
  23. package/definitions/models/user.d.ts.map +1 -1
  24. package/definitions/test/arcgis-group.d.ts +2 -0
  25. package/definitions/test/arcgis-group.d.ts.map +1 -0
  26. package/definitions/test/config.d.ts +3 -0
  27. package/definitions/test/config.d.ts.map +1 -0
  28. package/definitions/test/mock.d.ts +39 -0
  29. package/definitions/test/mock.d.ts.map +1 -0
  30. package/package.json +8 -7
  31. package/src/models/arcgis-group.ts +0 -5
  32. package/src/models/esri.ts +3 -3
  33. package/src/models/location.ts +10 -4
  34. package/src/models/user.ts +4 -0
  35. package/src/test/arcgis-group.ts +107 -0
  36. package/src/test/config.ts +10 -0
  37. package/src/test/mock.ts +982 -0
  38. package/src/tsconfig.json +5 -0
  39. package/test/arcgis-group.js +2 -2
  40. package/test/mock.js +1 -1
@@ -0,0 +1,982 @@
1
+
2
+ // import * as uuid from "uuid";
3
+ import { Types } from "mongoose";
4
+
5
+ import { checkIfTestDatabase } from "./config";
6
+ checkIfTestDatabase();
7
+
8
+ export default function MockModule(dependecies: {
9
+ models: unknown,
10
+ }) {
11
+
12
+ async function cleanup() {
13
+ return "";
14
+ }
15
+
16
+ const arcGISGroup = {
17
+ access: "private",
18
+ linkedDepartments: [
19
+ {
20
+ department: "Demo RTS Fire Department",
21
+ departmentId: "558365a198b2fa4278000053",
22
+ authUsername: "tabletcmd",
23
+ authError: null,
24
+ tokenUsername: "tc_ContraCostaCountyFire",
25
+ tokenError: null,
26
+ users: [
27
+ //
28
+ {
29
+ username: "tc_someone",
30
+ email: "hello@tc.com",
31
+ userId: "558365a198a2aa42780000aa",
32
+ }
33
+ ]
34
+ }
35
+ ],
36
+ externalOrgIds: [
37
+ "MyTOuXKXZoizaaa"
38
+ ],
39
+ groupId: "c5d013e197244577a583c49984d319d9",
40
+ outsiders: [
41
+ {
42
+ fullName: "Michael Kallum",
43
+ memberType: "member",
44
+ orgId: "MyTOuXKXZoizaaa",
45
+ username: "Michael_Kallum"
46
+ }
47
+ ],
48
+ owner: "jane_tabletcommand",
49
+ protected: true,
50
+ title: "TC - City of Fire Department",
51
+ users: [
52
+ {
53
+ fullName: "Jane Serrano",
54
+ memberType: "admin",
55
+ orgId: "zGXMcUaDlMGoAAAg",
56
+ username: "jane_tabletcommand"
57
+ },
58
+ ]
59
+ };
60
+
61
+ return {
62
+ cleanup,
63
+
64
+ arcGISGroup,
65
+ };
66
+ }
67
+
68
+ /*
69
+ module.exports = function(dependencies) {
70
+ "use strict";
71
+
72
+ const {
73
+ models,
74
+ mongoose
75
+ } = dependencies;
76
+
77
+ const actionLog = {
78
+ departmentId: "d1234",
79
+ email: "hello@example.com",
80
+ action: "someAction",
81
+ userId: "1234",
82
+ object: {
83
+ vehicleId: "v1171",
84
+ radioName: "E10"
85
+ },
86
+ before: {
87
+ test: "test1"
88
+ },
89
+ after: {
90
+ test: "test2"
91
+ },
92
+ delta: {
93
+ test: "test2"
94
+ }
95
+ };
96
+
97
+ const agency = {
98
+ _id: mongoose.Types.ObjectId(),
99
+ departmentId: new mongoose.Types.ObjectId("56131f724143487a10000001"),
100
+ code: "TC",
101
+ name: "Tablet Command",
102
+ active: true,
103
+ administrators: [
104
+ new mongoose.Types.ObjectId()
105
+ ],
106
+ personnelIntegration: true,
107
+ personnelMonitorHours: 24,
108
+ crossStaffing: [
109
+ {
110
+ radioName: "E1",
111
+ crossStaffedUnits: ["E2", "E3"],
112
+ alwaysCrossStaff: true
113
+ }
114
+ ]
115
+ };
116
+
117
+ const arcGISGroup = {
118
+ access: "private",
119
+ linkedDepartments: [
120
+ {
121
+ department: "Demo RTS Fire Department",
122
+ departmentId: "558365a198b2fa4278000053",
123
+ authUsername: "tabletcmd",
124
+ authError: null,
125
+ tokenUsername: "tc_ContraCostaCountyFire",
126
+ tokenError: null,
127
+ users: [
128
+ //
129
+ {
130
+ username: "tc_someone",
131
+ email: "hello@tc.com",
132
+ userId: "558365a198a2aa42780000aa",
133
+ }
134
+ ]
135
+ }
136
+ ],
137
+ externalOrgIds: [
138
+ "MyTOuXKXZoizaaa"
139
+ ],
140
+ groupId: "c5d013e197244577a583c49984d319d9",
141
+ outsiders: [
142
+ {
143
+ fullName: "Michael Kallum",
144
+ memberType: "member",
145
+ orgId: "MyTOuXKXZoizaaa",
146
+ username: "Michael_Kallum"
147
+ }
148
+ ],
149
+ owner: "jane_tabletcommand",
150
+ protected: true,
151
+ title: "TC - City of Fire Department",
152
+ users: [
153
+ {
154
+ fullName: "Jane Serrano",
155
+ memberType: "admin",
156
+ orgId: "zGXMcUaDlMGoAAAg",
157
+ username: "jane_tabletcommand"
158
+ },
159
+ ]
160
+ };
161
+
162
+ const assignment = {
163
+ position: 1,
164
+ active: true,
165
+ name: "Vertical Test",
166
+ userId: "1234",
167
+ departmentId: "4321",
168
+ description: "testing",
169
+ isMandatory: false,
170
+ };
171
+
172
+ const battalionUnit = {
173
+ name: "BattalionUnit Test",
174
+ friendly_id: "B1",
175
+ local_id: 321,
176
+ personnel: 4,
177
+ position: 1,
178
+ active: true,
179
+ isMandatory: false,
180
+ departmentId: "123",
181
+ userId: "123",
182
+ api_battalion_id: "123",
183
+ battalion_uuid: "",
184
+ battalion_name: "",
185
+ };
186
+
187
+ const battalion = {
188
+ name: "Battalion Test",
189
+ active: true,
190
+ isMandatory: false,
191
+ userId: "123",
192
+ departmentId: 123,
193
+ AgencyId: new mongoose.Types.ObjectId(agency._id),
194
+ position: 1,
195
+ units: [battalionUnit]
196
+ };
197
+
198
+ const checklistId = mongoose.Types.ObjectId();
199
+ const checklistUUID = "150cf1ca-ffbb-42c9-bd4c-fd64be45d888";
200
+
201
+ const checklistItem = {
202
+ _id: mongoose.Types.ObjectId(),
203
+ uuid: "150cf1ca-ffbb-42c9-bd4c-fd64be45d887",
204
+ checklist_uuid: checklistUUID,
205
+ position: 1,
206
+ active: true,
207
+ name: "TC Test Item",
208
+ checked: 0,
209
+ api_checklist_id: checklistId,
210
+ userId: "1234",
211
+ departmentId: "4321",
212
+ local_id: 1,
213
+ isMandatory: true,
214
+ agencyId: new mongoose.Types.ObjectId(agency._id),
215
+ description: "Testing Description"
216
+ };
217
+
218
+ const checklist = {
219
+ _id: checklistId,
220
+ uuid: checklistUUID,
221
+ position: 1,
222
+ active: true,
223
+ name: "TC Test",
224
+ userId: "1234",
225
+ departmentId: "4321",
226
+ local_id: 1,
227
+ isMandatory: true,
228
+ agencyId: new mongoose.Types.ObjectId(agency._id),
229
+ items: [checklistItem]
230
+ };
231
+
232
+ const mailLog = {
233
+ mailId: "1234",
234
+ event: "delivery",
235
+ timestamp: 1553199671,
236
+ recipient: "test@tabletcommand.com",
237
+ recipientDomain: "tabletcommand.com",
238
+ tags: ["create account"],
239
+ deliveryStatus: {},
240
+ message: {},
241
+ flags: {},
242
+ envelope: {},
243
+ logLevel: "info",
244
+ reason: "Message Sent",
245
+ severity: "Mild"
246
+ };
247
+
248
+ const message = {
249
+ departmentId: "d1234",
250
+ "active" : false,
251
+ "title" : "Upgrade App",
252
+ "body" : "Application out of date.",
253
+ "actionTitle" : "Upgrade App",
254
+ "color" : null,
255
+ "url" : "",
256
+ "priority" : 4,
257
+ "type" : {
258
+ "type" : "upgradeApp",
259
+ "typeOpts" : {
260
+ "major" : 3,
261
+ "minor" : 0,
262
+ "patch" : 1
263
+ }
264
+ },
265
+ "created" : new Date().toISOString(),
266
+ "uuid" : "138acffd-a94f-402d-87b3-ff6ed31a19dc",
267
+ "requestId" : "138acffd-a94f-402d-87b3-ff6ed31a19db",
268
+ };
269
+
270
+ const cadIncident = {
271
+ _id: mongoose.Types.ObjectId(),
272
+ uuid: "150cf1ca-ffbb-42c9-bd4c-fd64be45d679",
273
+ departmentId: "56131f724143487a10000001",
274
+ AgencyID: "BDC",
275
+ IncidentNumber: "19-058314",
276
+ TransactionID: "15532010710000",
277
+ AgencyIncidentCallTypeDescription: "AT - Ambulance Transport",
278
+ StreetName: "College",
279
+ StreetSuffix: "Court",
280
+ Predirectional: "North",
281
+ Postdirectional: "Late",
282
+ CityOrLocality: "San Francisco",
283
+ Floor: "2",
284
+ Suite: "AA",
285
+ City: "San Francisco",
286
+ Building: "E",
287
+ StateOrProvince: "CA",
288
+ CommonPlaceName: "VALLEY VIEW MEDICAL CENTER",
289
+ LocationComment: "VALLEY VIEW MEDICAL CENTER",
290
+ CrossStreet1: "FIVE MILE RD",
291
+ CrossStreet2: "No X-Street",
292
+ cross_streets: "FIVE MILE RD/No X-Street",
293
+ PostalCode: "29191",
294
+ CallerNumber: "0192-122-299",
295
+ PriorIncidentChanged: true,
296
+ PriorIncident: [
297
+ //
298
+ {
299
+ IncidentNumber: "19-042678",
300
+ IncidentDateTime: "2019-03-01T01:56:54-08:00",
301
+ Problem: "Problem Abcd",
302
+ Address: "5330 Us 95 Hwy S",
303
+ Suite: "83",
304
+ Jurisdiction: "San Bernardino County",
305
+ Comment: [
306
+ //
307
+ {
308
+ Comment: "[1] Call Appended to Incident number 19-042593",
309
+ CommentSource: "G8724",
310
+ CommentDateTime: "2019-03-01T01:59:57-08:00"
311
+ }
312
+ ]
313
+ }
314
+ ],
315
+ Latitude: "34.788611",
316
+ Longitude: "-114.549444",
317
+ Comment: [
318
+ //
319
+ {
320
+ Comment: "(1) VALLEY VIEW ICU TO SUNRISE ICU",
321
+ CommentSource: "H6577",
322
+ CommentDateTime: "2019-03-21T13:21:08-07:00"
323
+ }
324
+ ],
325
+ units: [
326
+ //
327
+ {
328
+ UnitDispatchNumber: 4067677,
329
+ UnitID: "MA31",
330
+ TimeDispatched: "2019-03-21T13:21:22-07:00"
331
+ }
332
+ ],
333
+ preference_location: "address",
334
+ EntryDateTime: "2019-03-21T13:21:11-07:00",
335
+ ClosedDateTime: "",
336
+ closed_unix_date: 0,
337
+ start_unix_date: 1553199671,
338
+ modified_unix_date: 1553201071.636
339
+ };
340
+
341
+ const cadStatus = {
342
+ _id: mongoose.Types.ObjectId(),
343
+ code: "AV",
344
+ codeDisplay: "RS",
345
+ color: {
346
+ background: "#7b7d7d",
347
+ text: "#F8F9F9"
348
+ },
349
+ departmentId: "51a2529293e11b3569000057",
350
+ modifiedDate: 1544771122.997,
351
+ name: "In Service",
352
+ normalized: "inService",
353
+ options: [
354
+ //
355
+ {
356
+ cadKey: "oosCode",
357
+ cadValues: [
358
+ //
359
+ {
360
+ favorite: false,
361
+ name: "ADM - Admin",
362
+ position: 20,
363
+ type: "string",
364
+ value: "ADM",
365
+ visible: true
366
+ }
367
+ ],
368
+ name: "oosCode",
369
+ position: 2,
370
+ visible: true
371
+ }
372
+ ],
373
+ roaming: false,
374
+ selfAssignable: true,
375
+ status: "OR",
376
+ statusId: 1,
377
+ uuid: "8086956b-43af-4300-aa30-5efbd10b2c98"
378
+ };
379
+
380
+ const cadStatusMap = {
381
+ "departmentId": "51a2529293e11b3569000057",
382
+ "fromStatusId": 0,
383
+ "modifiedDate": 1544143059.729,
384
+ "toStatusIds": [
385
+ //
386
+ {
387
+ "statusId": 1,
388
+ "userEnabled": true
389
+ }
390
+ ]
391
+ };
392
+
393
+ const cadVehicle = {
394
+ _id: mongoose.Types.ObjectId(),
395
+ uuid: "30f8d7c7-20a3-4a12-b911-a424f5037003",
396
+ radioName: "T01",
397
+ vehicleId: "7705",
398
+ modifiedDate: 1541569088.909,
399
+ departmentId: "5195426cc4e016a988000965",
400
+ station: {
401
+ code: "S01",
402
+ name: "Station 01"
403
+ },
404
+ capability: ""
405
+ };
406
+
407
+ const cadVehicleStatus = {
408
+ uuid: "5a324923-2622-48f2-abaa-8a855e7cebdf",
409
+ departmentId: "d1234",
410
+ vehicleId: "v1171",
411
+ radioName: "E10",
412
+ requestTime: 1516557000,
413
+ responseTime: 1516567096,
414
+ status: "Dispatched",
415
+ statusCode: "DISP",
416
+ modifiedDate: 1516577096,
417
+ requestStatus: 0,
418
+ incidentNumber: "INC19991",
419
+ capability: "",
420
+ owner: "user",
421
+ ownerId: "M1"
422
+ };
423
+
424
+ const cadVehicleStatusHistory = {
425
+ departmentId: "d1234",
426
+ vehicleId: "v1171",
427
+ radioName: "E10",
428
+ status: "Dispatched",
429
+ statusCode: "DISP",
430
+ requestedAt: 1516557000,
431
+ requestedBy: "user",
432
+ modifiedDate: 1516577096,
433
+ incidentNumber: "INC19991"
434
+ };
435
+
436
+ const department = {
437
+ _id: mongoose.Types.ObjectId(),
438
+ department: "Test Department",
439
+ city: "San Francisco",
440
+ active: true,
441
+ apikey: "abcd",
442
+ partialApiKey: "ab",
443
+ personnelStaffingEnabled: true,
444
+ rtsEnabled: true,
445
+ rtsChannelPrefix: "CH_TEST",
446
+ pubNubV3: {
447
+ token: "CH_AUTH_TOKEN",
448
+ expireAt: "2021-09-10T23:25:02.196Z",
449
+ runAt: "2021-09-10T08:25:02.196Z",
450
+ },
451
+ agencyIds: [
452
+ new mongoose.Types.ObjectId(agency._id)
453
+ ],
454
+ signupKey: "A1B2",
455
+ incidentTypes: [{
456
+ name: "Type",
457
+ value: "type"
458
+ }],
459
+ shareLocationPhones: false,
460
+ shareLocationTablets: true,
461
+ cadOneWayVehiclesEnabled: false,
462
+ mowsEnabled: true,
463
+ shareAVL: {
464
+ enabled: true,
465
+ opAreaCode: "DAL",
466
+ opAreaName: "Delta Operations"
467
+ },
468
+ accountType: "production",
469
+ timeZone: "America/Los_Angeles",
470
+ firstArrivingEnabled: true,
471
+ simpleSenseEnabled: true,
472
+ licensing: {
473
+ tcPro2Way: 0,
474
+ tcPro1Way: 0,
475
+ tcMobile: 0,
476
+ tcWeb: 0,
477
+ fireMapperPro: 0,
478
+ sendToCAD: 0
479
+ },
480
+ webDisclaimer: {
481
+ message: "test",
482
+ enabled: true
483
+ },
484
+ notificationEmails: ["test@test.com"],
485
+ externalNotificationsEnabled: true
486
+ };
487
+
488
+ const esriMap = {
489
+ mapLayers: [
490
+ //
491
+ {
492
+ "url": "https://services.arcgis.com/aA3snZwJfFkVyDuP/arcgis/rest/services/XBO_Branches_Updated/FeatureServer/0",
493
+ "itemId": "XBO_Branches_Updated_3067",
494
+ "layerType": "ArcGISFeatureLayer",
495
+ "title": "XBO Branches_Updated"
496
+ },
497
+ {
498
+ "itemId": "city_limits_092019_4185",
499
+ "layerType": "ArcGISFeatureLayer",
500
+ "title": "City Limits",
501
+ "url": "https://services.arcgis.com/aA3snZwJfFkVyDuP/arcgis/rest/services/city_limits_092019/FeatureServer/0"
502
+ },
503
+ {
504
+ "itemId": "unvdpdod57lext9eck9nxipcov2dgjqs_8576",
505
+ "layerType": "ArcGISFeatureLayer",
506
+ "title": "Tablet Command",
507
+ "url": "https://api.tabletcommand.com/esri/tc-file/unvdpdod57lext9eck9nxipcov2dgjqs/FeatureServer/0"
508
+ }
509
+ ],
510
+ "owner": "john_tabletcommand",
511
+ "title": "Location (MM Filters)",
512
+ "url": null,
513
+ "access": "shared",
514
+ "baseMap": {
515
+ "baseMapLayers": [
516
+ //
517
+ {
518
+ "opacity": 1,
519
+ "id": "VectorTile_1188",
520
+ "type": "VectorTileLayer",
521
+ "layerType": "VectorTileLayer",
522
+ "title": "World Street Map (Night)",
523
+ "styleUrl": "https://cdn.arcgis.com/sharing/rest/content/items/86f556a2d1fd468181855a35e344567f/resources/styles/root.json",
524
+ "visibility": true
525
+ }
526
+ ],
527
+ "title": "Streets (Night)"
528
+ },
529
+ "itemId": "01cebf7aede94ed3a9f4c260e18a7d7e",
530
+ "type": "Web Map",
531
+ "tags": [
532
+ "XBO",
533
+ "Tabletcommand"
534
+ ],
535
+ "development": true,
536
+ };
537
+
538
+ const deviceMapping = {
539
+ _id: mongoose.Types.ObjectId(),
540
+ nick: "Test",
541
+ departmentId: "d123",
542
+ deviceType: "hello",
543
+ mapId: "map123",
544
+ deviceId: "deviceType121",
545
+ modified_unix_date: 1432230780,
546
+ active: false,
547
+ remoteAddress: "1.2.3.4",
548
+ note: "don't feed after dark",
549
+ mapHidden: false
550
+ };
551
+
552
+ const esri = {
553
+ _id: mongoose.Types.ObjectId(),
554
+ departmentId: new mongoose.Types.ObjectId("56131f724143487a10000001"),
555
+ modified_unix_date: 1432230780,
556
+ token: {
557
+ access_token: "abc_PccBHQYuj",
558
+ expires_in: 2800,
559
+ username: "hello_tc",
560
+ ssl: true,
561
+ refresh_token: "def_IZ99D6eS"
562
+ },
563
+ tokenDateExpiry: 1544475888,
564
+ tokenError: {
565
+ code: 498,
566
+ error: "invalid_request",
567
+ error_description: "refresh_token expired",
568
+ message: "refresh_token expired"
569
+ },
570
+ auth: {
571
+ username: "fire_maps",
572
+ encrypted: {
573
+ iv: "18f17",
574
+ encryptedData: "dee54"
575
+ }
576
+ },
577
+ fireMapperAuth: {
578
+ username: "fire_mapper",
579
+ encrypted: {
580
+ iv: "28f10",
581
+ encryptedData: "dee99"
582
+ },
583
+ encryptedAccessCode: {
584
+ iv: "99f1341",
585
+ encryptedData: "zoom123"
586
+ }
587
+ },
588
+ maps: [
589
+ esriMap
590
+ ],
591
+ mapsProperties: [
592
+ //
593
+ {
594
+ itemId: "01cebf7aede94ed3a9f4c260e18a7d7e",
595
+ download: true,
596
+ }
597
+ ]
598
+ };
599
+
600
+ const gstMapping = {
601
+ _id: mongoose.Types.ObjectId(),
602
+ departmentId: "d123",
603
+ unitId: "E123",
604
+ modified_unix_date: 1432230780,
605
+ active: false,
606
+ remoteAddress: "1.2.3.4",
607
+ note: "don't feed after dark",
608
+ mapHidden: false,
609
+ gstAgency: "LAX",
610
+ deviceType: "gst",
611
+ note: ""
612
+ };
613
+
614
+ const incidentEvent = {
615
+ IncidentNumber: "TC1212121",
616
+ departmentId: "d123",
617
+ modified_unix_date: 1432230780,
618
+ message: "Hello from the other side",
619
+ location: {
620
+ longitude: -29.90129,
621
+ latitude: 121.223131
622
+ },
623
+ userTime: 1437121647,
624
+ type: "contribution",
625
+ user: {
626
+ email: "marius+cc@tabletcommand.com",
627
+ username: "ztc-marcc",
628
+ radioName: "E12",
629
+ userId: "51c2dcca0c599704e400001f"
630
+ },
631
+ uuid: "ABCDEF"
632
+ };
633
+
634
+ const incidentTakeover = {
635
+ _id: mongoose.Types.ObjectId(),
636
+ incident_id: "i1234",
637
+ incident_name: "Test Incident",
638
+ incident_number: "TC-12345",
639
+ departmentId: "d123",
640
+ old_owner: "user1",
641
+ new_owner: "user2",
642
+ owner: "",
643
+ status: "request",
644
+ request_time: 1442888560
645
+ };
646
+
647
+ const incidentNotified = {
648
+ _id: mongoose.Types.ObjectId(),
649
+ departmentId: "d123",
650
+ IncidentNumber: "T-1536603902",
651
+ incidentTypes: [
652
+ "any"
653
+ ],
654
+ units: [
655
+ "E31"
656
+ ],
657
+ sent: [
658
+ ],
659
+ updated: "2018-09-10T18:25:02.196Z"
660
+ };
661
+
662
+ const location = {
663
+ _id: mongoose.Types.ObjectId(),
664
+ departmentId: "d123",
665
+ userId: "542a40db20783c000000153d",
666
+ uuid: "92c8f732-52b7-46cc-855a-d54fddfe3172",
667
+ username: "E23",
668
+ device_type: "iPad",
669
+ active: true,
670
+ heading: 43,
671
+ locationGeoJSON: {
672
+ type: "Point",
673
+ coordinates: [-120.001, 37.001],
674
+ },
675
+ session: "abcd",
676
+ opAreaCode: "DAL",
677
+ opAreaName: "Delta Operations",
678
+ shared: true,
679
+ state: "CA",
680
+ sendToCAD: false,
681
+ color: {
682
+ text: "#00AA00",
683
+ background: "#FFAAFF"
684
+ },
685
+ modified: new Date().toISOString()
686
+ };
687
+
688
+ const managedIncident = {
689
+ _id: mongoose.Types.ObjectId(),
690
+ CallerNumber: "(720) 275-6765",
691
+ CommandChannel: "ACPRI",
692
+ TacticalAltChannel: "ACOPSB",
693
+ TacticalChannel: "ACOPSA",
694
+ active: 1,
695
+ address: "Interstate 76 Eb / Federal To I 76 Eb, UNINCORPORATED ADAMS COUNTY CO",
696
+ api_incident_number: "ACFR040719-0002506",
697
+ channel: "ADAMSCOUNTYFIRERESCUEN1C-MANAGED-ACFR040719-0002506",
698
+ channel_owner: "e12@acfpd.org",
699
+ departmentId: "5b17f315f877ee16f3d019b7",
700
+ end_time: "2019-04-08T00:16:30+0000",
701
+ end_unix_time: 1554682590.44313,
702
+ esri_map: {
703
+ json: "YnBsaXN0MDDUAQIDBAUGCAlYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKEHVSRudWxsXxAPTlNLZXllZEFyY2hpdmVy0QoLVHJvb3SAAAgRGiMtMjc5P1FUWQAAAAAAAAEBAAAAAAAAAAwAAAAAAAAAAAAAAAAAAABb",
704
+ map_type: "Generic",
705
+ name: "Street",
706
+ url: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",
707
+ uuid: "00FCA57A-6F1B-4F74-84BD-E7A8B8BFF8FB"
708
+ },
709
+ history: [
710
+ //
711
+ {
712
+ entity_id: 9207,
713
+ entity_type: 14,
714
+ message: "(43) 2a72 start medical (Shared)",
715
+ time: 1554681941
716
+ }
717
+ ],
718
+ is_closed: 1,
719
+ location: "39.802526,-105.019773",
720
+ managed: "1",
721
+ modified_date: "2019-04-08T00:16:30.473", // Same as the modified_unix_date
722
+ modified_unix_date: 1554682590.47396,
723
+ name: "INJURED PARTY",
724
+ preference_location: "location",
725
+ slave_map_changed: false,
726
+ source: "cad",
727
+ start_time: "2019-04-08T00:05:41+0000",
728
+ start_unix_time: 1554681941,
729
+ units: [
730
+ //
731
+ {
732
+ UnitID: "M12",
733
+ active: 1,
734
+ air_time: "",
735
+ api_unit_dispatch_number: "5163322",
736
+ checked: 0,
737
+ column_position: 0,
738
+ group_position: 0,
739
+ incident_position: 0,
740
+ isSupervisor: false,
741
+ is_part_of_group: false,
742
+ location_on_image: "",
743
+ location_on_map: "",
744
+ modified_date: "2019-04-08T00:16:30+0000",
745
+ modified_unix_date: 1554682590.51667,
746
+ note: "",
747
+ personnelOnScene: 2,
748
+ status: "Arrived",
749
+ status_unix_date: 1554682217,
750
+ time: "",
751
+ warning: 0
752
+ }
753
+ ],
754
+ userId: "5b3e78cc944e2a18d5222424",
755
+ uuid: "579E2F47-7F63-4351-B41F-4A345D680B8F"
756
+ };
757
+
758
+ const monitor = {
759
+ _id: mongoose.Types.ObjectId(),
760
+ departmentId: "546ace2b3cd8d60d1d00256a",
761
+ agencyId: "123",
762
+ notificationType: "maps-token-error",
763
+ status: "active",
764
+ sentUnixDate: 1603263604
765
+ };
766
+
767
+ const rateLimit = {
768
+ _id: mongoose.Types.ObjectId(),
769
+ username: "test123",
770
+ modified_unix_date: 1426983552.49945,
771
+ count: 8
772
+ };
773
+
774
+ const session = {
775
+ when: "2019-04-01T04:41:38.509Z",
776
+ user: "51c2dcca0c599704e400001f",
777
+ email: "marius+cc@tabletcommand.com",
778
+ nick: "ztc-marcc",
779
+ deviceId: "7evAKaFiOeaWTlsMTOSQMBKN",
780
+ remoteAddress: "124.148.161.107",
781
+ userAgent: "TCMobile/1.6 (iPhone; iOS 12.1; Scale/2.00)",
782
+ why: "password",
783
+ departmentId: "51a2529293e11b3569000057",
784
+ source: "iphone.beta",
785
+ token: uuid.v4(),
786
+ active: false,
787
+ ended: "2019-04-01T04:41:39.233Z"
788
+ };
789
+
790
+ const template = {
791
+ position: 1,
792
+ active: true,
793
+ name: "Vertical Test",
794
+ userId: "1234",
795
+ departmentId: "4321",
796
+ isMandatory: false,
797
+ group: [],
798
+ checklist: [],
799
+ agencyId: new mongoose.Types.ObjectId(agency._id)
800
+ };
801
+
802
+ const user = {
803
+ _id: mongoose.Types.ObjectId(),
804
+ nick: "Test",
805
+ email: "test@save.me",
806
+ mapId: "TEST",
807
+ departmentId: "d123",
808
+ isPro: true,
809
+ agencyId: new mongoose.Types.ObjectId(agency._id),
810
+ managedAgencies: [new mongoose.Types.ObjectId(agency._id)],
811
+ shareLocationPhone: false,
812
+ shareLocationTablet: true,
813
+ notificationSounds: [
814
+ //
815
+ {
816
+ sound: "testSound.caf",
817
+ soundType: "default",
818
+ }
819
+ ],
820
+ offlineMapsEnabled: true,
821
+ offDutyEnabled: true,
822
+ webMapSettings: {
823
+ defaultZoomLevel: 10,
824
+ defaultCenter: [1,1],
825
+ defaultMap: "Default"
826
+ }
827
+ };
828
+
829
+ const userRegistration = {
830
+ email: "test@email.com",
831
+ name: "John Waters",
832
+ firstName: "John",
833
+ lastName: "Waters",
834
+ department: "New York City, NY",
835
+ title: "Mr",
836
+ modifiedDate: 1426983552.49945,
837
+ status: "registered",
838
+ stage: "afterEULA",
839
+ presentedAt: 1488157071.042124,
840
+ managedIncidentsCount: 1,
841
+ checklistsCount: 2,
842
+ firstIncidentUnixTime: 1443666043.380937,
843
+ lastIncidentLocation: "40.999357,-85.767932",
844
+ lastIncidentUnixTime: 1480525299.50968
845
+ };
846
+
847
+ const userDevice = {
848
+ userId: "1234",
849
+ departmentID: "4321",
850
+ devices: [
851
+ //
852
+ {
853
+ token: "de2687382a9df6a1165616aac",
854
+ env: "testmock",
855
+ ver: "TC Mobile v1.0 b23",
856
+ ua: "TCMobile/1.0 (iPhone; iOS 10.1.1; Scale/3.00)",
857
+ time: 1438627429.956,
858
+ drift: 1438627429.956,
859
+ bundleIdentifier: "com.testtesttest.TCMobile",
860
+ silentEnabled: true,
861
+ criticalAlertsEnabled: true,
862
+ session: "1234321",
863
+ active: true,
864
+ offDuty: false
865
+ }
866
+ ],
867
+ notificationCount: 12,
868
+ notificationUnitSettings: [
869
+ {
870
+ radioName: "B1",
871
+ notificationType: "NORMAL",
872
+ notificationMode: "ON DUTY"
873
+ }
874
+ ],
875
+ notificationIncidentSettings: [
876
+ {
877
+ incidentType: "Cliff Rescue",
878
+ notificationType: "NORMAL",
879
+ notificationMode: "ON DUTY"
880
+ }
881
+ ],
882
+ notificationSounds: {
883
+ ios: {
884
+ sound: "a.caf",
885
+ soundType: "default",
886
+ os: "ios"
887
+ },
888
+ android: {
889
+ sound: "b.mp3",
890
+ soundType: "default",
891
+ os: "android"
892
+ }
893
+ },
894
+ offDuty: true,
895
+ criticalAlertsVolume: "MED",
896
+ };
897
+
898
+ const personnelImport = {
899
+ _id: mongoose.Types.ObjectId(),
900
+ PersonnelID: "AM0111",
901
+ PersonnelName: "Test User",
902
+ PersonnelRank: "Eng",
903
+ PersonnelWorkCode: "abcd1234",
904
+ PersonnelNote: "A test user",
905
+ departmentId: "123zzz",
906
+ radioNames: ["M10", "Z1"],
907
+ shiftStartTime: 1559446299,
908
+ shiftStart: "2019-06-02T03:31:39.000Z",
909
+ shiftEndTime: 1569446299,
910
+ shiftEnd: "2019-09-25T21:18:19.000Z",
911
+ modified_unix_date: 1570446299,
912
+ modified: "2019-10-07T11:04:59.000Z",
913
+ active: true,
914
+ agencyCode: "TC",
915
+ agencyName: "Tablet Command",
916
+ importNotes: "test note"
917
+ };
918
+
919
+ const csvImport = {
920
+ _id: mongoose.Types.ObjectId(),
921
+ batchId: "AM0111",
922
+ departmentId: "1234",
923
+ agencyId: "abcd1234",
924
+ importType: "users",
925
+ fileType: "csv",
926
+ fileName: "test file 123",
927
+ fileSize: 800,
928
+ records: [],
929
+ userId: "4321",
930
+ status: "success",
931
+ sendNotification: false
932
+ };
933
+
934
+ async function cleanup() {
935
+ config.checkIfTestDatabase();
936
+
937
+ await models.CADVehicleStatus.deleteMany({});
938
+ await models.Esri.deleteMany({});
939
+ await models.IncidentNotified.deleteMany({});
940
+ await models.PersonnelImport.deleteMany({});
941
+ await models.UserDevice.deleteMany({});
942
+ await models.User.deleteMany({});
943
+ }
944
+
945
+ return {
946
+ actionLog,
947
+ agency,
948
+ assignment,
949
+ arcGISGroup,
950
+ battalion,
951
+ cadIncident,
952
+ cadStatus,
953
+ cadStatusMap,
954
+ cadVehicle,
955
+ cadVehicleStatus,
956
+ cadVehicleStatusHistory,
957
+ checklist,
958
+ checklistItem,
959
+ cleanup,
960
+ department,
961
+ deviceMapping,
962
+ esri,
963
+ gstMapping,
964
+ incidentEvent,
965
+ incidentNotified,
966
+ incidentTakeover,
967
+ location,
968
+ mailLog,
969
+ message,
970
+ managedIncident,
971
+ monitor,
972
+ personnelImport,
973
+ rateLimit,
974
+ session,
975
+ template,
976
+ user,
977
+ userDevice,
978
+ userRegistration,
979
+ csvImport
980
+ };
981
+ };
982
+ */