payservedb 10.0.6 → 10.0.7
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/index.js
CHANGED
|
@@ -166,6 +166,8 @@ const models = {
|
|
|
166
166
|
WaterPrepaidDebit: require("./src/models/water_prepaid_debit"),
|
|
167
167
|
WaterSensorGateway: require("./src/models/water_sensor_gateway"),
|
|
168
168
|
WaterSensorSettings: require("./src/models/water_sensor_settings"),
|
|
169
|
+
WaterAlertNotification: require("./src/models/water_alert_notification"),
|
|
170
|
+
WaterAlertSettings: require("./src/models/water_alert_settings"),
|
|
169
171
|
MeterLog: require("./src/models/water_meter_communication_logs"),
|
|
170
172
|
CashPayment: require("./src/models/cashpayment"),
|
|
171
173
|
VasPayment: require("./src/models/vas_payments"),
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
const waterAlertNotificationSchema = new mongoose.Schema(
|
|
3
|
+
{
|
|
4
|
+
alertId: {
|
|
5
|
+
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
unique: true
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
tankId: {
|
|
13
|
+
type: String
|
|
14
|
+
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
type: {
|
|
18
|
+
type: String
|
|
19
|
+
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
message: {
|
|
23
|
+
type: String
|
|
24
|
+
|
|
25
|
+
},
|
|
26
|
+
recipients: [
|
|
27
|
+
{
|
|
28
|
+
phone: String,
|
|
29
|
+
status: {
|
|
30
|
+
type: String,
|
|
31
|
+
|
|
32
|
+
enum: ["sent", "queued", "failed"] },
|
|
33
|
+
error: String,
|
|
34
|
+
|
|
35
|
+
_id: false,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
createdAt: {
|
|
39
|
+
|
|
40
|
+
type: Date,
|
|
41
|
+
default: Date.now, expires: 60 * 24 * 60 * 60
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{ collection: "water_alert_notifications" }
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const WaterAlertNotification = mongoose.model("WaterAlertNotification", waterAlertNotificationSchema);
|
|
48
|
+
|
|
49
|
+
module.exports = WaterAlertNotification;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const additionalContactSchema = new mongoose.Schema({
|
|
4
|
+
|
|
5
|
+
name: {
|
|
6
|
+
|
|
7
|
+
type: String,
|
|
8
|
+
|
|
9
|
+
trim: true,
|
|
10
|
+
maxlength: 100,
|
|
11
|
+
default: "" },
|
|
12
|
+
|
|
13
|
+
phone: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const waterAlertSettingsSchema = new mongoose.Schema(
|
|
20
|
+
{
|
|
21
|
+
|
|
22
|
+
facilityId: {
|
|
23
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
24
|
+
ref: "Facility",
|
|
25
|
+
required: true,
|
|
26
|
+
unique: true,
|
|
27
|
+
},
|
|
28
|
+
enabled: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: true },
|
|
31
|
+
|
|
32
|
+
primaryContact: {
|
|
33
|
+
name: {
|
|
34
|
+
type: String,
|
|
35
|
+
trim: true,
|
|
36
|
+
maxlength: 100,
|
|
37
|
+
default: "" },
|
|
38
|
+
|
|
39
|
+
phone: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "" },
|
|
42
|
+
},
|
|
43
|
+
additionalContacts: {
|
|
44
|
+
|
|
45
|
+
type: [additionalContactSchema],
|
|
46
|
+
default: [] },
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
notifyOn: {
|
|
50
|
+
LOW_LEVEL: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true },
|
|
53
|
+
|
|
54
|
+
HIGH_LEVEL: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
OFFLINE: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
LOW_BATTERY: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
updatedBy: { type: mongoose.Schema.Types.ObjectId, ref: "User", default: null },
|
|
70
|
+
},
|
|
71
|
+
{ timestamps: true, collection: "water_alert_settings" }
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const WaterAlertSettings = mongoose.model("WaterAlertSettings", waterAlertSettingsSchema);
|
|
75
|
+
|
|
76
|
+
module.exports = WaterAlertSettings;
|