payservedb 9.1.0 → 9.1.2
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/.env +2 -2
- package/ZOHO_INTEGRATION_SCHEMA.md +644 -644
- package/index.js +401 -401
- package/package.json +17 -17
- package/src/models/InvoiceWithholdingTax.js +67 -67
- package/src/models/account.js +52 -52
- package/src/models/agent_departments.js +59 -59
- package/src/models/agent_notifications.js +53 -53
- package/src/models/agent_performance.js +127 -127
- package/src/models/agent_roles.js +77 -77
- package/src/models/agents.js +154 -154
- package/src/models/apilog.js +18 -18
- package/src/models/approvalsWorkflows.js +49 -49
- package/src/models/archivedapilog.js +18 -18
- package/src/models/asset.js +92 -92
- package/src/models/assetsAssignment.js +64 -64
- package/src/models/auditTrail.js +346 -346
- package/src/models/auto_reply_rule.js +68 -68
- package/src/models/bankdetails.js +47 -47
- package/src/models/billerAddress.js +124 -124
- package/src/models/booking_invoice.js +165 -165
- package/src/models/bookinganalytics.js +63 -63
- package/src/models/bookingconfig.js +45 -45
- package/src/models/bookingproperty.js +179 -179
- package/src/models/bookingreservation.js +239 -239
- package/src/models/bookingrevenuerecord.js +84 -84
- package/src/models/budget.js +95 -95
- package/src/models/budgetCategory.js +19 -19
- package/src/models/campaigns.js +108 -108
- package/src/models/cashpayment.js +290 -290
- package/src/models/combinedUnits.js +62 -62
- package/src/models/combined_invoice.js +424 -424
- package/src/models/common_area_electricity.js +38 -38
- package/src/models/common_area_generator.js +41 -41
- package/src/models/common_area_utility_alert.js +37 -37
- package/src/models/common_area_water.js +39 -39
- package/src/models/communication_status.js +33 -33
- package/src/models/communication_user_opt.js +32 -32
- package/src/models/community_guidelines.js +35 -35
- package/src/models/company.js +53 -53
- package/src/models/coreBaseSettings.js +16 -16
- package/src/models/coreInvoiceSettings.js +100 -100
- package/src/models/counter_schema.js +21 -21
- package/src/models/country_tax.js +42 -42
- package/src/models/currency_settings.js +39 -39
- package/src/models/customer.js +234 -234
- package/src/models/customer_preference.js +52 -52
- package/src/models/customer_satisfaction_survey.js +297 -297
- package/src/models/customer_surveys.js +139 -139
- package/src/models/customer_tickets.js +237 -237
- package/src/models/dailyChecklist.js +312 -312
- package/src/models/default_payment_details.js +17 -17
- package/src/models/deliveryTimeMarks.js +18 -18
- package/src/models/document_type.js +19 -19
- package/src/models/dutyRosterChecklist.js +250 -250
- package/src/models/dutyroster.js +136 -136
- package/src/models/email.js +37 -37
- package/src/models/email_cc_config.js +48 -48
- package/src/models/email_sms_queue.js +61 -61
- package/src/models/email_thread.js +35 -35
- package/src/models/entry_exit.js +53 -53
- package/src/models/expense.js +99 -99
- package/src/models/expense_category.js +45 -45
- package/src/models/facility.js +76 -76
- package/src/models/facilityBillingPrices.js +29 -29
- package/src/models/facilityInvoice.js +240 -240
- package/src/models/facilityInvoicePayment.js +52 -52
- package/src/models/facilityInvoiceRecipient.js +32 -32
- package/src/models/facilityWalletTransactionsMetadata.js +236 -236
- package/src/models/facility_departements.js +20 -20
- package/src/models/facility_etims_config.js +116 -116
- package/src/models/facility_payment_details.js +20 -20
- package/src/models/facility_rating.js +78 -78
- package/src/models/facilityasset.js +25 -25
- package/src/models/faq.js +15 -15
- package/src/models/gl_account_double_entries.js +25 -25
- package/src/models/gl_accounts.js +56 -56
- package/src/models/gl_entries.js +49 -49
- package/src/models/goodsReceivedNotes.js +115 -115
- package/src/models/guard.js +47 -47
- package/src/models/handover.js +258 -258
- package/src/models/inspection_category.js +38 -38
- package/src/models/invoice.js +528 -525
- package/src/models/invoiceCreditAdjustment.js +45 -45
- package/src/models/invoice_edit_log.js +81 -81
- package/src/models/invoice_generation_approval.js +86 -86
- package/src/models/invoicing_schedule.js +40 -40
- package/src/models/item_inspection.js +96 -96
- package/src/models/knowledge_base.js +109 -109
- package/src/models/knowledge_base_rating.js +44 -44
- package/src/models/leaseagreement.js +243 -243
- package/src/models/leasetemplate.js +17 -17
- package/src/models/levy.js +212 -212
- package/src/models/levy_invoice_settings.js +26 -26
- package/src/models/levycontract.js +215 -215
- package/src/models/levytype.js +23 -23
- package/src/models/maintenance_service_vendor.js +38 -38
- package/src/models/maintenance_services.js +17 -17
- package/src/models/maintenancerequisition.js +31 -31
- package/src/models/master_workplan.js +32 -32
- package/src/models/master_workplan_child.js +34 -34
- package/src/models/message.js +38 -38
- package/src/models/module.js +21 -21
- package/src/models/movein_application.js +29 -29
- package/src/models/movein_audit_log.js +21 -21
- package/src/models/movein_booking.js +33 -33
- package/src/models/movein_commission.js +46 -46
- package/src/models/movein_conversation.js +25 -25
- package/src/models/movein_deal.js +79 -79
- package/src/models/movein_handoff_token.js +16 -16
- package/src/models/movein_landlord.js +18 -18
- package/src/models/movein_landlord_user.js +20 -20
- package/src/models/movein_message.js +27 -27
- package/src/models/movein_notification.js +27 -27
- package/src/models/movein_otp.js +14 -14
- package/src/models/movein_payment.js +46 -46
- package/src/models/movein_reminder.js +77 -77
- package/src/models/movein_reservation.js +31 -31
- package/src/models/movein_unit.js +59 -59
- package/src/models/movein_user.js +15 -15
- package/src/models/movein_viewing_slot.js +21 -21
- package/src/models/notification.js +44 -44
- package/src/models/paymentTermsMarks.js +19 -19
- package/src/models/penalty.js +76 -76
- package/src/models/pendingCredentials.js +32 -32
- package/src/models/powerMeterCommunicationProtocol.js +17 -17
- package/src/models/powerMeterCustomerAccount.js +78 -78
- package/src/models/powerMeterCustomerBand.js +14 -14
- package/src/models/powerMeterDailyReading.js +30 -30
- package/src/models/powerMeterGateways.js +40 -40
- package/src/models/powerMeterMonthlyReading.js +34 -34
- package/src/models/powerMeterPowerCharges.js +85 -85
- package/src/models/powerMeterSettings.js +200 -200
- package/src/models/powerMeterSingleDayReading.js +32 -32
- package/src/models/powerMeters.js +149 -149
- package/src/models/powerMetersManufacturer.js +14 -14
- package/src/models/power_invoice.js +359 -359
- package/src/models/power_meter_account.js +81 -81
- package/src/models/power_meter_command_logs.js +30 -30
- package/src/models/power_meter_command_queue.js +33 -33
- package/src/models/power_meter_negative_balance.js +44 -44
- package/src/models/power_prepaid_credits.js +47 -47
- package/src/models/power_prepaid_debits.js +53 -53
- package/src/models/power_prepaid_orders.js +78 -78
- package/src/models/power_sms_notification.js +26 -26
- package/src/models/privacy_policy.js +19 -19
- package/src/models/propertyManagerContract.js +556 -556
- package/src/models/propertyManagerRevenue.js +195 -195
- package/src/models/purchaseOrderInvoice.js +74 -74
- package/src/models/purchase_order.js +213 -213
- package/src/models/purchase_request.js +110 -110
- package/src/models/quickbooks_config.js +52 -52
- package/src/models/recipient_group.js +61 -61
- package/src/models/recipient_group_member.js +62 -62
- package/src/models/refresh_token.js +23 -23
- package/src/models/reminder.js +197 -197
- package/src/models/report.js +13 -13
- package/src/models/resident.js +121 -121
- package/src/models/rfq_details.js +131 -131
- package/src/models/rfq_response.js +153 -153
- package/src/models/service_charge_invoice_upload.js +42 -42
- package/src/models/service_charge_payments.js +27 -27
- package/src/models/servicerequest.js +55 -55
- package/src/models/settings.js +62 -62
- package/src/models/short_urls.js +21 -21
- package/src/models/smart_meter_daily_consumption.js +44 -44
- package/src/models/sms_africastalking.js +20 -20
- package/src/models/sms_balance_notification.js +26 -26
- package/src/models/sms_meliora.js +20 -20
- package/src/models/staff.js +36 -36
- package/src/models/stocksandspare.js +161 -161
- package/src/models/suppliers.js +79 -79
- package/src/models/terms_and_conditions.js +19 -19
- package/src/models/tickets.js +186 -186
- package/src/models/tickets_category.js +72 -72
- package/src/models/unitManagementTemplate.js +44 -44
- package/src/models/unitasset.js +25 -25
- package/src/models/units.js +130 -130
- package/src/models/user.js +186 -186
- package/src/models/valueaddedservices.js +21 -21
- package/src/models/vas_invoices_upload.js +50 -50
- package/src/models/vas_payments.js +24 -24
- package/src/models/vasinvoice.js +196 -196
- package/src/models/vasvendor.js +52 -52
- package/src/models/visitLog.js +95 -95
- package/src/models/visitor.js +67 -67
- package/src/models/waitlist.js +45 -45
- package/src/models/wallet.js +44 -44
- package/src/models/wallet_transactions.js +50 -50
- package/src/models/water_invoice.js +351 -351
- package/src/models/water_meter_Command_Queue.js +33 -33
- package/src/models/water_meter_account.js +86 -86
- package/src/models/water_meter_billing.js +58 -58
- package/src/models/water_meter_combined_accounts.js +92 -92
- package/src/models/water_meter_communication.js +17 -17
- package/src/models/water_meter_communication_logs.js +39 -39
- package/src/models/water_meter_concentrator.js +70 -70
- package/src/models/water_meter_daily_history.js +32 -32
- package/src/models/water_meter_high_risk.js +36 -36
- package/src/models/water_meter_iot_cards.js +34 -34
- package/src/models/water_meter_loan_deduction.js +134 -134
- package/src/models/water_meter_manufacturer.js +35 -35
- package/src/models/water_meter_monthly_history.js +36 -36
- package/src/models/water_meter_negative_amounts.js +44 -44
- package/src/models/water_meter_settings.js +290 -290
- package/src/models/water_meter_single_day_history.js +34 -34
- package/src/models/water_meter_size.js +15 -15
- package/src/models/water_meters.js +176 -176
- package/src/models/water_meters_delivery.js +76 -76
- package/src/models/water_prepaid_credit.js +47 -47
- package/src/models/water_prepaid_debit.js +50 -50
- package/src/models/whatsapp_conversation.js +23 -23
- package/src/models/workorder.js +49 -49
- package/src/models/zohoAccount.js +453 -453
- package/src/models/zohoIntegration.js +262 -262
- package/src/models/zohoItem.js +504 -504
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
-
|
|
4
|
-
const moveInDealSchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
unitId: { type: ObjectId, required: true, index: true },
|
|
7
|
-
unitName: { type: String, default: null },
|
|
8
|
-
source: {
|
|
9
|
-
type: String,
|
|
10
|
-
enum: ['standalone', 'payserve'],
|
|
11
|
-
default: 'standalone',
|
|
12
|
-
index: true,
|
|
13
|
-
},
|
|
14
|
-
sourceFacilityId: { type: ObjectId, ref: 'Facility', default: null, index: true },
|
|
15
|
-
sourceUnitId: { type: ObjectId, default: null, index: true },
|
|
16
|
-
landlordId: { type: ObjectId, default: null, index: true },
|
|
17
|
-
tenantId: { type: ObjectId, ref: 'MoveInUser', default: null, index: true },
|
|
18
|
-
tenantName: { type: String, default: null },
|
|
19
|
-
tenantEmail: { type: String, default: null, index: true },
|
|
20
|
-
tenantPhone: { type: String, default: null },
|
|
21
|
-
isGuest: { type: Boolean, default: false, index: true },
|
|
22
|
-
applicationId: { type: ObjectId, ref: 'MoveInApplication', default: null, index: true },
|
|
23
|
-
reservationId: { type: ObjectId, ref: 'MoveInReservation', default: null, index: true },
|
|
24
|
-
bookingId: { type: ObjectId, ref: 'MoveInBooking', default: null, index: true },
|
|
25
|
-
desiredMoveInDate:{ type: Date, default: null },
|
|
26
|
-
agreedMoveInDate: { type: Date, default: null },
|
|
27
|
-
agreedRentAmount: { type: Number, default: null },
|
|
28
|
-
currency: { type: String, default: 'KES' },
|
|
29
|
-
status: {
|
|
30
|
-
type: String,
|
|
31
|
-
enum: [
|
|
32
|
-
'lead',
|
|
33
|
-
'viewing_requested',
|
|
34
|
-
'viewing_confirmed',
|
|
35
|
-
'applied',
|
|
36
|
-
'application_approved',
|
|
37
|
-
'reserved',
|
|
38
|
-
'offer_sent',
|
|
39
|
-
'tenant_confirmed',
|
|
40
|
-
'payment_pending',
|
|
41
|
-
'rented',
|
|
42
|
-
'cancelled',
|
|
43
|
-
'expired',
|
|
44
|
-
'lost',
|
|
45
|
-
],
|
|
46
|
-
default: 'lead',
|
|
47
|
-
index: true,
|
|
48
|
-
},
|
|
49
|
-
commissionStatus: {
|
|
50
|
-
type: String,
|
|
51
|
-
enum: ['not_due', 'due', 'invoiced', 'paid', 'waived', 'refunded', 'disputed'],
|
|
52
|
-
default: 'not_due',
|
|
53
|
-
index: true,
|
|
54
|
-
},
|
|
55
|
-
lastEvent: { type: String, default: null },
|
|
56
|
-
cancelledReason: { type: String, default: null },
|
|
57
|
-
notes: { type: String, default: null },
|
|
58
|
-
payserveSync: {
|
|
59
|
-
status: {
|
|
60
|
-
type: String,
|
|
61
|
-
enum: ['not_applicable', 'pending', 'synced', 'failed'],
|
|
62
|
-
default: 'not_applicable',
|
|
63
|
-
},
|
|
64
|
-
residentId: { type: ObjectId, default: null },
|
|
65
|
-
leaseId: { type: ObjectId, default: null },
|
|
66
|
-
invoiceId: { type: ObjectId, default: null },
|
|
67
|
-
lastError: { type: String, default: null },
|
|
68
|
-
syncedAt: { type: Date, default: null },
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
{ timestamps: true }
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
moveInDealSchema.index({ unitId: 1, status: 1 });
|
|
75
|
-
moveInDealSchema.index({ tenantId: 1, unitId: 1 });
|
|
76
|
-
moveInDealSchema.index({ tenantEmail: 1, unitId: 1 });
|
|
77
|
-
|
|
78
|
-
const MoveInDeal = mongoose.model('MoveInDeal', moveInDealSchema);
|
|
79
|
-
module.exports = MoveInDeal;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
+
|
|
4
|
+
const moveInDealSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
unitId: { type: ObjectId, required: true, index: true },
|
|
7
|
+
unitName: { type: String, default: null },
|
|
8
|
+
source: {
|
|
9
|
+
type: String,
|
|
10
|
+
enum: ['standalone', 'payserve'],
|
|
11
|
+
default: 'standalone',
|
|
12
|
+
index: true,
|
|
13
|
+
},
|
|
14
|
+
sourceFacilityId: { type: ObjectId, ref: 'Facility', default: null, index: true },
|
|
15
|
+
sourceUnitId: { type: ObjectId, default: null, index: true },
|
|
16
|
+
landlordId: { type: ObjectId, default: null, index: true },
|
|
17
|
+
tenantId: { type: ObjectId, ref: 'MoveInUser', default: null, index: true },
|
|
18
|
+
tenantName: { type: String, default: null },
|
|
19
|
+
tenantEmail: { type: String, default: null, index: true },
|
|
20
|
+
tenantPhone: { type: String, default: null },
|
|
21
|
+
isGuest: { type: Boolean, default: false, index: true },
|
|
22
|
+
applicationId: { type: ObjectId, ref: 'MoveInApplication', default: null, index: true },
|
|
23
|
+
reservationId: { type: ObjectId, ref: 'MoveInReservation', default: null, index: true },
|
|
24
|
+
bookingId: { type: ObjectId, ref: 'MoveInBooking', default: null, index: true },
|
|
25
|
+
desiredMoveInDate:{ type: Date, default: null },
|
|
26
|
+
agreedMoveInDate: { type: Date, default: null },
|
|
27
|
+
agreedRentAmount: { type: Number, default: null },
|
|
28
|
+
currency: { type: String, default: 'KES' },
|
|
29
|
+
status: {
|
|
30
|
+
type: String,
|
|
31
|
+
enum: [
|
|
32
|
+
'lead',
|
|
33
|
+
'viewing_requested',
|
|
34
|
+
'viewing_confirmed',
|
|
35
|
+
'applied',
|
|
36
|
+
'application_approved',
|
|
37
|
+
'reserved',
|
|
38
|
+
'offer_sent',
|
|
39
|
+
'tenant_confirmed',
|
|
40
|
+
'payment_pending',
|
|
41
|
+
'rented',
|
|
42
|
+
'cancelled',
|
|
43
|
+
'expired',
|
|
44
|
+
'lost',
|
|
45
|
+
],
|
|
46
|
+
default: 'lead',
|
|
47
|
+
index: true,
|
|
48
|
+
},
|
|
49
|
+
commissionStatus: {
|
|
50
|
+
type: String,
|
|
51
|
+
enum: ['not_due', 'due', 'invoiced', 'paid', 'waived', 'refunded', 'disputed'],
|
|
52
|
+
default: 'not_due',
|
|
53
|
+
index: true,
|
|
54
|
+
},
|
|
55
|
+
lastEvent: { type: String, default: null },
|
|
56
|
+
cancelledReason: { type: String, default: null },
|
|
57
|
+
notes: { type: String, default: null },
|
|
58
|
+
payserveSync: {
|
|
59
|
+
status: {
|
|
60
|
+
type: String,
|
|
61
|
+
enum: ['not_applicable', 'pending', 'synced', 'failed'],
|
|
62
|
+
default: 'not_applicable',
|
|
63
|
+
},
|
|
64
|
+
residentId: { type: ObjectId, default: null },
|
|
65
|
+
leaseId: { type: ObjectId, default: null },
|
|
66
|
+
invoiceId: { type: ObjectId, default: null },
|
|
67
|
+
lastError: { type: String, default: null },
|
|
68
|
+
syncedAt: { type: Date, default: null },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{ timestamps: true }
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
moveInDealSchema.index({ unitId: 1, status: 1 });
|
|
75
|
+
moveInDealSchema.index({ tenantId: 1, unitId: 1 });
|
|
76
|
+
moveInDealSchema.index({ tenantEmail: 1, unitId: 1 });
|
|
77
|
+
|
|
78
|
+
const MoveInDeal = mongoose.model('MoveInDeal', moveInDealSchema);
|
|
79
|
+
module.exports = MoveInDeal;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Short-lived, single-use token that lets a landlord_main session
|
|
4
|
-
// bootstrap a Move-In session without re-logging in.
|
|
5
|
-
const moveInHandoffTokenSchema = new mongoose.Schema(
|
|
6
|
-
{
|
|
7
|
-
token: { type: String, required: true, unique: true, index: true },
|
|
8
|
-
landlordId: { type: mongoose.Schema.Types.ObjectId, required: true, index: true },
|
|
9
|
-
used: { type: Boolean, default: false },
|
|
10
|
-
expiresAt: { type: Date, required: true },
|
|
11
|
-
},
|
|
12
|
-
{ timestamps: true }
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const MoveInHandoffToken = mongoose.model('MoveInHandoffToken', moveInHandoffTokenSchema);
|
|
16
|
-
module.exports = MoveInHandoffToken;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Short-lived, single-use token that lets a landlord_main session
|
|
4
|
+
// bootstrap a Move-In session without re-logging in.
|
|
5
|
+
const moveInHandoffTokenSchema = new mongoose.Schema(
|
|
6
|
+
{
|
|
7
|
+
token: { type: String, required: true, unique: true, index: true },
|
|
8
|
+
landlordId: { type: mongoose.Schema.Types.ObjectId, required: true, index: true },
|
|
9
|
+
used: { type: Boolean, default: false },
|
|
10
|
+
expiresAt: { type: Date, required: true },
|
|
11
|
+
},
|
|
12
|
+
{ timestamps: true }
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const MoveInHandoffToken = mongoose.model('MoveInHandoffToken', moveInHandoffTokenSchema);
|
|
16
|
+
module.exports = MoveInHandoffToken;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
-
|
|
4
|
-
// Created in payserve_movein DB when admin assigns the Move-In module to a landlord.
|
|
5
|
-
// landlordId references the payserve_property User — no cross-DB constraint enforced by Mongoose.
|
|
6
|
-
const moveInLandlordSchema = new mongoose.Schema(
|
|
7
|
-
{
|
|
8
|
-
landlordId: { type: ObjectId, required: true, unique: true, index: true },
|
|
9
|
-
isEnabled: { type: Boolean, default: true, index: true },
|
|
10
|
-
assignedBy: { type: ObjectId, default: null }, // core user who assigned
|
|
11
|
-
assignedAt: { type: Date, default: Date.now },
|
|
12
|
-
revokedAt: { type: Date, default: null },
|
|
13
|
-
},
|
|
14
|
-
{ timestamps: true }
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const MoveInLandlord = mongoose.model('MoveInLandlord', moveInLandlordSchema);
|
|
18
|
-
module.exports = MoveInLandlord;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
+
|
|
4
|
+
// Created in payserve_movein DB when admin assigns the Move-In module to a landlord.
|
|
5
|
+
// landlordId references the payserve_property User — no cross-DB constraint enforced by Mongoose.
|
|
6
|
+
const moveInLandlordSchema = new mongoose.Schema(
|
|
7
|
+
{
|
|
8
|
+
landlordId: { type: ObjectId, required: true, unique: true, index: true },
|
|
9
|
+
isEnabled: { type: Boolean, default: true, index: true },
|
|
10
|
+
assignedBy: { type: ObjectId, default: null }, // core user who assigned
|
|
11
|
+
assignedAt: { type: Date, default: Date.now },
|
|
12
|
+
revokedAt: { type: Date, default: null },
|
|
13
|
+
},
|
|
14
|
+
{ timestamps: true }
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const MoveInLandlord = mongoose.model('MoveInLandlord', moveInLandlordSchema);
|
|
18
|
+
module.exports = MoveInLandlord;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const moveInLandlordUserSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
fullName: { type: String, required: true, trim: true },
|
|
6
|
-
email: { type: String, required: true, unique: true, lowercase: true, trim: true },
|
|
7
|
-
phoneNumber: { type: String, required: true, unique: true },
|
|
8
|
-
// Standalone landlords have a bcrypt password.
|
|
9
|
-
// PayServe-linked landlords have MANAGED_BY_PAYSERVE — auth defers to payserve_property.
|
|
10
|
-
password: { type: String, default: 'MANAGED_BY_PAYSERVE' },
|
|
11
|
-
companyName: { type: String, trim: true, default: null },
|
|
12
|
-
isEnabled: { type: Boolean, default: true },
|
|
13
|
-
// Set when provisioned from an existing PayServe landlord account.
|
|
14
|
-
payserveUserId: { type: mongoose.Schema.Types.ObjectId, default: null, index: true },
|
|
15
|
-
},
|
|
16
|
-
{ timestamps: true }
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const MoveInLandlordUser = mongoose.model('MoveInLandlordUser', moveInLandlordUserSchema);
|
|
20
|
-
module.exports = MoveInLandlordUser;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const moveInLandlordUserSchema = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
fullName: { type: String, required: true, trim: true },
|
|
6
|
+
email: { type: String, required: true, unique: true, lowercase: true, trim: true },
|
|
7
|
+
phoneNumber: { type: String, required: true, unique: true },
|
|
8
|
+
// Standalone landlords have a bcrypt password.
|
|
9
|
+
// PayServe-linked landlords have MANAGED_BY_PAYSERVE — auth defers to payserve_property.
|
|
10
|
+
password: { type: String, default: 'MANAGED_BY_PAYSERVE' },
|
|
11
|
+
companyName: { type: String, trim: true, default: null },
|
|
12
|
+
isEnabled: { type: Boolean, default: true },
|
|
13
|
+
// Set when provisioned from an existing PayServe landlord account.
|
|
14
|
+
payserveUserId: { type: mongoose.Schema.Types.ObjectId, default: null, index: true },
|
|
15
|
+
},
|
|
16
|
+
{ timestamps: true }
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const MoveInLandlordUser = mongoose.model('MoveInLandlordUser', moveInLandlordUserSchema);
|
|
20
|
+
module.exports = MoveInLandlordUser;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
-
|
|
4
|
-
const moveInMessageSchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
conversationId: { type: ObjectId, ref: 'MoveInConversation', required: true, index: true },
|
|
7
|
-
senderId: { type: ObjectId, required: true, index: true },
|
|
8
|
-
senderType: {
|
|
9
|
-
type: String,
|
|
10
|
-
enum: ['tenant', 'landlord'],
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
body: { type: String, required: true },
|
|
14
|
-
type: {
|
|
15
|
-
type: String,
|
|
16
|
-
enum: ['text', 'image'],
|
|
17
|
-
default: 'text',
|
|
18
|
-
},
|
|
19
|
-
attachmentUrl: { type: String, default: null },
|
|
20
|
-
isRead: { type: Boolean, default: false, index: true },
|
|
21
|
-
readAt: { type: Date, default: null },
|
|
22
|
-
},
|
|
23
|
-
{ timestamps: true }
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const MoveInMessage = mongoose.model('MoveInMessage', moveInMessageSchema);
|
|
27
|
-
module.exports = MoveInMessage;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
+
|
|
4
|
+
const moveInMessageSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
conversationId: { type: ObjectId, ref: 'MoveInConversation', required: true, index: true },
|
|
7
|
+
senderId: { type: ObjectId, required: true, index: true },
|
|
8
|
+
senderType: {
|
|
9
|
+
type: String,
|
|
10
|
+
enum: ['tenant', 'landlord'],
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
body: { type: String, required: true },
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: ['text', 'image'],
|
|
17
|
+
default: 'text',
|
|
18
|
+
},
|
|
19
|
+
attachmentUrl: { type: String, default: null },
|
|
20
|
+
isRead: { type: Boolean, default: false, index: true },
|
|
21
|
+
readAt: { type: Date, default: null },
|
|
22
|
+
},
|
|
23
|
+
{ timestamps: true }
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const MoveInMessage = mongoose.model('MoveInMessage', moveInMessageSchema);
|
|
27
|
+
module.exports = MoveInMessage;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
-
|
|
4
|
-
const moveInNotificationSchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
recipientId: { type: ObjectId, required: true, index: true },
|
|
7
|
-
recipientType: {
|
|
8
|
-
type: String,
|
|
9
|
-
enum: ['tenant', 'landlord'],
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
|
-
title: { type: String, required: true },
|
|
13
|
-
body: { type: String, required: true },
|
|
14
|
-
type: {
|
|
15
|
-
type: String,
|
|
16
|
-
enum: ['application', 'viewing', 'reservation', 'payment', 'message', 'general'],
|
|
17
|
-
default: 'general',
|
|
18
|
-
},
|
|
19
|
-
relatedId: { type: ObjectId, default: null },
|
|
20
|
-
isRead: { type: Boolean, default: false, index: true },
|
|
21
|
-
readAt: { type: Date, default: null },
|
|
22
|
-
},
|
|
23
|
-
{ timestamps: true }
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const MoveInNotification = mongoose.model('MoveInNotification', moveInNotificationSchema);
|
|
27
|
-
module.exports = MoveInNotification;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
+
|
|
4
|
+
const moveInNotificationSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
recipientId: { type: ObjectId, required: true, index: true },
|
|
7
|
+
recipientType: {
|
|
8
|
+
type: String,
|
|
9
|
+
enum: ['tenant', 'landlord'],
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
title: { type: String, required: true },
|
|
13
|
+
body: { type: String, required: true },
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: ['application', 'viewing', 'reservation', 'payment', 'message', 'general'],
|
|
17
|
+
default: 'general',
|
|
18
|
+
},
|
|
19
|
+
relatedId: { type: ObjectId, default: null },
|
|
20
|
+
isRead: { type: Boolean, default: false, index: true },
|
|
21
|
+
readAt: { type: Date, default: null },
|
|
22
|
+
},
|
|
23
|
+
{ timestamps: true }
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const MoveInNotification = mongoose.model('MoveInNotification', moveInNotificationSchema);
|
|
27
|
+
module.exports = MoveInNotification;
|
package/src/models/movein_otp.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const moveInOtpSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
email: { type: String, required: true, lowercase: true, trim: true, index: true },
|
|
6
|
-
otp: { type: String, required: true },
|
|
7
|
-
expiresAt: { type: Date, required: true },
|
|
8
|
-
used: { type: Boolean, default: false },
|
|
9
|
-
},
|
|
10
|
-
{ timestamps: true }
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
const MoveInOtp = mongoose.model('MoveInOtp', moveInOtpSchema);
|
|
14
|
-
module.exports = MoveInOtp;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const moveInOtpSchema = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
email: { type: String, required: true, lowercase: true, trim: true, index: true },
|
|
6
|
+
otp: { type: String, required: true },
|
|
7
|
+
expiresAt: { type: Date, required: true },
|
|
8
|
+
used: { type: Boolean, default: false },
|
|
9
|
+
},
|
|
10
|
+
{ timestamps: true }
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const MoveInOtp = mongoose.model('MoveInOtp', moveInOtpSchema);
|
|
14
|
+
module.exports = MoveInOtp;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
-
|
|
4
|
-
const moveInPaymentSchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
tenantId: { type: ObjectId, ref: 'MoveInUser', default: null, index: true },
|
|
7
|
-
tenantName: { type: String, default: null },
|
|
8
|
-
unitId: { type: ObjectId, default: null, index: true },
|
|
9
|
-
unitName: { type: String, default: null },
|
|
10
|
-
reservationId: { type: ObjectId, ref: 'MoveInReservation', default: null, index: true },
|
|
11
|
-
dealId: { type: ObjectId, ref: 'MoveInDeal', default: null, index: true },
|
|
12
|
-
commissionId: { type: ObjectId, ref: 'MoveInCommission', default: null, index: true },
|
|
13
|
-
type: {
|
|
14
|
-
type: String,
|
|
15
|
-
enum: ['reservation_fee', 'deposit', 'first_month_rent', 'commission', 'other'],
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
amount: { type: Number, required: true },
|
|
19
|
-
currency: { type: String, default: 'KES' },
|
|
20
|
-
status: {
|
|
21
|
-
type: String,
|
|
22
|
-
enum: ['pending', 'paid', 'failed', 'refunded', 'waived', 'cancelled', 'disputed'],
|
|
23
|
-
default: 'pending',
|
|
24
|
-
index: true,
|
|
25
|
-
},
|
|
26
|
-
reference: { type: String, default: null },
|
|
27
|
-
externalReference: { type: String, default: null, index: true },
|
|
28
|
-
paymentMethod: {
|
|
29
|
-
type: String,
|
|
30
|
-
enum: ['mpesa', 'card', 'cash', 'other'],
|
|
31
|
-
default: null,
|
|
32
|
-
},
|
|
33
|
-
payerType: {
|
|
34
|
-
type: String,
|
|
35
|
-
enum: ['tenant', 'landlord', 'owner', 'admin'],
|
|
36
|
-
default: 'tenant',
|
|
37
|
-
index: true,
|
|
38
|
-
},
|
|
39
|
-
paidAt: { type: Date, default: null },
|
|
40
|
-
notes: { type: String, default: null },
|
|
41
|
-
},
|
|
42
|
-
{ timestamps: true }
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const MoveInPayment = mongoose.model('MoveInPayment', moveInPaymentSchema);
|
|
46
|
-
module.exports = MoveInPayment;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
3
|
+
|
|
4
|
+
const moveInPaymentSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
tenantId: { type: ObjectId, ref: 'MoveInUser', default: null, index: true },
|
|
7
|
+
tenantName: { type: String, default: null },
|
|
8
|
+
unitId: { type: ObjectId, default: null, index: true },
|
|
9
|
+
unitName: { type: String, default: null },
|
|
10
|
+
reservationId: { type: ObjectId, ref: 'MoveInReservation', default: null, index: true },
|
|
11
|
+
dealId: { type: ObjectId, ref: 'MoveInDeal', default: null, index: true },
|
|
12
|
+
commissionId: { type: ObjectId, ref: 'MoveInCommission', default: null, index: true },
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
enum: ['reservation_fee', 'deposit', 'first_month_rent', 'commission', 'other'],
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
amount: { type: Number, required: true },
|
|
19
|
+
currency: { type: String, default: 'KES' },
|
|
20
|
+
status: {
|
|
21
|
+
type: String,
|
|
22
|
+
enum: ['pending', 'paid', 'failed', 'refunded', 'waived', 'cancelled', 'disputed'],
|
|
23
|
+
default: 'pending',
|
|
24
|
+
index: true,
|
|
25
|
+
},
|
|
26
|
+
reference: { type: String, default: null },
|
|
27
|
+
externalReference: { type: String, default: null, index: true },
|
|
28
|
+
paymentMethod: {
|
|
29
|
+
type: String,
|
|
30
|
+
enum: ['mpesa', 'card', 'cash', 'other'],
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
33
|
+
payerType: {
|
|
34
|
+
type: String,
|
|
35
|
+
enum: ['tenant', 'landlord', 'owner', 'admin'],
|
|
36
|
+
default: 'tenant',
|
|
37
|
+
index: true,
|
|
38
|
+
},
|
|
39
|
+
paidAt: { type: Date, default: null },
|
|
40
|
+
notes: { type: String, default: null },
|
|
41
|
+
},
|
|
42
|
+
{ timestamps: true }
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const MoveInPayment = mongoose.model('MoveInPayment', moveInPaymentSchema);
|
|
46
|
+
module.exports = MoveInPayment;
|