tabletcommand-backend-models 7.4.20 → 7.4.21
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/models/incident-filter-global.js +22 -38
- package/build/models/incident-filter-global.js.map +1 -1
- package/definitions/models/incident-filter-global.d.ts.map +1 -1
- package/definitions/types/incident-filter.d.ts +3 -2
- package/definitions/types/incident-filter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/models/incident-filter-global.ts +26 -40
- package/src/types/incident-filter.ts +6 -2
|
@@ -7,44 +7,12 @@ const geojson_1 = require("./schema/geojson");
|
|
|
7
7
|
async function CADIncidentFilterGlobalModule(mongoose) {
|
|
8
8
|
const { Schema } = mongoose;
|
|
9
9
|
const GeoPolygon = (0, geojson_1.GeoPolygonSchema)(mongoose);
|
|
10
|
-
const IncidentFilterOptionSchema = new Schema({
|
|
11
|
-
name: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: "",
|
|
14
|
-
},
|
|
15
|
-
visible: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
default: true,
|
|
18
|
-
},
|
|
19
|
-
position: {
|
|
20
|
-
type: Number,
|
|
21
|
-
default: 1,
|
|
22
|
-
},
|
|
23
|
-
area: {
|
|
24
|
-
type: GeoPolygon,
|
|
25
|
-
default: {
|
|
26
|
-
type: "Polygon",
|
|
27
|
-
coordinates: [],
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
value: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: "",
|
|
33
|
-
},
|
|
34
|
-
values: {
|
|
35
|
-
type: [String],
|
|
36
|
-
default: [],
|
|
37
|
-
},
|
|
38
|
-
}, {
|
|
39
|
-
_id: false,
|
|
40
|
-
id: false,
|
|
41
|
-
});
|
|
42
10
|
const modelSchema = new Schema({
|
|
43
11
|
_id: {
|
|
44
12
|
type: Schema.Types.ObjectId,
|
|
45
13
|
auto: true,
|
|
46
14
|
},
|
|
47
|
-
|
|
15
|
+
group: {
|
|
48
16
|
type: String,
|
|
49
17
|
default: "",
|
|
50
18
|
required: true,
|
|
@@ -57,10 +25,19 @@ async function CADIncidentFilterGlobalModule(mongoose) {
|
|
|
57
25
|
constants_1.IncidentFilterKind.AreaUnit,
|
|
58
26
|
constants_1.IncidentFilterKind.County,
|
|
59
27
|
],
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
// Parts of IncidentFilterOption
|
|
31
|
+
area: {
|
|
32
|
+
type: GeoPolygon,
|
|
33
|
+
default: {
|
|
34
|
+
type: "Polygon",
|
|
35
|
+
coordinates: [],
|
|
36
|
+
}
|
|
60
37
|
},
|
|
61
|
-
|
|
62
|
-
type:
|
|
63
|
-
default:
|
|
38
|
+
value: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "",
|
|
64
41
|
},
|
|
65
42
|
createdAt: {
|
|
66
43
|
type: Date,
|
|
@@ -80,11 +57,18 @@ async function CADIncidentFilterGlobalModule(mongoose) {
|
|
|
80
57
|
});
|
|
81
58
|
modelSchema.index({
|
|
82
59
|
kind: 1,
|
|
83
|
-
|
|
60
|
+
group: 1,
|
|
84
61
|
}, {
|
|
85
|
-
name: "
|
|
62
|
+
name: "group_1_kind_1_unique",
|
|
86
63
|
unique: true,
|
|
87
64
|
});
|
|
65
|
+
// Create GeoJSON index
|
|
66
|
+
modelSchema.index({
|
|
67
|
+
area: "2dsphere",
|
|
68
|
+
}, {
|
|
69
|
+
name: "area_2dsphere",
|
|
70
|
+
"2dsphereIndexVersion": 3
|
|
71
|
+
});
|
|
88
72
|
return mongoose.model("IncidentFilterGlobal", modelSchema, "massive_incident_filter_global", { overwriteModels: true });
|
|
89
73
|
}
|
|
90
74
|
//# sourceMappingURL=incident-filter-global.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incident-filter-global.js","sourceRoot":"","sources":["../../src/models/incident-filter-global.ts"],"names":[],"mappings":";;AAYA,
|
|
1
|
+
{"version":3,"file":"incident-filter-global.js","sourceRoot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ACP,KAAK,EAAE,CAAC;KACT,EAAE;QACD,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,uBAAuB;IACvB,WAAW,CAAC,KAAK,CAAC;QAChB,IAAI,EAAE,UAAU;KACjB,EAAE;QACD,IAAI,EAAE,eAAe;QACrB,sBAAsB,EAAE,CAAC;KAC1B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,KAAK,CAAuB,sBAAsB,EAAE,WAAW,EAAE,gCAAgC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;AAChJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incident-filter-global.d.ts","sourceRoot":"","sources":["../../src/models/incident-filter-global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAEL,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB,OAAO,
|
|
1
|
+
{"version":3,"file":"incident-filter-global.d.ts","sourceRoot":"","sources":["../../src/models/incident-filter-global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAEL,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,wBAAwB,EAAG,MAAM,0BAA0B,CAAC;AAErE,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB;CAAI;AAE1E,wBAA8B,6BAA6B,CAAC,QAAQ,EAAE,cAAc;;;;SAyEnF;AAED,MAAM,WAAW,yBAA0B,SAAQ,KAAK,CAAC,oBAAoB,CAAC;CAAI"}
|
|
@@ -24,8 +24,9 @@ export interface IncidentFilterGlobalType {
|
|
|
24
24
|
_id: Types.ObjectId;
|
|
25
25
|
createdAt: Date;
|
|
26
26
|
updatedAt: Date;
|
|
27
|
-
|
|
27
|
+
group: string;
|
|
28
28
|
kind: IncidentFilterKind;
|
|
29
|
-
|
|
29
|
+
area: GeoPolygon;
|
|
30
|
+
value: string;
|
|
30
31
|
}
|
|
31
32
|
//# sourceMappingURL=incident-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incident-filter.d.ts","sourceRoot":"","sources":["../../src/types/incident-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EACL,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAEhB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAGhC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"incident-filter.d.ts","sourceRoot":"","sources":["../../src/types/incident-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EACL,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAEhB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAGhC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAGhB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,kBAAkB,CAAC;IAGzB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { IncidentFilterKind } from "../constants";
|
|
8
8
|
import { GeoPolygonSchema } from "./schema/geojson";
|
|
9
|
-
import {
|
|
9
|
+
import { IncidentFilterGlobalType, } from "../types/incident-filter";
|
|
10
10
|
|
|
11
11
|
export interface IncidentFilterGlobal extends IncidentFilterGlobalType { }
|
|
12
12
|
|
|
@@ -14,46 +14,13 @@ export default async function CADIncidentFilterGlobalModule(mongoose: MongooseMo
|
|
|
14
14
|
const { Schema } = mongoose;
|
|
15
15
|
const GeoPolygon = GeoPolygonSchema(mongoose);
|
|
16
16
|
|
|
17
|
-
const IncidentFilterOptionSchema = new Schema<IncidentFilterOption>({
|
|
18
|
-
name: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: "",
|
|
21
|
-
},
|
|
22
|
-
visible: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: true,
|
|
25
|
-
},
|
|
26
|
-
position: {
|
|
27
|
-
type: Number,
|
|
28
|
-
default: 1,
|
|
29
|
-
},
|
|
30
|
-
area: {
|
|
31
|
-
type: GeoPolygon,
|
|
32
|
-
default: {
|
|
33
|
-
type: "Polygon",
|
|
34
|
-
coordinates: [],
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
value: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "",
|
|
40
|
-
},
|
|
41
|
-
values: {
|
|
42
|
-
type: [String],
|
|
43
|
-
default: [],
|
|
44
|
-
},
|
|
45
|
-
}, {
|
|
46
|
-
_id: false,
|
|
47
|
-
id: false,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
17
|
const modelSchema = new Schema<IncidentFilterGlobalType>({
|
|
51
18
|
_id: {
|
|
52
19
|
type: Schema.Types.ObjectId,
|
|
53
20
|
auto: true,
|
|
54
21
|
},
|
|
55
22
|
|
|
56
|
-
|
|
23
|
+
group: {
|
|
57
24
|
type: String,
|
|
58
25
|
default: "",
|
|
59
26
|
required: true,
|
|
@@ -66,11 +33,22 @@ export default async function CADIncidentFilterGlobalModule(mongoose: MongooseMo
|
|
|
66
33
|
IncidentFilterKind.AreaUnit,
|
|
67
34
|
IncidentFilterKind.County,
|
|
68
35
|
],
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// Parts of IncidentFilterOption
|
|
40
|
+
area: {
|
|
41
|
+
type: GeoPolygon,
|
|
42
|
+
default: {
|
|
43
|
+
type: "Polygon",
|
|
44
|
+
coordinates: [],
|
|
45
|
+
}
|
|
69
46
|
},
|
|
70
|
-
|
|
71
|
-
type:
|
|
72
|
-
default:
|
|
47
|
+
value: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "",
|
|
73
50
|
},
|
|
51
|
+
|
|
74
52
|
createdAt: {
|
|
75
53
|
type: Date,
|
|
76
54
|
default: currentDate,
|
|
@@ -90,12 +68,20 @@ export default async function CADIncidentFilterGlobalModule(mongoose: MongooseMo
|
|
|
90
68
|
|
|
91
69
|
modelSchema.index({
|
|
92
70
|
kind: 1,
|
|
93
|
-
|
|
71
|
+
group: 1,
|
|
94
72
|
}, {
|
|
95
|
-
name: "
|
|
73
|
+
name: "group_1_kind_1_unique",
|
|
96
74
|
unique: true,
|
|
97
75
|
});
|
|
98
76
|
|
|
77
|
+
// Create GeoJSON index
|
|
78
|
+
modelSchema.index({
|
|
79
|
+
area: "2dsphere",
|
|
80
|
+
}, {
|
|
81
|
+
name: "area_2dsphere",
|
|
82
|
+
"2dsphereIndexVersion": 3
|
|
83
|
+
});
|
|
84
|
+
|
|
99
85
|
return mongoose.model<IncidentFilterGlobal>("IncidentFilterGlobal", modelSchema, "massive_incident_filter_global", { overwriteModels: true });
|
|
100
86
|
}
|
|
101
87
|
|
|
@@ -34,7 +34,11 @@ export interface IncidentFilterGlobalType {
|
|
|
34
34
|
createdAt: Date,
|
|
35
35
|
updatedAt: Date,
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
// Kind + group identify a set of options (e.g. group: california, kind: .County)
|
|
38
|
+
group: string,
|
|
38
39
|
kind: IncidentFilterKind,
|
|
39
|
-
|
|
40
|
+
|
|
41
|
+
// Parts of IncidentFilterOption
|
|
42
|
+
area: GeoPolygon,
|
|
43
|
+
value: string,
|
|
40
44
|
}
|