payservedb 9.0.3 → 9.0.5
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 +1 -0
- package/package.json +1 -1
- package/src/models/invoice.js +11 -0
- package/src/models/movein_reminder.js +77 -0
package/index.js
CHANGED
|
@@ -286,6 +286,7 @@ const moveInModelDefs = {
|
|
|
286
286
|
MoveInMessage: { file: "./src/models/movein_message", name: "MoveInMessage" },
|
|
287
287
|
MoveInLandlordUser: { file: "./src/models/movein_landlord_user", name: "MoveInLandlordUser" },
|
|
288
288
|
MoveInHandoffToken: { file: "./src/models/movein_handoff_token", name: "MoveInHandoffToken" },
|
|
289
|
+
MoveInReminder: { file: "./src/models/movein_reminder", name: "MoveInReminder" },
|
|
289
290
|
};
|
|
290
291
|
|
|
291
292
|
// Initial moveIn namespace — models on default connection (payserve_property).
|
package/package.json
CHANGED
package/src/models/invoice.js
CHANGED
|
@@ -85,6 +85,17 @@ const invoiceSchema = new mongoose.Schema(
|
|
|
85
85
|
amount: { type: Number, required: true }, // e.g. 160.00 (subTotal * percentage / 100)
|
|
86
86
|
},
|
|
87
87
|
],
|
|
88
|
+
withholdingTaxes: [
|
|
89
|
+
{
|
|
90
|
+
name: { type: String, required: true }, // e.g. "withholding"
|
|
91
|
+
percentage: { type: Number, required: true }, // e.g. 5
|
|
92
|
+
amount: { type: Number, required: true }, // e.g. 50 (subTotal * percentage / 100)
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
totalWithholdingTax: {
|
|
96
|
+
type: Number,
|
|
97
|
+
default: 0,
|
|
98
|
+
},
|
|
88
99
|
totalAmount: {
|
|
89
100
|
type: Number,
|
|
90
101
|
required: true,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
+
|
|
4
|
+
const deliveryResultSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
channel: { type: String, enum: ['email', 'sms', 'whatsapp'], required: true },
|
|
7
|
+
target: { type: String, enum: ['tenant', 'landlord'], required: true },
|
|
8
|
+
recipient: { type: String, default: null },
|
|
9
|
+
success: { type: Boolean, default: false },
|
|
10
|
+
method: { type: String, default: null },
|
|
11
|
+
error: { type: String, default: null },
|
|
12
|
+
sentAt: { type: Date, default: null },
|
|
13
|
+
},
|
|
14
|
+
{ _id: false }
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const moveInReminderSchema = new mongoose.Schema(
|
|
18
|
+
{
|
|
19
|
+
relatedType: {
|
|
20
|
+
type: String,
|
|
21
|
+
enum: ['application', 'reservation', 'viewing', 'unit', 'deal'],
|
|
22
|
+
required: true,
|
|
23
|
+
index: true,
|
|
24
|
+
},
|
|
25
|
+
relatedId: { type: ObjectId, required: true, index: true },
|
|
26
|
+
unitId: { type: ObjectId, default: null, index: true },
|
|
27
|
+
unitName: { type: String, default: null },
|
|
28
|
+
facilityId: { type: ObjectId, default: null, index: true },
|
|
29
|
+
facilityName: { type: String, default: null },
|
|
30
|
+
landlordId: { type: ObjectId, default: null, index: true },
|
|
31
|
+
landlordName: { type: String, default: null },
|
|
32
|
+
landlordEmail: { type: String, default: null },
|
|
33
|
+
landlordPhone: { type: String, default: null },
|
|
34
|
+
tenantId: { type: ObjectId, default: null, index: true },
|
|
35
|
+
tenantName: { type: String, default: null },
|
|
36
|
+
tenantEmail: { type: String, default: null },
|
|
37
|
+
tenantPhone: { type: String, default: null },
|
|
38
|
+
target: {
|
|
39
|
+
type: String,
|
|
40
|
+
enum: ['tenant', 'landlord', 'both'],
|
|
41
|
+
default: 'both',
|
|
42
|
+
index: true,
|
|
43
|
+
},
|
|
44
|
+
channels: {
|
|
45
|
+
type: [String],
|
|
46
|
+
enum: ['email', 'sms', 'whatsapp'],
|
|
47
|
+
default: ['email'],
|
|
48
|
+
},
|
|
49
|
+
subject: { type: String, default: null },
|
|
50
|
+
message: { type: String, required: true },
|
|
51
|
+
callCenterNumber: { type: String, default: '+254733902550' },
|
|
52
|
+
createdBy: { type: ObjectId, default: null, index: true },
|
|
53
|
+
createdByType: {
|
|
54
|
+
type: String,
|
|
55
|
+
enum: ['admin', 'landlord', 'system'],
|
|
56
|
+
default: 'admin',
|
|
57
|
+
index: true,
|
|
58
|
+
},
|
|
59
|
+
scheduledFor: { type: Date, default: null, index: true },
|
|
60
|
+
sentAt: { type: Date, default: null },
|
|
61
|
+
status: {
|
|
62
|
+
type: String,
|
|
63
|
+
enum: ['pending', 'sent', 'partial', 'failed'],
|
|
64
|
+
default: 'pending',
|
|
65
|
+
index: true,
|
|
66
|
+
},
|
|
67
|
+
results: { type: [deliveryResultSchema], default: [] },
|
|
68
|
+
},
|
|
69
|
+
{ timestamps: true }
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
moveInReminderSchema.index({ relatedType: 1, relatedId: 1, createdAt: -1 });
|
|
73
|
+
moveInReminderSchema.index({ landlordId: 1, createdAt: -1 });
|
|
74
|
+
moveInReminderSchema.index({ tenantId: 1, createdAt: -1 });
|
|
75
|
+
|
|
76
|
+
const MoveInReminder = mongoose.model('MoveInReminder', moveInReminderSchema);
|
|
77
|
+
module.exports = MoveInReminder;
|