tabletcommand-backend-models 7.4.114 → 7.4.116
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 +3 -0
- package/build/constants.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/models/department.js +41 -2
- package/build/models/department.js.map +1 -1
- package/build/test/department.js +168 -0
- package/build/test/department.js.map +1 -1
- package/build/test/drone-connection.js +38 -0
- package/build/test/drone-connection.js.map +1 -1
- package/build/types/department.js.map +1 -1
- package/cspell.json +1 -0
- package/definitions/constants.d.ts +4 -1
- package/definitions/constants.d.ts.map +1 -1
- package/definitions/index.d.ts +1 -1
- package/definitions/index.d.ts.map +1 -1
- package/definitions/models/department.d.ts +3 -4
- package/definitions/models/department.d.ts.map +1 -1
- package/definitions/types/department.d.ts +10 -1
- package/definitions/types/department.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +4 -1
- package/src/index.ts +2 -0
- package/src/models/department.ts +46 -2
- package/src/test/department.ts +214 -0
- package/src/test/drone-connection.ts +42 -0
- package/src/types/department.ts +12 -0
|
@@ -60,6 +60,19 @@ describe("DroneConnection", function() {
|
|
|
60
60
|
assert.isUndefined(sut.options);
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
for (const provider of Object.values(m.DroneProvider)) {
|
|
64
|
+
it(`saves the ${provider} provider`, async function() {
|
|
65
|
+
const sut = await new models.DroneConnection({
|
|
66
|
+
departmentId,
|
|
67
|
+
provider,
|
|
68
|
+
label: `${provider} fleet`,
|
|
69
|
+
}).save();
|
|
70
|
+
|
|
71
|
+
const loaded = await models.DroneConnection.findOne({ _id: sut._id });
|
|
72
|
+
assert.equal(loaded?.provider, provider);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
63
76
|
it("rejects an unknown provider", async function() {
|
|
64
77
|
let thrownError: unknown = null;
|
|
65
78
|
try {
|
|
@@ -161,4 +174,33 @@ describe("DroneConnection", function() {
|
|
|
161
174
|
assert.equal((thrownError as { code?: number }).code, 11000);
|
|
162
175
|
assert.include(String((thrownError as Error).message), "E11000");
|
|
163
176
|
});
|
|
177
|
+
it("rejects a provider whose case does not match", async function() {
|
|
178
|
+
let thrownError: unknown = null;
|
|
179
|
+
try {
|
|
180
|
+
await new models.DroneConnection({
|
|
181
|
+
departmentId,
|
|
182
|
+
provider: "BRINC",
|
|
183
|
+
label: "Wrong case",
|
|
184
|
+
}).save();
|
|
185
|
+
} catch (e) {
|
|
186
|
+
thrownError = e;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
assert.isNotNull(thrownError, "expected an upper-case provider to be rejected");
|
|
190
|
+
assert.include(String((thrownError as Error).message), "provider");
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it("allows one label across different providers in a department", async function() {
|
|
194
|
+
for (const provider of Object.values(m.DroneProvider)) {
|
|
195
|
+
const sut = await new models.DroneConnection({
|
|
196
|
+
departmentId,
|
|
197
|
+
provider,
|
|
198
|
+
label: "Fleet A",
|
|
199
|
+
}).save();
|
|
200
|
+
assert.equal(sut.provider, provider);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const stored = await models.DroneConnection.find({ departmentId, label: "Fleet A" });
|
|
204
|
+
assert.equal(stored.length, Object.values(m.DroneProvider).length);
|
|
205
|
+
});
|
|
164
206
|
});
|
package/src/types/department.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { PubNubTokenSchemaType } from "./pubnub-token";
|
|
|
5
5
|
import {
|
|
6
6
|
AccountCallerType,
|
|
7
7
|
AccountIndustry,
|
|
8
|
+
DroneProvider,
|
|
8
9
|
} from "../constants";
|
|
9
10
|
import { ReportNumberSchemaType } from "./common-incident";
|
|
10
11
|
import { GeoPolygon } from "./geojson";
|
|
@@ -359,8 +360,19 @@ export interface DroneSenseConfigurationType {
|
|
|
359
360
|
apiKey: string,
|
|
360
361
|
}
|
|
361
362
|
|
|
363
|
+
export interface DronesVideoUrlsType {
|
|
364
|
+
web: string,
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export interface DronesVideoType {
|
|
368
|
+
sources: string[],
|
|
369
|
+
urls: DronesVideoUrlsType,
|
|
370
|
+
}
|
|
371
|
+
|
|
362
372
|
export interface DronesConfigurationType {
|
|
363
373
|
enabled: boolean,
|
|
374
|
+
providers?: DroneProvider[],
|
|
375
|
+
video: DronesVideoType,
|
|
364
376
|
}
|
|
365
377
|
|
|
366
378
|
export interface FireMapperConfigurationType {
|