tabletcommand-backend-models 5.26.0 → 5.27.0
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/index.js +7 -2
- package/build/index.js.map +1 -1
- package/build/models/schema/validation-error-item.js +35 -0
- package/build/models/schema/validation-error-item.js.map +1 -0
- package/build/models/validation-report.js +65 -0
- package/build/models/validation-report.js.map +1 -0
- package/definitions/index.d.ts +4 -2
- package/definitions/index.d.ts.map +1 -1
- package/definitions/models/schema/validation-error-item.d.ts +28 -0
- package/definitions/models/schema/validation-error-item.d.ts.map +1 -0
- package/definitions/models/validation-report.d.ts +385 -0
- package/definitions/models/validation-report.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +9 -2
- package/src/models/schema/validation-error-item.ts +38 -0
- package/src/models/validation-report.ts +74 -0
- package/test/0index.js +2 -0
- package/test/department.js +1 -1
- package/test/mock.js +52 -24
- package/test/validation-report.js +34 -0
package/build/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.connect = void 0;
|
|
18
|
+
const _ = require("lodash");
|
|
18
19
|
async function wireModels(mongoose) {
|
|
19
20
|
async function getModel(m) {
|
|
20
21
|
const module = await m;
|
|
@@ -62,17 +63,21 @@ async function wireModels(mongoose) {
|
|
|
62
63
|
User: await getModel(Promise.resolve().then(() => require("./models/user"))),
|
|
63
64
|
UserDevice: await getModel(Promise.resolve().then(() => require("./models/user-device"))),
|
|
64
65
|
UserRegistration: await getModel(Promise.resolve().then(() => require("./models/user-registration"))),
|
|
66
|
+
ValidationReport: await getModel(Promise.resolve().then(() => require("./models/validation-report"))),
|
|
65
67
|
};
|
|
66
68
|
}
|
|
67
69
|
__exportStar(require("./helpers"), exports);
|
|
68
|
-
async function connect(url) {
|
|
70
|
+
async function connect(url, overwriteOpts) {
|
|
69
71
|
const mongoose = await Promise.resolve().then(() => require("mongoose"));
|
|
70
72
|
mongoose.Promise = await Promise.resolve().then(() => require("bluebird"));
|
|
71
73
|
const models = await wireModels(mongoose);
|
|
72
|
-
const
|
|
74
|
+
const defaultOpts = {
|
|
75
|
+
readPreference: "primaryPreferred",
|
|
73
76
|
useNewUrlParser: true,
|
|
74
77
|
useUnifiedTopology: true,
|
|
75
78
|
};
|
|
79
|
+
// If present, overwrite options
|
|
80
|
+
const opts = _.assign({}, defaultOpts, overwriteOpts);
|
|
76
81
|
const connection = await mongoose.connect(url, opts);
|
|
77
82
|
return { mongoose, connection, models };
|
|
78
83
|
}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4BAA4B;AAI5B,KAAK,UAAU,UAAU,CAAC,QAAwB;IAEhD,KAAK,UAAU,QAAQ,CAAoE,CAAmB;QAC5G,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAgC,CAAC;IACjE,CAAC;IAED,OAAO;QACL,SAAS,EAAE,MAAM,QAAQ,sCAAQ,qBAAqB,GAAE;QACxD,MAAM,EAAE,MAAM,QAAQ,sCAAQ,iBAAiB,GAAE;QACjD,WAAW,EAAE,MAAM,QAAQ,sCAAQ,uBAAuB,GAAE;QAC5D,UAAU,EAAE,MAAM,QAAQ,sCAAQ,qBAAqB,GAAE;QACzD,SAAS,EAAE,MAAM,QAAQ,sCAAQ,oBAAoB,GAAE;QACvD,SAAS,EAAE,MAAM,QAAQ,sCAAQ,qBAAqB,GAAE;QACxD,WAAW,EAAE,MAAM,QAAQ,sCAAQ,uBAAuB,GAAE;QAC5D,iBAAiB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AAC,CAAC;IAErD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC;AAfD,0BAeC;AAID,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const helpers_1 = require("../../helpers");
|
|
4
|
+
function ValidationErrorItemSchema(mongoose) {
|
|
5
|
+
const { Schema } = mongoose;
|
|
6
|
+
const Item = (0, helpers_1.createSchema)(Schema, {
|
|
7
|
+
message: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "",
|
|
10
|
+
},
|
|
11
|
+
firstSeenAt: {
|
|
12
|
+
type: Date,
|
|
13
|
+
default: helpers_1.currentDate,
|
|
14
|
+
},
|
|
15
|
+
lastSeenAt: {
|
|
16
|
+
type: Date,
|
|
17
|
+
default: helpers_1.currentDate,
|
|
18
|
+
},
|
|
19
|
+
clearedAt: {
|
|
20
|
+
type: Date,
|
|
21
|
+
default: undefined,
|
|
22
|
+
},
|
|
23
|
+
// Req Body
|
|
24
|
+
payload: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: {}
|
|
27
|
+
},
|
|
28
|
+
}, {
|
|
29
|
+
_id: false,
|
|
30
|
+
id: false,
|
|
31
|
+
});
|
|
32
|
+
return Item;
|
|
33
|
+
}
|
|
34
|
+
exports.default = ValidationErrorItemSchema;
|
|
35
|
+
//# sourceMappingURL=validation-error-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error-item.js","sourceRoot":"","sources":["../../../src/models/schema/validation-error-item.ts"],"names":[],"mappings":";;AAAA,2CAIuB;AAEvB,SAAwB,yBAAyB,CAAC,QAAwB;IACxE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IAE5B,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAC,MAAM,EAAE;QAChC,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;QACD,WAAW,EAAE;YACX,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,qBAAW;SACrB;QACD,UAAU,EAAE;YACV,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,qBAAW;SACrB;QACD,SAAS,EAAE;YACT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,SAAS;SACnB;QACD,WAAW;QACX,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;KACF,EAAE;QACD,GAAG,EAAE,KAAK;QACV,EAAE,EAAE,KAAK;KACV,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AA/BD,4CA+BC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationReportModule = exports.ValidationReportSchema = void 0;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const validation_error_item_1 = require("./schema/validation-error-item");
|
|
6
|
+
function ValidationReportSchema(mongoose) {
|
|
7
|
+
const { Schema, Types } = mongoose;
|
|
8
|
+
const ValidationErrorItem = (0, validation_error_item_1.default)(mongoose);
|
|
9
|
+
const modelSchema = (0, helpers_1.createSchema)(Schema, {
|
|
10
|
+
_id: {
|
|
11
|
+
type: Types.ObjectId,
|
|
12
|
+
auto: true,
|
|
13
|
+
},
|
|
14
|
+
departmentId: {
|
|
15
|
+
type: Types.ObjectId,
|
|
16
|
+
ref: "Department",
|
|
17
|
+
required: true,
|
|
18
|
+
unique: true,
|
|
19
|
+
},
|
|
20
|
+
location: {
|
|
21
|
+
type: [ValidationErrorItem],
|
|
22
|
+
default: [],
|
|
23
|
+
},
|
|
24
|
+
statusMap: {
|
|
25
|
+
type: [ValidationErrorItem],
|
|
26
|
+
default: [],
|
|
27
|
+
},
|
|
28
|
+
status: {
|
|
29
|
+
type: [ValidationErrorItem],
|
|
30
|
+
default: [],
|
|
31
|
+
},
|
|
32
|
+
vehicleStatus: {
|
|
33
|
+
type: [ValidationErrorItem],
|
|
34
|
+
default: [],
|
|
35
|
+
},
|
|
36
|
+
vehicle: {
|
|
37
|
+
type: [ValidationErrorItem],
|
|
38
|
+
default: [],
|
|
39
|
+
},
|
|
40
|
+
incident: {
|
|
41
|
+
type: [ValidationErrorItem],
|
|
42
|
+
default: [],
|
|
43
|
+
},
|
|
44
|
+
personnel: {
|
|
45
|
+
type: [ValidationErrorItem],
|
|
46
|
+
default: [],
|
|
47
|
+
},
|
|
48
|
+
modified: {
|
|
49
|
+
type: Date,
|
|
50
|
+
default: helpers_1.currentDate,
|
|
51
|
+
},
|
|
52
|
+
}, {
|
|
53
|
+
collection: "massive_validation_report",
|
|
54
|
+
});
|
|
55
|
+
modelSchema.set("autoIndex", false);
|
|
56
|
+
return modelSchema;
|
|
57
|
+
}
|
|
58
|
+
exports.ValidationReportSchema = ValidationReportSchema;
|
|
59
|
+
async function ValidationReportModule(mongoose) {
|
|
60
|
+
const modelSchema = ValidationReportSchema(mongoose);
|
|
61
|
+
return (0, helpers_1.createModel)(mongoose, "ValidationReport", modelSchema);
|
|
62
|
+
}
|
|
63
|
+
exports.ValidationReportModule = ValidationReportModule;
|
|
64
|
+
exports.default = ValidationReportModule;
|
|
65
|
+
//# sourceMappingURL=validation-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-report.js","sourceRoot":"","sources":["../../src/models/validation-report.ts"],"names":[],"mappings":";;;AAAA,wCAQoB;AACpB,0EAAuE;AAEvE,SAAgB,sBAAsB,CAAC,QAAwB;IAC7D,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;IACnC,MAAM,mBAAmB,GAAG,IAAA,+BAAyB,EAAC,QAAQ,CAAC,CAAC;IAEhE,MAAM,WAAW,GAAG,IAAA,sBAAY,EAAC,MAAM,EAAE;QACvC,GAAG,EAAE;YACH,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kBAAe,sBAAsG,CAAC"}
|
package/definitions/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ConnectionOptions } from "mongoose";
|
|
2
2
|
export { ActionLog, ActionLogModel } from "./models/action-log";
|
|
3
3
|
export { Agency, AgencyModel } from "./models/agency";
|
|
4
4
|
export { ArcGISGroup, ArcGISGroupModel } from "./models/arcgis-group";
|
|
@@ -40,8 +40,9 @@ export { Template, TemplateModel } from "./models/template";
|
|
|
40
40
|
export { User, UserModel } from "./models/user";
|
|
41
41
|
export { UserDevice, UserDeviceModel } from "./models/user-device";
|
|
42
42
|
export { UserRegistration, UserRegistrationModel } from "./models/user-registration";
|
|
43
|
+
export { ValidationReport, ValidationReportModel } from "./models/validation-report";
|
|
43
44
|
export * from "./helpers";
|
|
44
|
-
export declare function connect(url: string): Promise<{
|
|
45
|
+
export declare function connect(url: string, overwriteOpts?: ConnectionOptions): Promise<{
|
|
45
46
|
mongoose: typeof import("mongoose");
|
|
46
47
|
connection: typeof import("mongoose");
|
|
47
48
|
models: {
|
|
@@ -86,6 +87,7 @@ export declare function connect(url: string): Promise<{
|
|
|
86
87
|
User: import("./models/user").UserModel;
|
|
87
88
|
UserDevice: import("./models/user-device").UserDeviceModel;
|
|
88
89
|
UserRegistration: import("./models/user-registration").UserRegistrationModel;
|
|
90
|
+
ValidationReport: import("./models/validation-report").ValidationReportModel;
|
|
89
91
|
};
|
|
90
92
|
}>;
|
|
91
93
|
declare type UnboxPromise<T extends Promise<unknown>> = T extends Promise<infer U> ? U : never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAwD7C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,M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ChD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAErF,cAAc,WAAW,CAAC;AAE1B,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAe3E;AAED,aAAK,YAAY,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACvF,oBAAY,aAAa,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC/E,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="mongoose" />
|
|
2
|
+
import { MongooseModule, currentDate } from "../../helpers";
|
|
3
|
+
export default function ValidationErrorItemSchema(mongoose: MongooseModule): import("mongoose").Schema<any> & {
|
|
4
|
+
_interface: import("../../helpers").MongooseInterface<{
|
|
5
|
+
message: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
firstSeenAt: {
|
|
10
|
+
type: DateConstructor;
|
|
11
|
+
default: typeof currentDate;
|
|
12
|
+
};
|
|
13
|
+
lastSeenAt: {
|
|
14
|
+
type: DateConstructor;
|
|
15
|
+
default: typeof currentDate;
|
|
16
|
+
};
|
|
17
|
+
clearedAt: {
|
|
18
|
+
type: DateConstructor;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
21
|
+
payload: {
|
|
22
|
+
type: ObjectConstructor;
|
|
23
|
+
default: {};
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
_methods: unknown;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=validation-error-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error-item.d.ts","sourceRoot":"","sources":["../../../src/models/schema/validation-error-item.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EAEd,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,QAAQ,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;EA+BzE"}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/// <reference types="mongoose" />
|
|
2
|
+
import { currentDate, ItemTypeFromTypeSchemaFunction, ModelTypeFromTypeSchemaFunction, MongooseModule, ReplaceModelReturnType } from "../helpers";
|
|
3
|
+
export declare function ValidationReportSchema(mongoose: MongooseModule): import("mongoose").Schema<any> & {
|
|
4
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
5
|
+
_id: {
|
|
6
|
+
type: import("mongoose").Types.ObjectIdConstructor;
|
|
7
|
+
auto: boolean;
|
|
8
|
+
};
|
|
9
|
+
departmentId: {
|
|
10
|
+
type: import("mongoose").Types.ObjectIdConstructor;
|
|
11
|
+
ref: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
unique: boolean;
|
|
14
|
+
};
|
|
15
|
+
location: {
|
|
16
|
+
type: (import("mongoose").Schema<any> & {
|
|
17
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
18
|
+
message: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
firstSeenAt: {
|
|
23
|
+
type: DateConstructor;
|
|
24
|
+
default: typeof currentDate;
|
|
25
|
+
};
|
|
26
|
+
lastSeenAt: {
|
|
27
|
+
type: DateConstructor;
|
|
28
|
+
default: typeof currentDate;
|
|
29
|
+
};
|
|
30
|
+
clearedAt: {
|
|
31
|
+
type: DateConstructor;
|
|
32
|
+
default: undefined;
|
|
33
|
+
};
|
|
34
|
+
payload: {
|
|
35
|
+
type: ObjectConstructor;
|
|
36
|
+
default: {};
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
_methods: unknown;
|
|
40
|
+
})[];
|
|
41
|
+
default: never[];
|
|
42
|
+
};
|
|
43
|
+
statusMap: {
|
|
44
|
+
type: (import("mongoose").Schema<any> & {
|
|
45
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
46
|
+
message: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
default: string;
|
|
49
|
+
};
|
|
50
|
+
firstSeenAt: {
|
|
51
|
+
type: DateConstructor;
|
|
52
|
+
default: typeof currentDate;
|
|
53
|
+
};
|
|
54
|
+
lastSeenAt: {
|
|
55
|
+
type: DateConstructor;
|
|
56
|
+
default: typeof currentDate;
|
|
57
|
+
};
|
|
58
|
+
clearedAt: {
|
|
59
|
+
type: DateConstructor;
|
|
60
|
+
default: undefined;
|
|
61
|
+
};
|
|
62
|
+
payload: {
|
|
63
|
+
type: ObjectConstructor;
|
|
64
|
+
default: {};
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
_methods: unknown;
|
|
68
|
+
})[];
|
|
69
|
+
default: never[];
|
|
70
|
+
};
|
|
71
|
+
status: {
|
|
72
|
+
type: (import("mongoose").Schema<any> & {
|
|
73
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
74
|
+
message: {
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
firstSeenAt: {
|
|
79
|
+
type: DateConstructor;
|
|
80
|
+
default: typeof currentDate;
|
|
81
|
+
};
|
|
82
|
+
lastSeenAt: {
|
|
83
|
+
type: DateConstructor;
|
|
84
|
+
default: typeof currentDate;
|
|
85
|
+
};
|
|
86
|
+
clearedAt: {
|
|
87
|
+
type: DateConstructor;
|
|
88
|
+
default: undefined;
|
|
89
|
+
};
|
|
90
|
+
payload: {
|
|
91
|
+
type: ObjectConstructor;
|
|
92
|
+
default: {};
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
_methods: unknown;
|
|
96
|
+
})[];
|
|
97
|
+
default: never[];
|
|
98
|
+
};
|
|
99
|
+
vehicleStatus: {
|
|
100
|
+
type: (import("mongoose").Schema<any> & {
|
|
101
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
102
|
+
message: {
|
|
103
|
+
type: StringConstructor;
|
|
104
|
+
default: string;
|
|
105
|
+
};
|
|
106
|
+
firstSeenAt: {
|
|
107
|
+
type: DateConstructor;
|
|
108
|
+
default: typeof currentDate;
|
|
109
|
+
};
|
|
110
|
+
lastSeenAt: {
|
|
111
|
+
type: DateConstructor;
|
|
112
|
+
default: typeof currentDate;
|
|
113
|
+
};
|
|
114
|
+
clearedAt: {
|
|
115
|
+
type: DateConstructor;
|
|
116
|
+
default: undefined;
|
|
117
|
+
};
|
|
118
|
+
payload: {
|
|
119
|
+
type: ObjectConstructor;
|
|
120
|
+
default: {};
|
|
121
|
+
};
|
|
122
|
+
}>;
|
|
123
|
+
_methods: unknown;
|
|
124
|
+
})[];
|
|
125
|
+
default: never[];
|
|
126
|
+
};
|
|
127
|
+
vehicle: {
|
|
128
|
+
type: (import("mongoose").Schema<any> & {
|
|
129
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
130
|
+
message: {
|
|
131
|
+
type: StringConstructor;
|
|
132
|
+
default: string;
|
|
133
|
+
};
|
|
134
|
+
firstSeenAt: {
|
|
135
|
+
type: DateConstructor;
|
|
136
|
+
default: typeof currentDate;
|
|
137
|
+
};
|
|
138
|
+
lastSeenAt: {
|
|
139
|
+
type: DateConstructor;
|
|
140
|
+
default: typeof currentDate;
|
|
141
|
+
};
|
|
142
|
+
clearedAt: {
|
|
143
|
+
type: DateConstructor;
|
|
144
|
+
default: undefined;
|
|
145
|
+
};
|
|
146
|
+
payload: {
|
|
147
|
+
type: ObjectConstructor;
|
|
148
|
+
default: {};
|
|
149
|
+
};
|
|
150
|
+
}>;
|
|
151
|
+
_methods: unknown;
|
|
152
|
+
})[];
|
|
153
|
+
default: never[];
|
|
154
|
+
};
|
|
155
|
+
incident: {
|
|
156
|
+
type: (import("mongoose").Schema<any> & {
|
|
157
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
158
|
+
message: {
|
|
159
|
+
type: StringConstructor;
|
|
160
|
+
default: string;
|
|
161
|
+
};
|
|
162
|
+
firstSeenAt: {
|
|
163
|
+
type: DateConstructor;
|
|
164
|
+
default: typeof currentDate;
|
|
165
|
+
};
|
|
166
|
+
lastSeenAt: {
|
|
167
|
+
type: DateConstructor;
|
|
168
|
+
default: typeof currentDate;
|
|
169
|
+
};
|
|
170
|
+
clearedAt: {
|
|
171
|
+
type: DateConstructor;
|
|
172
|
+
default: undefined;
|
|
173
|
+
};
|
|
174
|
+
payload: {
|
|
175
|
+
type: ObjectConstructor;
|
|
176
|
+
default: {};
|
|
177
|
+
};
|
|
178
|
+
}>;
|
|
179
|
+
_methods: unknown;
|
|
180
|
+
})[];
|
|
181
|
+
default: never[];
|
|
182
|
+
};
|
|
183
|
+
personnel: {
|
|
184
|
+
type: (import("mongoose").Schema<any> & {
|
|
185
|
+
_interface: import("../helpers").MongooseInterface<{
|
|
186
|
+
message: {
|
|
187
|
+
type: StringConstructor;
|
|
188
|
+
default: string;
|
|
189
|
+
};
|
|
190
|
+
firstSeenAt: {
|
|
191
|
+
type: DateConstructor;
|
|
192
|
+
default: typeof currentDate;
|
|
193
|
+
};
|
|
194
|
+
lastSeenAt: {
|
|
195
|
+
type: DateConstructor;
|
|
196
|
+
default: typeof currentDate;
|
|
197
|
+
};
|
|
198
|
+
clearedAt: {
|
|
199
|
+
type: DateConstructor;
|
|
200
|
+
default: undefined;
|
|
201
|
+
};
|
|
202
|
+
payload: {
|
|
203
|
+
type: ObjectConstructor;
|
|
204
|
+
default: {};
|
|
205
|
+
};
|
|
206
|
+
}>;
|
|
207
|
+
_methods: unknown;
|
|
208
|
+
})[];
|
|
209
|
+
default: never[];
|
|
210
|
+
};
|
|
211
|
+
modified: {
|
|
212
|
+
type: DateConstructor;
|
|
213
|
+
default: typeof currentDate;
|
|
214
|
+
};
|
|
215
|
+
}>;
|
|
216
|
+
_methods: unknown;
|
|
217
|
+
};
|
|
218
|
+
export declare function ValidationReportModule(mongoose: MongooseModule): Promise<import("mongoose").Model<import("mongoose").Document & Record<string, unknown> & {
|
|
219
|
+
_id: import("bson").ObjectID;
|
|
220
|
+
departmentId: import("bson").ObjectID;
|
|
221
|
+
location: import("../helpers").MongooseInterface<{
|
|
222
|
+
message: {
|
|
223
|
+
type: StringConstructor;
|
|
224
|
+
default: string;
|
|
225
|
+
};
|
|
226
|
+
firstSeenAt: {
|
|
227
|
+
type: DateConstructor;
|
|
228
|
+
default: typeof currentDate;
|
|
229
|
+
};
|
|
230
|
+
lastSeenAt: {
|
|
231
|
+
type: DateConstructor;
|
|
232
|
+
default: typeof currentDate;
|
|
233
|
+
};
|
|
234
|
+
clearedAt: {
|
|
235
|
+
type: DateConstructor;
|
|
236
|
+
default: undefined;
|
|
237
|
+
};
|
|
238
|
+
payload: {
|
|
239
|
+
type: ObjectConstructor;
|
|
240
|
+
default: {};
|
|
241
|
+
};
|
|
242
|
+
}>[];
|
|
243
|
+
statusMap: import("../helpers").MongooseInterface<{
|
|
244
|
+
message: {
|
|
245
|
+
type: StringConstructor;
|
|
246
|
+
default: string;
|
|
247
|
+
};
|
|
248
|
+
firstSeenAt: {
|
|
249
|
+
type: DateConstructor;
|
|
250
|
+
default: typeof currentDate;
|
|
251
|
+
};
|
|
252
|
+
lastSeenAt: {
|
|
253
|
+
type: DateConstructor;
|
|
254
|
+
default: typeof currentDate;
|
|
255
|
+
};
|
|
256
|
+
clearedAt: {
|
|
257
|
+
type: DateConstructor;
|
|
258
|
+
default: undefined;
|
|
259
|
+
};
|
|
260
|
+
payload: {
|
|
261
|
+
type: ObjectConstructor;
|
|
262
|
+
default: {};
|
|
263
|
+
};
|
|
264
|
+
}>[];
|
|
265
|
+
status: import("../helpers").MongooseInterface<{
|
|
266
|
+
message: {
|
|
267
|
+
type: StringConstructor;
|
|
268
|
+
default: string;
|
|
269
|
+
};
|
|
270
|
+
firstSeenAt: {
|
|
271
|
+
type: DateConstructor;
|
|
272
|
+
default: typeof currentDate;
|
|
273
|
+
};
|
|
274
|
+
lastSeenAt: {
|
|
275
|
+
type: DateConstructor;
|
|
276
|
+
default: typeof currentDate;
|
|
277
|
+
};
|
|
278
|
+
clearedAt: {
|
|
279
|
+
type: DateConstructor;
|
|
280
|
+
default: undefined;
|
|
281
|
+
};
|
|
282
|
+
payload: {
|
|
283
|
+
type: ObjectConstructor;
|
|
284
|
+
default: {};
|
|
285
|
+
};
|
|
286
|
+
}>[];
|
|
287
|
+
vehicleStatus: import("../helpers").MongooseInterface<{
|
|
288
|
+
message: {
|
|
289
|
+
type: StringConstructor;
|
|
290
|
+
default: string;
|
|
291
|
+
};
|
|
292
|
+
firstSeenAt: {
|
|
293
|
+
type: DateConstructor;
|
|
294
|
+
default: typeof currentDate;
|
|
295
|
+
};
|
|
296
|
+
lastSeenAt: {
|
|
297
|
+
type: DateConstructor;
|
|
298
|
+
default: typeof currentDate;
|
|
299
|
+
};
|
|
300
|
+
clearedAt: {
|
|
301
|
+
type: DateConstructor;
|
|
302
|
+
default: undefined;
|
|
303
|
+
};
|
|
304
|
+
payload: {
|
|
305
|
+
type: ObjectConstructor;
|
|
306
|
+
default: {};
|
|
307
|
+
};
|
|
308
|
+
}>[];
|
|
309
|
+
vehicle: import("../helpers").MongooseInterface<{
|
|
310
|
+
message: {
|
|
311
|
+
type: StringConstructor;
|
|
312
|
+
default: string;
|
|
313
|
+
};
|
|
314
|
+
firstSeenAt: {
|
|
315
|
+
type: DateConstructor;
|
|
316
|
+
default: typeof currentDate;
|
|
317
|
+
};
|
|
318
|
+
lastSeenAt: {
|
|
319
|
+
type: DateConstructor;
|
|
320
|
+
default: typeof currentDate;
|
|
321
|
+
};
|
|
322
|
+
clearedAt: {
|
|
323
|
+
type: DateConstructor;
|
|
324
|
+
default: undefined;
|
|
325
|
+
};
|
|
326
|
+
payload: {
|
|
327
|
+
type: ObjectConstructor;
|
|
328
|
+
default: {};
|
|
329
|
+
};
|
|
330
|
+
}>[];
|
|
331
|
+
incident: import("../helpers").MongooseInterface<{
|
|
332
|
+
message: {
|
|
333
|
+
type: StringConstructor;
|
|
334
|
+
default: string;
|
|
335
|
+
};
|
|
336
|
+
firstSeenAt: {
|
|
337
|
+
type: DateConstructor;
|
|
338
|
+
default: typeof currentDate;
|
|
339
|
+
};
|
|
340
|
+
lastSeenAt: {
|
|
341
|
+
type: DateConstructor;
|
|
342
|
+
default: typeof currentDate;
|
|
343
|
+
};
|
|
344
|
+
clearedAt: {
|
|
345
|
+
type: DateConstructor;
|
|
346
|
+
default: undefined;
|
|
347
|
+
};
|
|
348
|
+
payload: {
|
|
349
|
+
type: ObjectConstructor;
|
|
350
|
+
default: {};
|
|
351
|
+
};
|
|
352
|
+
}>[];
|
|
353
|
+
personnel: import("../helpers").MongooseInterface<{
|
|
354
|
+
message: {
|
|
355
|
+
type: StringConstructor;
|
|
356
|
+
default: string;
|
|
357
|
+
};
|
|
358
|
+
firstSeenAt: {
|
|
359
|
+
type: DateConstructor;
|
|
360
|
+
default: typeof currentDate;
|
|
361
|
+
};
|
|
362
|
+
lastSeenAt: {
|
|
363
|
+
type: DateConstructor;
|
|
364
|
+
default: typeof currentDate;
|
|
365
|
+
};
|
|
366
|
+
clearedAt: {
|
|
367
|
+
type: DateConstructor;
|
|
368
|
+
default: undefined;
|
|
369
|
+
};
|
|
370
|
+
payload: {
|
|
371
|
+
type: ObjectConstructor;
|
|
372
|
+
default: {};
|
|
373
|
+
};
|
|
374
|
+
}>[];
|
|
375
|
+
modified: string;
|
|
376
|
+
}, {}> & {
|
|
377
|
+
__methods?: unknown;
|
|
378
|
+
}>;
|
|
379
|
+
export interface ValidationReport extends ItemTypeFromTypeSchemaFunction<typeof ValidationReportModule> {
|
|
380
|
+
}
|
|
381
|
+
export interface ValidationReportModel extends ModelTypeFromTypeSchemaFunction<ValidationReport> {
|
|
382
|
+
}
|
|
383
|
+
declare const _default: ReplaceModelReturnType<typeof ValidationReportModule, ValidationReportModel>;
|
|
384
|
+
export default _default;
|
|
385
|
+
//# sourceMappingURL=validation-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-report.d.ts","sourceRoot":"","sources":["../../src/models/validation-report.ts"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EACX,8BAA8B,EAC9B,+BAA+B,EAC/B,cAAc,EACd,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAGpB,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqD9D;AAED,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGpE;AAED,MAAM,WAAW,gBAAiB,SAAQ,8BAA8B,CAAC,OAAO,sBAAsB,CAAC;CAAI;AAC3G,MAAM,WAAW,qBAAsB,SAAQ,+BAA+B,CAAC,gBAAgB,CAAC;CAAI;;AACpG,wBAAsH"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as _ from "lodash";
|
|
2
|
+
import { ConnectionOptions } from "mongoose";
|
|
1
3
|
import { MongooseModule } from "./helpers";
|
|
2
4
|
|
|
3
5
|
async function wireModels(mongoose: MongooseModule) {
|
|
@@ -49,6 +51,7 @@ async function wireModels(mongoose: MongooseModule) {
|
|
|
49
51
|
User: await getModel(import("./models/user")),
|
|
50
52
|
UserDevice: await getModel(import("./models/user-device")),
|
|
51
53
|
UserRegistration: await getModel(import("./models/user-registration")),
|
|
54
|
+
ValidationReport: await getModel(import("./models/validation-report")),
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
57
|
|
|
@@ -93,18 +96,22 @@ export { Template, TemplateModel } from "./models/template";
|
|
|
93
96
|
export { User, UserModel } from "./models/user";
|
|
94
97
|
export { UserDevice, UserDeviceModel } from "./models/user-device";
|
|
95
98
|
export { UserRegistration, UserRegistrationModel } from "./models/user-registration";
|
|
99
|
+
export { ValidationReport, ValidationReportModel } from "./models/validation-report";
|
|
96
100
|
|
|
97
101
|
export * from "./helpers";
|
|
98
102
|
|
|
99
|
-
export async function connect(url: string) {
|
|
103
|
+
export async function connect(url: string, overwriteOpts?: ConnectionOptions) {
|
|
100
104
|
const mongoose = await import("mongoose");
|
|
101
105
|
mongoose.Promise = await import("bluebird");
|
|
102
106
|
|
|
103
107
|
const models = await wireModels(mongoose);
|
|
104
|
-
const
|
|
108
|
+
const defaultOpts: ConnectionOptions = {
|
|
109
|
+
readPreference: "primaryPreferred",
|
|
105
110
|
useNewUrlParser: true,
|
|
106
111
|
useUnifiedTopology: true,
|
|
107
112
|
};
|
|
113
|
+
// If present, overwrite options
|
|
114
|
+
const opts: ConnectionOptions = _.assign({}, defaultOpts, overwriteOpts);
|
|
108
115
|
const connection = await mongoose.connect(url, opts);
|
|
109
116
|
|
|
110
117
|
return { mongoose, connection, models };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MongooseModule,
|
|
3
|
+
createSchema,
|
|
4
|
+
currentDate,
|
|
5
|
+
} from "../../helpers";
|
|
6
|
+
|
|
7
|
+
export default function ValidationErrorItemSchema(mongoose: MongooseModule) {
|
|
8
|
+
const { Schema } = mongoose;
|
|
9
|
+
|
|
10
|
+
const Item = createSchema(Schema, {
|
|
11
|
+
message: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "",
|
|
14
|
+
},
|
|
15
|
+
firstSeenAt: {
|
|
16
|
+
type: Date,
|
|
17
|
+
default: currentDate,
|
|
18
|
+
},
|
|
19
|
+
lastSeenAt: {
|
|
20
|
+
type: Date,
|
|
21
|
+
default: currentDate,
|
|
22
|
+
},
|
|
23
|
+
clearedAt: {
|
|
24
|
+
type: Date,
|
|
25
|
+
default: undefined,
|
|
26
|
+
},
|
|
27
|
+
// Req Body
|
|
28
|
+
payload: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: {}
|
|
31
|
+
},
|
|
32
|
+
}, {
|
|
33
|
+
_id: false,
|
|
34
|
+
id: false,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return Item;
|
|
38
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createModel,
|
|
3
|
+
createSchema,
|
|
4
|
+
currentDate,
|
|
5
|
+
ItemTypeFromTypeSchemaFunction,
|
|
6
|
+
ModelTypeFromTypeSchemaFunction,
|
|
7
|
+
MongooseModule,
|
|
8
|
+
ReplaceModelReturnType,
|
|
9
|
+
} from "../helpers";
|
|
10
|
+
import ValidationErrorItemModule from "./schema/validation-error-item";
|
|
11
|
+
|
|
12
|
+
export function ValidationReportSchema(mongoose: MongooseModule) {
|
|
13
|
+
const { Schema, Types } = mongoose;
|
|
14
|
+
const ValidationErrorItem = ValidationErrorItemModule(mongoose);
|
|
15
|
+
|
|
16
|
+
const modelSchema = createSchema(Schema, {
|
|
17
|
+
_id: {
|
|
18
|
+
type: Types.ObjectId,
|
|
19
|
+
auto: true,
|
|
20
|
+
},
|
|
21
|
+
departmentId: {
|
|
22
|
+
type: Types.ObjectId,
|
|
23
|
+
ref: "Department",
|
|
24
|
+
required: true,
|
|
25
|
+
unique: true,
|
|
26
|
+
},
|
|
27
|
+
location: {
|
|
28
|
+
type: [ValidationErrorItem],
|
|
29
|
+
default: [],
|
|
30
|
+
},
|
|
31
|
+
statusMap: {
|
|
32
|
+
type: [ValidationErrorItem],
|
|
33
|
+
default: [],
|
|
34
|
+
},
|
|
35
|
+
status: {
|
|
36
|
+
type: [ValidationErrorItem],
|
|
37
|
+
default: [],
|
|
38
|
+
},
|
|
39
|
+
vehicleStatus: {
|
|
40
|
+
type: [ValidationErrorItem],
|
|
41
|
+
default: [],
|
|
42
|
+
},
|
|
43
|
+
vehicle: {
|
|
44
|
+
type: [ValidationErrorItem],
|
|
45
|
+
default: [],
|
|
46
|
+
},
|
|
47
|
+
incident: {
|
|
48
|
+
type: [ValidationErrorItem],
|
|
49
|
+
default: [],
|
|
50
|
+
},
|
|
51
|
+
personnel: {
|
|
52
|
+
type: [ValidationErrorItem],
|
|
53
|
+
default: [],
|
|
54
|
+
},
|
|
55
|
+
modified: {
|
|
56
|
+
type: Date,
|
|
57
|
+
default: currentDate,
|
|
58
|
+
},
|
|
59
|
+
}, {
|
|
60
|
+
collection: "massive_validation_report",
|
|
61
|
+
});
|
|
62
|
+
modelSchema.set("autoIndex", false);
|
|
63
|
+
|
|
64
|
+
return modelSchema;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function ValidationReportModule(mongoose: MongooseModule) {
|
|
68
|
+
const modelSchema = ValidationReportSchema(mongoose);
|
|
69
|
+
return createModel(mongoose, "ValidationReport", modelSchema);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ValidationReport extends ItemTypeFromTypeSchemaFunction<typeof ValidationReportModule> { }
|
|
73
|
+
export interface ValidationReportModel extends ModelTypeFromTypeSchemaFunction<ValidationReport> { }
|
|
74
|
+
export default ValidationReportModule as ReplaceModelReturnType<typeof ValidationReportModule, ValidationReportModel>;
|
package/test/0index.js
CHANGED
|
@@ -15,6 +15,7 @@ describe(" Models", function() {
|
|
|
15
15
|
afterEach(function() {
|
|
16
16
|
mongoose.disconnect();
|
|
17
17
|
});
|
|
18
|
+
|
|
18
19
|
it("are wired", function() {
|
|
19
20
|
// These should match index.js
|
|
20
21
|
assert.isFunction(models.ActionLog, "Missing ActionLog");
|
|
@@ -56,5 +57,6 @@ describe(" Models", function() {
|
|
|
56
57
|
assert.isFunction(models.User, "Missing User");
|
|
57
58
|
assert.isFunction(models.UserDevice, "Missing UserDevice");
|
|
58
59
|
assert.isFunction(models.UserRegistration, "Missing UserRegistration");
|
|
60
|
+
assert.isFunction(models.ValidationReport, "Missing ValidationReport");
|
|
59
61
|
});
|
|
60
62
|
});
|
package/test/department.js
CHANGED
|
@@ -28,7 +28,7 @@ describe("Department", function() {
|
|
|
28
28
|
assert.isNotNull(sut._id);
|
|
29
29
|
assert.isNotNull(sut.id);
|
|
30
30
|
assert.equal(sut.department, testItem.department);
|
|
31
|
-
assert.equal(sut.city, testItem.city);
|
|
31
|
+
assert.equal(sut.addressDetails.city, testItem.addressDetails.city);
|
|
32
32
|
assert.isTrue(sut.active);
|
|
33
33
|
assert.equal(sut.apikey, testItem.apikey);
|
|
34
34
|
assert.equal(sut.partialApiKey, testItem.partialApiKey);
|
package/test/mock.js
CHANGED
|
@@ -191,24 +191,24 @@ module.exports = function(dependencies) {
|
|
|
191
191
|
|
|
192
192
|
const message = {
|
|
193
193
|
departmentId: "d1234",
|
|
194
|
-
"active"
|
|
195
|
-
"title"
|
|
196
|
-
"body"
|
|
197
|
-
"actionTitle"
|
|
198
|
-
"color"
|
|
199
|
-
"url"
|
|
200
|
-
"priority"
|
|
201
|
-
"type"
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
194
|
+
"active": false,
|
|
195
|
+
"title": "Upgrade App",
|
|
196
|
+
"body": "Application out of date.",
|
|
197
|
+
"actionTitle": "Upgrade App",
|
|
198
|
+
"color": null,
|
|
199
|
+
"url": "",
|
|
200
|
+
"priority": 4,
|
|
201
|
+
"type": {
|
|
202
|
+
"type": "upgradeApp",
|
|
203
|
+
"typeOpts": {
|
|
204
|
+
"major": 3,
|
|
205
|
+
"minor": 0,
|
|
206
|
+
"patch": 1
|
|
207
|
+
}
|
|
208
208
|
},
|
|
209
|
-
"created"
|
|
210
|
-
"uuid"
|
|
211
|
-
"requestId"
|
|
209
|
+
"created": new Date().toISOString(),
|
|
210
|
+
"uuid": "138acffd-a94f-402d-87b3-ff6ed31a19dc",
|
|
211
|
+
"requestId": "138acffd-a94f-402d-87b3-ff6ed31a19db",
|
|
212
212
|
};
|
|
213
213
|
|
|
214
214
|
const cadIncident = {
|
|
@@ -380,7 +380,9 @@ module.exports = function(dependencies) {
|
|
|
380
380
|
const department = {
|
|
381
381
|
_id: mongoose.Types.ObjectId(),
|
|
382
382
|
department: "Test Department",
|
|
383
|
-
|
|
383
|
+
addressDetails: {
|
|
384
|
+
city: "San Francisco",
|
|
385
|
+
},
|
|
384
386
|
active: true,
|
|
385
387
|
apikey: "abcd",
|
|
386
388
|
partialApiKey: "ab",
|
|
@@ -779,7 +781,7 @@ module.exports = function(dependencies) {
|
|
|
779
781
|
offDutyEnabled: true,
|
|
780
782
|
webMapSettings: {
|
|
781
783
|
defaultZoomLevel: 10,
|
|
782
|
-
defaultCenter: [1,1],
|
|
784
|
+
defaultCenter: [1, 1],
|
|
783
785
|
defaultMap: "Default"
|
|
784
786
|
},
|
|
785
787
|
restrictedCommentsEnabled: true
|
|
@@ -890,6 +892,30 @@ module.exports = function(dependencies) {
|
|
|
890
892
|
sendNotification: false
|
|
891
893
|
};
|
|
892
894
|
|
|
895
|
+
const validationReport = {
|
|
896
|
+
_id: mongoose.Types.ObjectId(),
|
|
897
|
+
departmentId: new mongoose.Types.ObjectId("56131f724143487a10000001"),
|
|
898
|
+
modified: new Date("2022-11-13T22:02:01Z"),
|
|
899
|
+
location: [],
|
|
900
|
+
statusMap: [],
|
|
901
|
+
status: [],
|
|
902
|
+
vehicleStatus: [],
|
|
903
|
+
vehicle: [],
|
|
904
|
+
incident: [
|
|
905
|
+
{
|
|
906
|
+
message: "path: /ReportNumber msg: must be array",
|
|
907
|
+
firstSeenAt: new Date("2022-11-14T09:23:48.866Z"),
|
|
908
|
+
lastSeenAt: new Date("2022-11-14T09:23:48.866Z"),
|
|
909
|
+
payload: {
|
|
910
|
+
AgencyID: "99999",
|
|
911
|
+
IncidentNumber: "ABCD-1234",
|
|
912
|
+
ReportNumber: ""
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
],
|
|
916
|
+
personnel: [],
|
|
917
|
+
};
|
|
918
|
+
|
|
893
919
|
async function cleanup() {
|
|
894
920
|
config.checkIfTestDatabase();
|
|
895
921
|
|
|
@@ -897,16 +923,16 @@ module.exports = function(dependencies) {
|
|
|
897
923
|
await models.Esri.deleteMany({});
|
|
898
924
|
await models.IncidentNotified.deleteMany({});
|
|
899
925
|
await models.PersonnelImport.deleteMany({});
|
|
900
|
-
await models.UserDevice.deleteMany({});
|
|
901
926
|
await models.User.deleteMany({});
|
|
927
|
+
await models.UserDevice.deleteMany({});
|
|
928
|
+
await models.ValidationReport.deleteMany({});
|
|
902
929
|
}
|
|
903
930
|
|
|
904
931
|
return {
|
|
905
932
|
actionLog,
|
|
906
|
-
jobLog,
|
|
907
933
|
agency,
|
|
908
|
-
assignment,
|
|
909
934
|
arcGISGroup,
|
|
935
|
+
assignment,
|
|
910
936
|
battalion,
|
|
911
937
|
cadIncident,
|
|
912
938
|
cadStatus,
|
|
@@ -917,6 +943,7 @@ module.exports = function(dependencies) {
|
|
|
917
943
|
checklist,
|
|
918
944
|
checklistItem,
|
|
919
945
|
cleanup,
|
|
946
|
+
csvImport,
|
|
920
947
|
department,
|
|
921
948
|
deviceMapping,
|
|
922
949
|
esri,
|
|
@@ -924,10 +951,11 @@ module.exports = function(dependencies) {
|
|
|
924
951
|
incidentEvent,
|
|
925
952
|
incidentNotified,
|
|
926
953
|
incidentTakeover,
|
|
954
|
+
jobLog,
|
|
927
955
|
location,
|
|
928
956
|
mailLog,
|
|
929
|
-
message,
|
|
930
957
|
managedIncident,
|
|
958
|
+
message,
|
|
931
959
|
monitor,
|
|
932
960
|
personnelImport,
|
|
933
961
|
rateLimit,
|
|
@@ -936,6 +964,6 @@ module.exports = function(dependencies) {
|
|
|
936
964
|
user,
|
|
937
965
|
userDevice,
|
|
938
966
|
userRegistration,
|
|
939
|
-
|
|
967
|
+
validationReport,
|
|
940
968
|
};
|
|
941
969
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("chai").assert;
|
|
4
|
+
|
|
5
|
+
const m = require("..");
|
|
6
|
+
const config = require("./config");
|
|
7
|
+
|
|
8
|
+
describe("ValidationReport", function() {
|
|
9
|
+
let models, mongoose;
|
|
10
|
+
let testItem;
|
|
11
|
+
beforeEach(async function() {
|
|
12
|
+
const c = await m.connect(config.url);
|
|
13
|
+
models = c.models;
|
|
14
|
+
mongoose = c.mongoose;
|
|
15
|
+
|
|
16
|
+
const mock = require("./mock")({
|
|
17
|
+
mongoose
|
|
18
|
+
});
|
|
19
|
+
testItem = mock.validationReport;
|
|
20
|
+
});
|
|
21
|
+
afterEach(function() {
|
|
22
|
+
mongoose.disconnect();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("is saved", async function() {
|
|
26
|
+
const item = new models.ValidationReport(testItem);
|
|
27
|
+
const sut = await item.save();
|
|
28
|
+
|
|
29
|
+
assert.isNotNull(item._id);
|
|
30
|
+
assert.equal(testItem.departmentId.toString(), sut.departmentId.toString());
|
|
31
|
+
assert.equal(testItem.modified.toString(), sut.modified.toString());
|
|
32
|
+
assert.deepEqual(testItem.location, []);
|
|
33
|
+
});
|
|
34
|
+
});
|