tabletcommand-backend-models 7.0.12 → 7.0.14
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/build/constants.js +14 -1
- package/build/constants.js.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/models/cad-incident-block.js +0 -6
- package/build/models/cad-incident-block.js.map +1 -1
- package/build/models/department.js +5 -0
- package/build/models/department.js.map +1 -1
- package/build/models/device-mapping.js +4 -0
- package/build/models/device-mapping.js.map +1 -1
- package/build/models/schema/cad-incident.js +1 -0
- package/build/models/schema/cad-incident.js.map +1 -1
- package/build/models/user.js +6 -1
- package/build/models/user.js.map +1 -1
- package/build/test/0index.js +72 -0
- package/build/test/0index.js.map +1 -0
- package/build/test/action-log.js +40 -0
- package/build/test/action-log.js.map +1 -0
- package/build/test/agency.js +41 -0
- package/build/test/agency.js.map +1 -0
- package/build/test/arcgis-group.js +48 -85
- package/build/test/arcgis-group.js.map +1 -1
- package/build/test/assignment.js +39 -0
- package/build/test/assignment.js.map +1 -0
- package/build/test/battalion.js +45 -0
- package/build/test/battalion.js.map +1 -0
- package/build/test/cad-incident-block.js +43 -0
- package/build/test/cad-incident-block.js.map +1 -0
- package/build/test/cad-incident.js +159 -0
- package/build/test/cad-incident.js.map +1 -0
- package/build/test/cad-simulation.js +32 -0
- package/build/test/cad-simulation.js.map +1 -0
- package/build/test/cad-status-map.js +41 -0
- package/build/test/cad-status-map.js.map +1 -0
- package/build/test/cad-status.js +57 -0
- package/build/test/cad-status.js.map +1 -0
- package/build/test/cad-vehicle-status-history.js +36 -0
- package/build/test/cad-vehicle-status-history.js.map +1 -0
- package/build/test/cad-vehicle-status.js +42 -0
- package/build/test/cad-vehicle-status.js.map +1 -0
- package/build/test/cad-vehicle.js +38 -0
- package/build/test/cad-vehicle.js.map +1 -0
- package/build/test/checklist-item.js +42 -0
- package/build/test/checklist-item.js.map +1 -0
- package/build/test/checklist.js +43 -0
- package/build/test/checklist.js.map +1 -0
- package/build/test/config.js +2 -1
- package/build/test/config.js.map +1 -1
- package/build/test/csv-import.js +44 -0
- package/build/test/csv-import.js.map +1 -0
- package/build/test/department.js +99 -0
- package/build/test/department.js.map +1 -0
- package/build/test/device-mapping.js +51 -0
- package/build/test/device-mapping.js.map +1 -0
- package/build/test/esri.js +67 -0
- package/build/test/esri.js.map +1 -0
- package/build/test/gst-mapping.js +37 -0
- package/build/test/gst-mapping.js.map +1 -0
- package/build/test/helpers.js +14 -0
- package/build/test/helpers.js.map +1 -0
- package/build/test/incident-event.js +52 -0
- package/build/test/incident-event.js.map +1 -0
- package/build/test/incident-notified.js +42 -0
- package/build/test/incident-notified.js.map +1 -0
- package/build/test/incident-takeover.js +38 -0
- package/build/test/incident-takeover.js.map +1 -0
- package/build/test/job-log.js +36 -0
- package/build/test/job-log.js.map +1 -0
- package/build/test/location.js +76 -0
- package/build/test/location.js.map +1 -0
- package/build/test/mail-log.js +52 -0
- package/build/test/mail-log.js.map +1 -0
- package/build/test/managed-incident.js +107 -0
- package/build/test/managed-incident.js.map +1 -0
- package/build/test/mark43-incident-retry.js +33 -0
- package/build/test/mark43-incident-retry.js.map +1 -0
- package/build/test/message.js +38 -0
- package/build/test/message.js.map +1 -0
- package/build/test/mock.js +1280 -910
- package/build/test/mock.js.map +1 -1
- package/build/test/monitor.js +34 -0
- package/build/test/monitor.js.map +1 -0
- package/build/test/personnel-import.js +55 -0
- package/build/test/personnel-import.js.map +1 -0
- package/build/test/rate-limit.js +32 -0
- package/build/test/rate-limit.js.map +1 -0
- package/build/test/release-note.js +34 -0
- package/build/test/release-note.js.map +1 -0
- package/build/test/session.js +42 -0
- package/build/test/session.js.map +1 -0
- package/build/test/template.js +43 -0
- package/build/test/template.js.map +1 -0
- package/build/test/user-device.js +69 -0
- package/build/test/user-device.js.map +1 -0
- package/build/test/user-registration.js +44 -0
- package/build/test/user-registration.js.map +1 -0
- package/build/test/user.js +51 -0
- package/build/test/user.js.map +1 -0
- package/build/test/validation-report.js +33 -0
- package/build/test/validation-report.js.map +1 -0
- package/cspell.json +11 -8
- package/definitions/constants.d.ts +11 -0
- package/definitions/constants.d.ts.map +1 -1
- package/definitions/index.d.ts +2 -2
- package/definitions/index.d.ts.map +1 -1
- package/definitions/models/cad-incident-block.d.ts.map +1 -1
- package/definitions/models/department.d.ts.map +1 -1
- package/definitions/models/device-mapping.d.ts.map +1 -1
- package/definitions/models/schema/cad-incident.d.ts.map +1 -1
- package/definitions/models/user.d.ts.map +1 -1
- package/definitions/test/0index.d.ts +2 -0
- package/definitions/test/0index.d.ts.map +1 -0
- package/definitions/test/action-log.d.ts +2 -0
- package/definitions/test/action-log.d.ts.map +1 -0
- package/definitions/test/agency.d.ts +2 -0
- package/definitions/test/agency.d.ts.map +1 -0
- package/definitions/test/arcgis-group.d.ts.map +1 -1
- package/definitions/test/assignment.d.ts +2 -0
- package/definitions/test/assignment.d.ts.map +1 -0
- package/definitions/test/battalion.d.ts +2 -0
- package/definitions/test/battalion.d.ts.map +1 -0
- package/definitions/test/cad-incident-block.d.ts +2 -0
- package/definitions/test/cad-incident-block.d.ts.map +1 -0
- package/definitions/test/cad-incident.d.ts +2 -0
- package/definitions/test/cad-incident.d.ts.map +1 -0
- package/definitions/test/cad-simulation.d.ts +2 -0
- package/definitions/test/cad-simulation.d.ts.map +1 -0
- package/definitions/test/cad-status-map.d.ts +2 -0
- package/definitions/test/cad-status-map.d.ts.map +1 -0
- package/definitions/test/cad-status.d.ts +2 -0
- package/definitions/test/cad-status.d.ts.map +1 -0
- package/definitions/test/cad-vehicle-status-history.d.ts +2 -0
- package/definitions/test/cad-vehicle-status-history.d.ts.map +1 -0
- package/definitions/test/cad-vehicle-status.d.ts +2 -0
- package/definitions/test/cad-vehicle-status.d.ts.map +1 -0
- package/definitions/test/cad-vehicle.d.ts +2 -0
- package/definitions/test/cad-vehicle.d.ts.map +1 -0
- package/definitions/test/checklist-item.d.ts +2 -0
- package/definitions/test/checklist-item.d.ts.map +1 -0
- package/definitions/test/checklist.d.ts +2 -0
- package/definitions/test/checklist.d.ts.map +1 -0
- package/definitions/test/config.d.ts.map +1 -1
- package/definitions/test/csv-import.d.ts +2 -0
- package/definitions/test/csv-import.d.ts.map +1 -0
- package/definitions/test/department.d.ts +2 -0
- package/definitions/test/department.d.ts.map +1 -0
- package/definitions/test/device-mapping.d.ts +2 -0
- package/definitions/test/device-mapping.d.ts.map +1 -0
- package/definitions/test/esri.d.ts +2 -0
- package/definitions/test/esri.d.ts.map +1 -0
- package/definitions/test/gst-mapping.d.ts +2 -0
- package/definitions/test/gst-mapping.d.ts.map +1 -0
- package/definitions/test/helpers.d.ts +2 -0
- package/definitions/test/helpers.d.ts.map +1 -0
- package/definitions/test/incident-event.d.ts +2 -0
- package/definitions/test/incident-event.d.ts.map +1 -0
- package/definitions/test/incident-notified.d.ts +2 -0
- package/definitions/test/incident-notified.d.ts.map +1 -0
- package/definitions/test/incident-takeover.d.ts +2 -0
- package/definitions/test/incident-takeover.d.ts.map +1 -0
- package/definitions/test/job-log.d.ts +2 -0
- package/definitions/test/job-log.d.ts.map +1 -0
- package/definitions/test/location.d.ts +2 -0
- package/definitions/test/location.d.ts.map +1 -0
- package/definitions/test/mail-log.d.ts +2 -0
- package/definitions/test/mail-log.d.ts.map +1 -0
- package/definitions/test/managed-incident.d.ts +2 -0
- package/definitions/test/managed-incident.d.ts.map +1 -0
- package/definitions/test/mark43-incident-retry.d.ts +2 -0
- package/definitions/test/mark43-incident-retry.d.ts.map +1 -0
- package/definitions/test/message.d.ts +2 -0
- package/definitions/test/message.d.ts.map +1 -0
- package/definitions/test/mock.d.ts +1056 -3
- package/definitions/test/mock.d.ts.map +1 -1
- package/definitions/test/monitor.d.ts +2 -0
- package/definitions/test/monitor.d.ts.map +1 -0
- package/definitions/test/personnel-import.d.ts +2 -0
- package/definitions/test/personnel-import.d.ts.map +1 -0
- package/definitions/test/rate-limit.d.ts +2 -0
- package/definitions/test/rate-limit.d.ts.map +1 -0
- package/definitions/test/release-note.d.ts +2 -0
- package/definitions/test/release-note.d.ts.map +1 -0
- package/definitions/test/session.d.ts +2 -0
- package/definitions/test/session.d.ts.map +1 -0
- package/definitions/test/template.d.ts +2 -0
- package/definitions/test/template.d.ts.map +1 -0
- package/definitions/test/user-device.d.ts +2 -0
- package/definitions/test/user-device.d.ts.map +1 -0
- package/definitions/test/user-registration.d.ts +2 -0
- package/definitions/test/user-registration.d.ts.map +1 -0
- package/definitions/test/user.d.ts +2 -0
- package/definitions/test/user.d.ts.map +1 -0
- package/definitions/test/validation-report.d.ts +2 -0
- package/definitions/test/validation-report.d.ts.map +1 -0
- package/definitions/types/cad.d.ts +2 -4
- package/definitions/types/cad.d.ts.map +1 -1
- package/definitions/types/department.d.ts +1 -0
- package/definitions/types/department.d.ts.map +1 -1
- package/definitions/types/user.d.ts +39 -38
- package/definitions/types/user.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/constants.ts +13 -0
- package/src/index.ts +4 -0
- package/src/models/cad-incident-block.ts +0 -10
- package/src/models/department.ts +6 -0
- package/src/models/device-mapping.ts +4 -0
- package/src/models/schema/cad-incident.ts +2 -0
- package/src/models/user.ts +7 -1
- package/src/test/0index.ts +71 -0
- package/src/test/action-log.ts +41 -0
- package/src/test/agency.ts +41 -0
- package/src/test/arcgis-group.ts +25 -63
- package/src/test/assignment.ts +41 -0
- package/src/test/battalion.ts +45 -0
- package/src/test/cad-incident-block.ts +44 -0
- package/src/test/cad-incident.ts +168 -0
- package/src/test/cad-simulation.ts +33 -0
- package/src/test/cad-status-map.ts +41 -0
- package/src/test/cad-status.ts +57 -0
- package/src/test/cad-vehicle-status-history.ts +37 -0
- package/src/test/cad-vehicle-status.ts +43 -0
- package/src/test/cad-vehicle.ts +38 -0
- package/src/test/checklist-item.ts +43 -0
- package/src/test/checklist.ts +44 -0
- package/src/test/config.ts +3 -3
- package/src/test/csv-import.ts +44 -0
- package/src/test/department.ts +95 -0
- package/src/test/device-mapping.ts +53 -0
- package/src/test/esri.ts +69 -0
- package/src/test/gst-mapping.ts +38 -0
- package/src/test/helpers.ts +15 -0
- package/src/test/incident-event.ts +53 -0
- package/src/test/incident-notified.ts +41 -0
- package/src/test/incident-takeover.ts +39 -0
- package/src/test/job-log.ts +37 -0
- package/src/test/location.ts +79 -0
- package/src/test/mail-log.ts +51 -0
- package/src/test/managed-incident.ts +116 -0
- package/src/test/mark43-incident-retry.ts +34 -0
- package/src/test/message.ts +39 -0
- package/src/test/mock.ts +590 -163
- package/src/test/monitor.ts +35 -0
- package/src/test/personnel-import.ts +55 -0
- package/src/test/rate-limit.ts +33 -0
- package/src/test/release-note.ts +36 -0
- package/src/test/session.ts +43 -0
- package/src/test/template.ts +44 -0
- package/src/test/user-device.ts +66 -0
- package/src/test/user-registration.ts +45 -0
- package/src/test/user.ts +51 -0
- package/src/test/validation-report.ts +33 -0
- package/src/tsconfig.json +13 -3
- package/src/types/cad.ts +2 -4
- package/src/types/department.ts +1 -0
- package/src/types/user.ts +40 -39
- package/tslint.json +0 -28
- /package/{test → test-legacy}/0index.js +0 -0
- /package/{test → test-legacy}/action-log.js +0 -0
- /package/{test → test-legacy}/agency.js +0 -0
- /package/{test → test-legacy}/arcgis-group.js +0 -0
- /package/{test → test-legacy}/assignment.js +0 -0
- /package/{test → test-legacy}/battalion.js +0 -0
- /package/{test → test-legacy}/cad-incident-block.js +0 -0
- /package/{test → test-legacy}/cad-incident.js +0 -0
- /package/{test → test-legacy}/cad-simulation.js +0 -0
- /package/{test → test-legacy}/cad-status-map.js +0 -0
- /package/{test → test-legacy}/cad-status.js +0 -0
- /package/{test → test-legacy}/cad-vehicle-status-history.js +0 -0
- /package/{test → test-legacy}/cad-vehicle-status.js +0 -0
- /package/{test → test-legacy}/cad-vehicle.js +0 -0
- /package/{test → test-legacy}/checklist-item.js +0 -0
- /package/{test → test-legacy}/checklist.js +0 -0
- /package/{test → test-legacy}/config.js +0 -0
- /package/{test → test-legacy}/csv-import.js +0 -0
- /package/{test → test-legacy}/department.js +0 -0
- /package/{test → test-legacy}/device-mapping.js +0 -0
- /package/{test → test-legacy}/esri.js +0 -0
- /package/{test → test-legacy}/gst-mapping.js +0 -0
- /package/{test → test-legacy}/helpers.js +0 -0
- /package/{test → test-legacy}/incident-event.js +0 -0
- /package/{test → test-legacy}/incident-notified.js +0 -0
- /package/{test → test-legacy}/incident-takeover.js +0 -0
- /package/{test → test-legacy}/job-log.js +0 -0
- /package/{test → test-legacy}/location.js +0 -0
- /package/{test → test-legacy}/mail-log.js +0 -0
- /package/{test → test-legacy}/managed-incident.js +0 -0
- /package/{test → test-legacy}/mark43-incident-retry.js +0 -0
- /package/{test → test-legacy}/message.js +0 -0
- /package/{test → test-legacy}/mock.js +0 -0
- /package/{test → test-legacy}/monitor.js +0 -0
- /package/{test → test-legacy}/personnel-import.js +0 -0
- /package/{test → test-legacy}/rate-limit.js +0 -0
- /package/{test → test-legacy}/release-note.js +0 -0
- /package/{test → test-legacy}/session.js +0 -0
- /package/{test → test-legacy}/template.js +0 -0
- /package/{test → test-legacy}/user-device.js +0 -0
- /package/{test → test-legacy}/user-registration.js +0 -0
- /package/{test → test-legacy}/user.js +0 -0
- /package/{test → test-legacy}/validation-report.js +0 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("Monitor", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.Monitor>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.monitor;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("is saved", async function() {
|
25
|
+
const item = new models.Monitor(testItem);
|
26
|
+
const sut = await item.save();
|
27
|
+
assert.isNotNull(sut._id);
|
28
|
+
|
29
|
+
assert.equal(testItem.departmentId, sut.departmentId);
|
30
|
+
assert.equal(testItem.agencyId, sut.agencyId);
|
31
|
+
assert.equal(testItem.notificationType, sut.notificationType);
|
32
|
+
assert.equal(testItem.status, sut.status);
|
33
|
+
assert.equal(testItem.sentUnixDate, sut.sentUnixDate);
|
34
|
+
});
|
35
|
+
});
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("PersonnelImport", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.PersonnelImport>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.personnelImport;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
|
25
|
+
it("is saved", async function() {
|
26
|
+
const item = new models.PersonnelImport(testItem);
|
27
|
+
const sut = await item.save();
|
28
|
+
assert.equal(testItem._id, sut._id);
|
29
|
+
assert.equal(testItem.PersonnelID, sut.PersonnelID);
|
30
|
+
assert.equal(testItem.PersonnelName, sut.PersonnelName);
|
31
|
+
assert.equal(testItem.PersonnelRank, sut.PersonnelRank);
|
32
|
+
assert.equal(testItem.PersonnelWorkCode, sut.PersonnelWorkCode);
|
33
|
+
assert.equal(testItem.PersonnelNote, sut.PersonnelNote);
|
34
|
+
assert.equal(testItem.departmentId, sut.departmentId);
|
35
|
+
if (testItem.radioNames?.length) {
|
36
|
+
assert.equal(testItem.radioNames[0], sut.radioNames[0]);
|
37
|
+
assert.equal(testItem.radioNames[1], sut.radioNames[1]);
|
38
|
+
} else {
|
39
|
+
assert.equal(testItem.radioNames?.length, 1);
|
40
|
+
}
|
41
|
+
assert.equal(sut.radioNames.length, 2);
|
42
|
+
assert.equal(testItem.shiftStartTime, sut.shiftStartTime);
|
43
|
+
assert.equal(testItem.shiftEndTime, sut.shiftEndTime);
|
44
|
+
assert.equal(testItem.modified_unix_date, sut.modified_unix_date);
|
45
|
+
assert.equal(testItem.active, sut.active);
|
46
|
+
assert.equal(testItem.agencyName, sut.agencyName);
|
47
|
+
assert.equal(testItem.agencyCode, sut.agencyCode);
|
48
|
+
assert.equal(testItem.agencyId, sut.agencyId);
|
49
|
+
assert.equal(testItem.importNotes, sut.importNotes);
|
50
|
+
assert.equal(testItem.modified?.toISOString(), sut.modified.toISOString());
|
51
|
+
assert.equal(testItem.shiftStart?.toISOString(), sut.shiftStart.toISOString());
|
52
|
+
assert.equal(testItem.shiftEnd?.toISOString(), sut.shiftEnd.toISOString());
|
53
|
+
});
|
54
|
+
});
|
55
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("RateLimit", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.RateLimit>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.rateLimit;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("is saved", async function() {
|
25
|
+
const item = new models.RateLimit(testItem);
|
26
|
+
const sut = await item.save();
|
27
|
+
|
28
|
+
assert.isNotNull(testItem._id);
|
29
|
+
assert.equal(sut.username, testItem.username);
|
30
|
+
assert.equal(sut.modified_unix_date, testItem.modified_unix_date);
|
31
|
+
assert.equal(sut.count, testItem.count);
|
32
|
+
});
|
33
|
+
});
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("ReleaseNote", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.ReleaseNote>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.releaseNote;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
|
25
|
+
it("is saved", async function() {
|
26
|
+
const item = new models.ReleaseNote(testItem);
|
27
|
+
const sut = await item.save();
|
28
|
+
|
29
|
+
assert.isNotNull(testItem._id);
|
30
|
+
assert.equal(testItem.title, sut.title);
|
31
|
+
assert.equal(testItem.notes, sut.notes);
|
32
|
+
assert.equal(testItem.version, sut.version);
|
33
|
+
assert.equal(testItem.releaseDate, sut.releaseDate);
|
34
|
+
assert.equal(testItem.status, sut.status);
|
35
|
+
});
|
36
|
+
});
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("Session", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.Session>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.session;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("is saved", async function() {
|
25
|
+
const item = new models.Session(testItem);
|
26
|
+
const sut = await item.save();
|
27
|
+
|
28
|
+
assert.isNotNull(testItem._id);
|
29
|
+
assert.equal(sut.user, testItem.user);
|
30
|
+
assert.equal(sut.email, testItem.email);
|
31
|
+
assert.equal(sut.nick, testItem.nick);
|
32
|
+
assert.isFalse(sut.active);
|
33
|
+
assert.equal(sut.deviceId, testItem.deviceId);
|
34
|
+
assert.equal(sut.remoteAddress, testItem.remoteAddress);
|
35
|
+
assert.equal(sut.userAgent, testItem.userAgent);
|
36
|
+
assert.equal(sut.source, testItem.source);
|
37
|
+
assert.equal(sut.token, testItem.token);
|
38
|
+
assert.equal(sut.ended, testItem.ended);
|
39
|
+
assert.equal(sut.departmentId, testItem.departmentId);
|
40
|
+
assert.equal(sut.when, testItem.when);
|
41
|
+
assert.equal(sut.id, sut._id);
|
42
|
+
});
|
43
|
+
});
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("Template", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.Template>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.template;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("is saved", async function() {
|
25
|
+
const item = new models.Template(testItem);
|
26
|
+
const sut = await item.save();
|
27
|
+
|
28
|
+
assert.isNotNull(item._id);
|
29
|
+
assert.equal(item._id, sut.id);
|
30
|
+
assert.equal(sut.id, sut._id);
|
31
|
+
assert.equal(testItem.position, sut.position);
|
32
|
+
assert.equal(testItem.active, sut.active);
|
33
|
+
assert.equal(testItem.name, sut.name);
|
34
|
+
assert.equal(testItem.userId, sut.userId);
|
35
|
+
assert.equal(testItem.departmentId, sut.departmentId);
|
36
|
+
assert.equal(testItem.isMandatory, sut.isMandatory);
|
37
|
+
assert.isArray(testItem.group);
|
38
|
+
assert.isArray(testItem.checklist);
|
39
|
+
assert.equal(testItem.agencyId, sut.agencyId);
|
40
|
+
const expectedDate = new Date().valueOf() / 1000.0;
|
41
|
+
const timeDelta = expectedDate - sut.modified_unix_date;
|
42
|
+
assert.isTrue(timeDelta < 1);
|
43
|
+
});
|
44
|
+
});
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("UserDevice", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.UserDevice>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.userDevice;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("is saved", async function() {
|
25
|
+
const item = new models.UserDevice(testItem);
|
26
|
+
const sut = await item.save();
|
27
|
+
|
28
|
+
assert.isNotNull(testItem._id);
|
29
|
+
assert.equal(sut.id, sut._id);
|
30
|
+
assert.equal(testItem.userId, sut.userId);
|
31
|
+
assert.equal(testItem.departmentId, sut.departmentId);
|
32
|
+
assert.equal(sut.devices.length, 1);
|
33
|
+
if (testItem.devices?.length) {
|
34
|
+
assert.equal(testItem.devices[0]?.token, sut.devices[0]?.token);
|
35
|
+
assert.equal(testItem.devices[0]?.env, sut.devices[0]?.env);
|
36
|
+
assert.equal(testItem.devices[0]?.ua, sut.devices[0]?.ua);
|
37
|
+
assert.equal(testItem.devices[0]?.time, sut.devices[0]?.time);
|
38
|
+
assert.equal(testItem.devices[0]?.drift, sut.devices[0]?.drift);
|
39
|
+
assert.equal(testItem.devices[0]?.bundleIdentifier, sut.devices[0]?.bundleIdentifier);
|
40
|
+
assert.equal(testItem.devices[0]?.silentEnabled, sut.devices[0]?.silentEnabled);
|
41
|
+
assert.equal(testItem.devices[0]?.criticalAlertsEnabled, sut.devices[0]?.criticalAlertsEnabled);
|
42
|
+
assert.equal(testItem.devices[0]?.session, sut.devices[0]?.session);
|
43
|
+
assert.equal(testItem.devices[0]?.active, sut.devices[0]?.active);
|
44
|
+
assert.equal(testItem.devices[0]?.offDuty, sut.devices[0]?.offDuty);
|
45
|
+
} else {
|
46
|
+
assert.equal(testItem.devices?.length, 1);
|
47
|
+
}
|
48
|
+
assert.equal(testItem.notificationCount, sut.notificationCount);
|
49
|
+
if (testItem.notificationIncidentSettings?.length) {
|
50
|
+
assert.equal(JSON.stringify(testItem.notificationIncidentSettings[0]), JSON.stringify(sut.notificationIncidentSettings[0]));
|
51
|
+
} else {
|
52
|
+
assert.equal(testItem.notificationIncidentSettings?.length, 1);
|
53
|
+
}
|
54
|
+
if (testItem.notificationUnitSettings?.length) {
|
55
|
+
assert.equal(JSON.stringify(testItem.notificationUnitSettings[0]), JSON.stringify(sut.notificationUnitSettings[0]));
|
56
|
+
} else {
|
57
|
+
assert.equal(testItem.notificationUnitSettings?.length, 1);
|
58
|
+
}
|
59
|
+
assert.equal(testItem.offDuty, true);
|
60
|
+
assert.equal(testItem.criticalAlertsVolume, "MED");
|
61
|
+
assert.isObject(sut.notificationSounds);
|
62
|
+
assert.deepEqual(sut.notificationSounds, item.notificationSounds);
|
63
|
+
assert.isObject(sut.notificationSounds.ios);
|
64
|
+
assert.isObject(sut.notificationSounds.android);
|
65
|
+
});
|
66
|
+
});
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("UserRegistration", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.UserRegistration>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.userRegistration;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("is saved", async function() {
|
25
|
+
const item = new models.UserRegistration(testItem);
|
26
|
+
const sut = await item.save();
|
27
|
+
|
28
|
+
assert.isNotNull(sut._id);
|
29
|
+
assert.equal(sut.id, sut._id);
|
30
|
+
assert.equal(testItem.email, sut.email);
|
31
|
+
assert.equal(testItem.name, sut.name);
|
32
|
+
assert.equal(testItem.firstName, sut.firstName);
|
33
|
+
assert.equal(testItem.lastName, sut.lastName);
|
34
|
+
assert.equal(testItem.department, sut.department);
|
35
|
+
assert.equal(testItem.title, sut.title);
|
36
|
+
assert.equal(testItem.modifiedDate, sut.modifiedDate);
|
37
|
+
assert.equal(testItem.stage, sut.stage);
|
38
|
+
assert.equal(testItem.presentedAt, sut.presentedAt);
|
39
|
+
assert.equal(testItem.managedIncidentsCount, sut.managedIncidentsCount);
|
40
|
+
assert.equal(testItem.checklistsCount, sut.checklistsCount);
|
41
|
+
assert.equal(testItem.firstIncidentUnixTime, sut.firstIncidentUnixTime);
|
42
|
+
assert.equal(testItem.lastIncidentLocation, sut.lastIncidentLocation);
|
43
|
+
assert.equal(testItem.lastIncidentUnixTime, sut.lastIncidentUnixTime);
|
44
|
+
});
|
45
|
+
});
|
package/src/test/user.ts
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import * as m from "../index";
|
3
|
+
import * as config from "./config";
|
4
|
+
import mockModule from "./mock";
|
5
|
+
|
6
|
+
describe("User", function() {
|
7
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
8
|
+
let testItem: Partial<m.User>;
|
9
|
+
beforeEach(async function() {
|
10
|
+
const c = await m.connect(config.url);
|
11
|
+
models = c.models;
|
12
|
+
mongoose = c.mongoose;
|
13
|
+
|
14
|
+
const mock = mockModule({
|
15
|
+
mongoose
|
16
|
+
});
|
17
|
+
testItem = mock.user;
|
18
|
+
});
|
19
|
+
afterEach(async function() {
|
20
|
+
await mongoose.disconnect();
|
21
|
+
});
|
22
|
+
|
23
|
+
it("is saved", async function() {
|
24
|
+
const item = new models.User(testItem);
|
25
|
+
const sut = await item.save();
|
26
|
+
assert.isNotNull(sut.uuid);
|
27
|
+
assert.isNotNull(testItem._id);
|
28
|
+
assert.equal(sut.nick, testItem.nick);
|
29
|
+
assert.equal(sut.email, testItem.email);
|
30
|
+
assert.equal(sut.mapId, testItem.mapId);
|
31
|
+
assert.equal(sut.departmentId, testItem.departmentId);
|
32
|
+
assert.isFalse(sut.active);
|
33
|
+
assert.isFalse(sut.admin);
|
34
|
+
assert.isFalse(sut.superuser);
|
35
|
+
assert.isTrue(sut.isPro);
|
36
|
+
assert.isTrue(sut.mobileAccess);
|
37
|
+
assert.isFalse(sut.webAccess);
|
38
|
+
assert.isFalse(sut.shareLocationPhone);
|
39
|
+
assert.isTrue(sut.shareLocationTablet);
|
40
|
+
assert.equal(item.uuid, sut.uuid);
|
41
|
+
assert.equal(item.agencyId, sut.agencyId);
|
42
|
+
assert.equal(item.offDutyEnabled, sut.offDutyEnabled);
|
43
|
+
assert.equal(item.managedAgencies[0], sut.managedAgencies[0]);
|
44
|
+
assert.isTrue(sut.offlineMapsEnabled);
|
45
|
+
assert.equal(item.webMapSettings.defaultZoomLevel, 10);
|
46
|
+
assert.equal(item.webMapSettings.defaultCenter[0], 1);
|
47
|
+
assert.equal(item.webMapSettings.defaultCenter[1], 1);
|
48
|
+
assert.equal(item.webMapSettings.defaultMap, "Default");
|
49
|
+
assert.equal(item.restrictedCommentsEnabled, true);
|
50
|
+
});
|
51
|
+
});
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { assert } from "chai";
|
2
|
+
import "mocha";
|
3
|
+
import * as m from "../index";
|
4
|
+
import * as config from "./config";
|
5
|
+
import mockModule from "./mock";
|
6
|
+
|
7
|
+
describe("ValidationReport", function() {
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
9
|
+
let testItem: Partial<m.ValidationReport>;
|
10
|
+
beforeEach(async function() {
|
11
|
+
const c = await m.connect(config.url);
|
12
|
+
models = c.models;
|
13
|
+
mongoose = c.mongoose;
|
14
|
+
|
15
|
+
const mock = mockModule({
|
16
|
+
mongoose
|
17
|
+
});
|
18
|
+
testItem = mock.validationReport;
|
19
|
+
});
|
20
|
+
afterEach(async function() {
|
21
|
+
await mongoose.disconnect();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("is saved", async function() {
|
25
|
+
const item = new models.ValidationReport(testItem);
|
26
|
+
const sut = await item.save();
|
27
|
+
|
28
|
+
assert.isNotNull(item._id);
|
29
|
+
assert.equal(testItem.departmentId?.toString(), sut.departmentId.toString());
|
30
|
+
assert.equal(testItem.modified?.toString(), sut.modified.toString());
|
31
|
+
assert.deepEqual(testItem.location, []);
|
32
|
+
});
|
33
|
+
});
|
package/src/tsconfig.json
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
|
+
"baseUrl": "./",
|
3
4
|
"declaration": true,
|
4
5
|
"declarationDir": "../definitions",
|
5
6
|
"declarationMap": true,
|
@@ -10,12 +11,21 @@
|
|
10
11
|
"noImplicitAny": true,
|
11
12
|
"noImplicitReturns": true,
|
12
13
|
"noUncheckedIndexedAccess": true,
|
14
|
+
"noUnusedLocals": true,
|
13
15
|
"outDir": "../build",
|
14
|
-
"
|
16
|
+
"paths": {
|
17
|
+
"*": [
|
18
|
+
"../node_modules/@types/*",
|
19
|
+
"*"
|
20
|
+
]
|
21
|
+
},
|
15
22
|
"resolveJsonModule": true,
|
16
23
|
"sourceMap": true,
|
17
24
|
"strict": true,
|
18
25
|
"target": "es2017",
|
19
|
-
|
26
|
+
"types": [
|
27
|
+
"node",
|
28
|
+
"mocha"
|
29
|
+
]
|
20
30
|
}
|
21
|
-
}
|
31
|
+
}
|
package/src/types/cad.ts
CHANGED
@@ -67,7 +67,7 @@ export interface CADVehicleStatusHistoryType {
|
|
67
67
|
locationDestination: string,
|
68
68
|
}
|
69
69
|
|
70
|
-
export interface StatusOptionValueType {
|
70
|
+
export interface StatusOptionValueType extends Record<string, unknown> {
|
71
71
|
name: string,
|
72
72
|
type: string,
|
73
73
|
visible: boolean,
|
@@ -100,7 +100,7 @@ export interface CADStatusType {
|
|
100
100
|
normalized: string,
|
101
101
|
selfAssignable: boolean,
|
102
102
|
roaming: boolean,
|
103
|
-
options:
|
103
|
+
options: StatusOptionType[],
|
104
104
|
color: ColorSchemaType,
|
105
105
|
backupDate: Date,
|
106
106
|
}
|
@@ -202,7 +202,6 @@ export interface CADSimulationType {
|
|
202
202
|
|
203
203
|
export interface CADIncidentStreamType {
|
204
204
|
_id: Types.ObjectId,
|
205
|
-
id?: string,
|
206
205
|
uuid: string,
|
207
206
|
tag: string,
|
208
207
|
departmentId: string,
|
@@ -213,7 +212,6 @@ export interface CADIncidentStreamType {
|
|
213
212
|
|
214
213
|
export interface CADIncidentBlockType {
|
215
214
|
_id: Types.ObjectId,
|
216
|
-
id?: string,
|
217
215
|
departmentId: string,
|
218
216
|
source: string,
|
219
217
|
IncidentNumber: string,
|
package/src/types/department.ts
CHANGED
package/src/types/user.ts
CHANGED
@@ -7,6 +7,7 @@ export interface UnitSettingType {
|
|
7
7
|
notificationType: string,
|
8
8
|
notificationMode: string,
|
9
9
|
}
|
10
|
+
|
10
11
|
export interface IncidentSettingType {
|
11
12
|
incidentType: string,
|
12
13
|
notificationType: string,
|
@@ -76,7 +77,6 @@ export interface UserRegistrationType {
|
|
76
77
|
syncedToHubSpot: boolean,
|
77
78
|
}
|
78
79
|
|
79
|
-
|
80
80
|
export interface VehicleSchemaType {
|
81
81
|
radioName: string,
|
82
82
|
vehicleId: string,
|
@@ -84,57 +84,58 @@ export interface VehicleSchemaType {
|
|
84
84
|
|
85
85
|
export interface UserType {
|
86
86
|
_id: Types.ObjectId,
|
87
|
-
id?: string,
|
88
|
-
nick: string,
|
89
|
-
email: string,
|
90
|
-
name: string,
|
91
|
-
uuid: string,
|
92
|
-
departmentId: string,
|
93
|
-
modified_date: Date,
|
94
|
-
when: Date,
|
95
|
-
agencyId: Types.ObjectId,
|
96
|
-
managedAgencies: Types.ObjectId[],
|
97
87
|
active: boolean,
|
98
88
|
admin: boolean,
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
webAccess: boolean,
|
104
|
-
cadSimulatorAccess: boolean,
|
105
|
-
canAddRemoveVehicle: boolean,
|
89
|
+
agencyId: Types.ObjectId,
|
90
|
+
arcGISAuth: EsriAuthSchemaType,
|
91
|
+
arcGISAuthError: EsriErrorSchemaType,
|
92
|
+
auth: string[],
|
106
93
|
beaconEnabled: boolean,
|
107
|
-
userContributionEnabled: boolean,
|
108
|
-
syncLoggingExpireDate: Date,
|
109
94
|
beacons: string[],
|
110
|
-
|
111
|
-
|
112
|
-
|
95
|
+
cadSimulatorAccess: boolean,
|
96
|
+
canAddRemoveVehicle: boolean,
|
97
|
+
departmentId: string,
|
98
|
+
email: string,
|
99
|
+
fireMapperProEnabled: boolean,
|
100
|
+
id?: string,
|
101
|
+
isIncidentManager: boolean,
|
102
|
+
isPro: boolean,
|
103
|
+
locationToCAD: boolean,
|
104
|
+
logOffEnabled: boolean,
|
105
|
+
managedAgencies: Types.ObjectId[],
|
113
106
|
mapHidden: boolean,
|
114
107
|
mapId: string,
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
108
|
+
mobileAccess: boolean,
|
109
|
+
modified_date: Date,
|
110
|
+
name: string,
|
111
|
+
nick: string,
|
112
|
+
offDutyEnabled: boolean,
|
113
|
+
offlineMapsEnabled: boolean,
|
114
|
+
pass: string,
|
119
115
|
pubNubV2: PubNubTokenSchemaType
|
120
116
|
pubNubV3: PubNubTokenSchemaType
|
117
|
+
restrictedCommentsEnabled: boolean,
|
118
|
+
rtsAuthKey: string,
|
119
|
+
salt: string,
|
120
|
+
sessionCountiPad: number,
|
121
|
+
sessionCountiPhone: number,
|
122
|
+
shareLocationPhone: boolean,
|
123
|
+
shareLocationTablet: boolean,
|
121
124
|
socketIO: PubNubTokenSchemaType,
|
125
|
+
stealthStatus: string, // UserStealthStatus
|
126
|
+
superuser: boolean,
|
127
|
+
superUserReadOnly: boolean
|
128
|
+
syncLoggingExpireDate: Date,
|
122
129
|
token: string,
|
123
130
|
tokenExpireAt: Date,
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
arcGISAuthError: EsriErrorSchemaType,
|
130
|
-
offDutyEnabled: boolean,
|
131
|
+
userContributionEnabled: boolean,
|
132
|
+
uuid: string,
|
133
|
+
vehicle: VehicleSchemaType,
|
134
|
+
webAccess: boolean,
|
135
|
+
when: Date,
|
131
136
|
webMapSettings: {
|
132
|
-
defaultZoomLevel: number,
|
133
137
|
defaultCenter: number[],
|
134
138
|
defaultMap: string,
|
139
|
+
defaultZoomLevel: number,
|
135
140
|
},
|
136
|
-
locationToCAD: boolean,
|
137
|
-
logOffEnabled: boolean,
|
138
|
-
restrictedCommentsEnabled: boolean,
|
139
|
-
superUserReadOnly: boolean
|
140
141
|
}
|
package/tslint.json
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"defaultSeverity": "error",
|
3
|
-
"extends": [
|
4
|
-
"tslint:recommended"
|
5
|
-
],
|
6
|
-
"linterOptions": {
|
7
|
-
"exclude": ["package.json"]
|
8
|
-
},
|
9
|
-
"jsRules": {},
|
10
|
-
"rules": {
|
11
|
-
"quotemark": [true, "double"],
|
12
|
-
"no-var-requires": true,
|
13
|
-
"ordered-imports": false,
|
14
|
-
"object-literal-sort-keys":false,
|
15
|
-
"only-arrow-functions": false,
|
16
|
-
"no-namespace":false,
|
17
|
-
"interface-name":false,
|
18
|
-
"no-shadowed-variable":false,
|
19
|
-
"no-console":false,
|
20
|
-
"no-any": true,
|
21
|
-
"no-unsafe-any":true,
|
22
|
-
"max-line-length":false,
|
23
|
-
"radix":false,
|
24
|
-
"no-floating-promises": true,
|
25
|
-
"no-trailing-whitespace": true
|
26
|
-
},
|
27
|
-
"rulesDirectory": []
|
28
|
-
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|