payservedb 10.0.5 → 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
@@ -103,6 +103,7 @@ const models = {
103
103
  LevyContract: require("./src/models/levycontract"),
104
104
  ContractPaymentReceipt: require("./src/models/levy_payment_receipt"),
105
105
  DepositSchema: require("./src/models/levy_deposits"),
106
+ ReceiptCounter: require("./src/models/receipt_counter"),
106
107
  Invoice: require("./src/models/invoice"),
107
108
  CombinedInvoice: require("./src/models/combined_invoice"),
108
109
  InvoiceGeneration: require("./src/models/invoice_generation_approval"),
@@ -165,6 +166,8 @@ const models = {
165
166
  WaterPrepaidDebit: require("./src/models/water_prepaid_debit"),
166
167
  WaterSensorGateway: require("./src/models/water_sensor_gateway"),
167
168
  WaterSensorSettings: require("./src/models/water_sensor_settings"),
169
+ WaterAlertNotification: require("./src/models/water_alert_notification"),
170
+ WaterAlertSettings: require("./src/models/water_alert_settings"),
168
171
  MeterLog: require("./src/models/water_meter_communication_logs"),
169
172
  CashPayment: require("./src/models/cashpayment"),
170
173
  VasPayment: require("./src/models/vas_payments"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "10.0.5",
3
+ "version": "10.0.7",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,17 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ // Per-facility sequence counters keyed by a string _id (e.g. 'receiptNumber').
4
+ // Stored in the shared 'counters' collection; documents here use a string _id,
5
+ // unlike the facility-keyed Counter model in counter_schema.js.
6
+ const ReceiptCounterSchema = new mongoose.Schema(
7
+ {
8
+ _id: { type: String, required: true },
9
+ seq: { type: Number, default: 0 }
10
+ },
11
+ { collection: 'counters' }
12
+ );
13
+
14
+ module.exports = {
15
+ schema: ReceiptCounterSchema,
16
+ name: 'ReceiptCounter'
17
+ };
@@ -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;