payservedb 10.1.8 → 10.1.10
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
|
@@ -282,6 +282,7 @@ const models = {
|
|
|
282
282
|
QuickBooksPaymentMapping: require("./src/models/quickbooks_payment_mapping"),
|
|
283
283
|
QuickBooksInvoicePaymentMapping: require("./src/models/quickbooks_invoice_payment_mapping"),
|
|
284
284
|
QuickBooksDepositMapping: require("./src/models/quickbooks_deposit_mapping"),
|
|
285
|
+
QuickBooksLeaseDepositMapping: require("./src/models/quickbooks_lease_deposit_mapping"),
|
|
285
286
|
QuickBooksOutboundSyncState: require("./src/models/quickbooks_outbound_sync_state"),
|
|
286
287
|
QuickBooksCdcSweepState: require("./src/models/quickbooks_cdc_sweep_state"),
|
|
287
288
|
QuickBooksBackfillState: require("./src/models/quickbooks_backfill_state"),
|
package/package.json
CHANGED
|
@@ -79,7 +79,7 @@ const powerMeterPowerChargeSchema = new mongoose.Schema({
|
|
|
79
79
|
timestamps: true
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
powerMeterPowerChargeSchema.index({ facilityId: 1, yearMonth: 1 }, { unique: true });
|
|
82
|
+
powerMeterPowerChargeSchema.index({ facilityId: 1, yearMonth: 1, tariff: 1 }, { unique: true });
|
|
83
83
|
|
|
84
84
|
const PowerMeterPowerCharge = mongoose.model('PowerMeterPowerCharge', powerMeterPowerChargeSchema);
|
|
85
85
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Lease security deposit <-> its own QuickBooks invoice ("<invoice>-DEP").
|
|
2
|
+
// Lease deposits have no Deposit document (they are a "Security Deposit" line
|
|
3
|
+
// on the tenant's lease invoice), so this collection records each one
|
|
4
|
+
// separately from levy deposits (quickbooks_deposit_mapping). The deposit
|
|
5
|
+
// invoice posts to the "security_deposit_lease" Item, which must be a Liability.
|
|
6
|
+
// qbInvoiceId is the DEPOSIT invoice; the rent invoice stays in
|
|
7
|
+
// quickbooks_invoice_mapping.
|
|
8
|
+
const mongoose = require("mongoose");
|
|
9
|
+
|
|
10
|
+
const quickBooksLeaseDepositMappingSchema = new mongoose.Schema(
|
|
11
|
+
{
|
|
12
|
+
facilityId: { type: mongoose.Schema.Types.ObjectId, ref: "Facility", required: true, index: true },
|
|
13
|
+
qbConfigId: { type: mongoose.Schema.Types.ObjectId, ref: "QuickBooksConfig", required: true, index: true },
|
|
14
|
+
// The PayServe lease invoice carrying the Security Deposit line.
|
|
15
|
+
invoiceId: { type: mongoose.Schema.Types.ObjectId, ref: "Invoice", required: true },
|
|
16
|
+
invoiceNumber: { type: String, default: null },
|
|
17
|
+
customerId: { type: mongoose.Schema.Types.ObjectId, ref: "Customer", default: null },
|
|
18
|
+
depositAmount: { type: Number, default: 0 },
|
|
19
|
+
// The deposit invoice in QuickBooks (not the rent invoice).
|
|
20
|
+
qbInvoiceId: { type: String, trim: true, default: null },
|
|
21
|
+
// Item the deposit line was posted with (security_deposit_lease mapping).
|
|
22
|
+
qbItemId: { type: String, trim: true, default: null },
|
|
23
|
+
qbItemName: { type: String, trim: true, default: null },
|
|
24
|
+
syncStatus: {
|
|
25
|
+
type: String,
|
|
26
|
+
enum: ["synced", "pending", "error"],
|
|
27
|
+
default: "pending",
|
|
28
|
+
index: true,
|
|
29
|
+
},
|
|
30
|
+
syncError: { type: String, default: null },
|
|
31
|
+
lastSyncedAt: { type: Date, default: null },
|
|
32
|
+
},
|
|
33
|
+
{ timestamps: true },
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
quickBooksLeaseDepositMappingSchema.index({ facilityId: 1, qbConfigId: 1, invoiceId: 1 }, { unique: true });
|
|
37
|
+
|
|
38
|
+
module.exports = { schema: quickBooksLeaseDepositMappingSchema };
|