payservedb 9.11.0 → 10.0.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/package.json
CHANGED
|
@@ -213,7 +213,8 @@ const waterMeterSettingsSchema = new mongoose.Schema({
|
|
|
213
213
|
},
|
|
214
214
|
paymentId: {
|
|
215
215
|
type: mongoose.Schema.Types.ObjectId,
|
|
216
|
-
ref: 'FacilityPaymentDetails'
|
|
216
|
+
ref: 'FacilityPaymentDetails',
|
|
217
|
+
default: null
|
|
217
218
|
}
|
|
218
219
|
},
|
|
219
220
|
bankPayment: {
|
|
@@ -223,7 +224,8 @@ const waterMeterSettingsSchema = new mongoose.Schema({
|
|
|
223
224
|
},
|
|
224
225
|
paymentId: {
|
|
225
226
|
type: mongoose.Schema.Types.ObjectId,
|
|
226
|
-
ref: 'BankDetails'
|
|
227
|
+
ref: 'BankDetails',
|
|
228
|
+
default: null
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
231
|
},
|
|
@@ -308,11 +310,13 @@ const waterMeterSettingsSchema = new mongoose.Schema({
|
|
|
308
310
|
type: mongoose.Schema.Types.ObjectId,
|
|
309
311
|
ref: "GLAccount",
|
|
310
312
|
required: false,
|
|
313
|
+
default: null
|
|
311
314
|
},
|
|
312
315
|
credit: {
|
|
313
316
|
type: mongoose.Schema.Types.ObjectId,
|
|
314
317
|
ref: "GLAccount",
|
|
315
318
|
required: false,
|
|
319
|
+
default: null
|
|
316
320
|
}
|
|
317
321
|
},
|
|
318
322
|
payment: {
|
|
@@ -320,30 +324,45 @@ const waterMeterSettingsSchema = new mongoose.Schema({
|
|
|
320
324
|
type: mongoose.Schema.Types.ObjectId,
|
|
321
325
|
ref: "GLAccount",
|
|
322
326
|
required: false,
|
|
327
|
+
default: null
|
|
323
328
|
},
|
|
324
329
|
credit: {
|
|
325
330
|
type: mongoose.Schema.Types.ObjectId,
|
|
326
331
|
ref: "GLAccount",
|
|
327
332
|
required: false,
|
|
333
|
+
default: null
|
|
328
334
|
}
|
|
329
335
|
}
|
|
330
336
|
},
|
|
331
337
|
|
|
332
338
|
//GL ACCOUNT DOUBLE ENTRIES
|
|
339
|
+
// Uniqueness is enforced by partial indexes below (declared after the schema),
|
|
340
|
+
// so many facilities can have null here without E11000 errors.
|
|
333
341
|
invocieCreationDe: {
|
|
334
342
|
type: mongoose.Schema.Types.ObjectId,
|
|
335
343
|
ref: 'GLAccountDoubleEntries',
|
|
336
|
-
|
|
344
|
+
default: null
|
|
337
345
|
},
|
|
338
346
|
invoicePaymentDe: {
|
|
339
347
|
type: mongoose.Schema.Types.ObjectId,
|
|
340
348
|
ref: 'GLAccountDoubleEntries',
|
|
341
|
-
|
|
349
|
+
default: null
|
|
342
350
|
},
|
|
343
351
|
}, {
|
|
344
352
|
timestamps: true
|
|
345
353
|
});
|
|
346
354
|
|
|
355
|
+
// Unique only when the value is an actual ObjectId (null / missing are ignored).
|
|
356
|
+
// NOTE: sparse does NOT skip explicit nulls, which is why partial indexes are used.
|
|
357
|
+
waterMeterSettingsSchema.index(
|
|
358
|
+
{ invocieCreationDe: 1 },
|
|
359
|
+
{ unique: true, partialFilterExpression: { invocieCreationDe: { $type: 'objectId' } } }
|
|
360
|
+
);
|
|
361
|
+
waterMeterSettingsSchema.index(
|
|
362
|
+
{ invoicePaymentDe: 1 },
|
|
363
|
+
{ unique: true, partialFilterExpression: { invoicePaymentDe: { $type: 'objectId' } } }
|
|
364
|
+
);
|
|
365
|
+
|
|
347
366
|
const WaterMeterSettings = mongoose.model('WaterMeterSettings', waterMeterSettingsSchema);
|
|
348
367
|
|
|
349
368
|
module.exports = WaterMeterSettings;
|