payservedb 8.8.0 → 8.8.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/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const mongoose = require("mongoose");
|
|
2
|
+
const whatsapp_conversation = require("./src/models/whatsapp_conversation");
|
|
2
3
|
require("dotenv").config();
|
|
3
4
|
|
|
4
5
|
// Maintain a record of open connections for each database
|
|
@@ -247,7 +248,8 @@ const models = {
|
|
|
247
248
|
QuickBooksConfig: require("./src/models/quickbooks_config"),
|
|
248
249
|
PrivacyPolicy: require("./src/models/privacy_policy"),
|
|
249
250
|
TermsAndConditions: require("./src/models/terms_and_conditions"),
|
|
250
|
-
CommunityGuidelines: require("./src/models/community_guidelines")
|
|
251
|
+
CommunityGuidelines: require("./src/models/community_guidelines"),
|
|
252
|
+
WhatsappConversation : require("./src/models/whatsapp_conversation")
|
|
251
253
|
};
|
|
252
254
|
|
|
253
255
|
// Function to get models dynamically from a specific database connection
|
package/package.json
CHANGED
|
@@ -94,7 +94,7 @@ const cashPaymentSchema = new mongoose.Schema(
|
|
|
94
94
|
},
|
|
95
95
|
paymentMethod: {
|
|
96
96
|
type: String,
|
|
97
|
-
enum: ['cash', 'bank-transfer', 'cheque'
|
|
97
|
+
enum: ['cash', 'bank-transfer', 'cheque'],
|
|
98
98
|
default: 'cash'
|
|
99
99
|
},
|
|
100
100
|
exchangeRate: {
|
|
@@ -288,4 +288,3 @@ cashPaymentSchema.pre('save', function (next) {
|
|
|
288
288
|
const CashPayment = mongoose.models.CashPayment || mongoose.model('CashPayment', cashPaymentSchema);
|
|
289
289
|
|
|
290
290
|
module.exports = CashPayment;
|
|
291
|
-
|
|
@@ -35,12 +35,14 @@ const serviceRequestSchema = new mongoose.Schema({
|
|
|
35
35
|
enum: ['ADMIN', 'RESIDENT'],
|
|
36
36
|
default: 'RESIDENT'
|
|
37
37
|
},
|
|
38
|
+
requestNumber: { type: String, unique: true },
|
|
38
39
|
description: { type: String },
|
|
39
40
|
date: { type: Date },
|
|
40
41
|
time: { type: String },
|
|
41
42
|
frequency: { type: String },
|
|
42
43
|
amount: { type: Number },
|
|
43
44
|
attachment: { type: String },
|
|
45
|
+
notes: { type: String },
|
|
44
46
|
}, {
|
|
45
47
|
timestamps: true
|
|
46
48
|
});
|
package/src/models/units.js
CHANGED
|
@@ -61,6 +61,18 @@ const unitSchema = new mongoose.Schema({
|
|
|
61
61
|
default: false
|
|
62
62
|
},
|
|
63
63
|
|
|
64
|
+
// ── Move-In portal listing fields ──────────────────────────────────────
|
|
65
|
+
listedInMoveIn: { type: Boolean, default: false, index: true },
|
|
66
|
+
listingType: { type: String, enum: ['rent', 'sale'], default: 'rent' },
|
|
67
|
+
moveInPrice: { type: Number, default: null },
|
|
68
|
+
moveInBedrooms: { type: Number, default: null },
|
|
69
|
+
moveInBathrooms: { type: Number, default: null },
|
|
70
|
+
moveInDescription: { type: String, default: null },
|
|
71
|
+
moveInImages: { type: [String], default: [] },
|
|
72
|
+
moveInAmenities: { type: [String], default: [] },
|
|
73
|
+
moveInApproval: { type: String, enum: ['pending', 'approved', 'rejected'], default: null, index: true },
|
|
74
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
75
|
+
|
|
64
76
|
occupants: [
|
|
65
77
|
{
|
|
66
78
|
customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer' },
|
package/src/models/user.js
CHANGED
|
@@ -22,10 +22,10 @@ const userSchema = new mongoose.Schema({
|
|
|
22
22
|
type: String,
|
|
23
23
|
required: false
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
type: {
|
|
26
26
|
type: String,
|
|
27
27
|
required: [true, 'Type is required'],
|
|
28
|
-
enum: ['Company', 'Project Manager', 'Universal', 'Core', 'Resident', 'Landlord', 'Supplier', 'Customer_Support'],
|
|
28
|
+
enum: ['Company', 'Project Manager', 'Universal', 'Core', 'Resident', 'Landlord', 'Supplier', 'Customer_Support', 'Customer'],
|
|
29
29
|
},
|
|
30
30
|
department: {
|
|
31
31
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -126,6 +126,7 @@ const userSchema = new mongoose.Schema({
|
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
kyc: {
|
|
129
|
+
|
|
129
130
|
Id: {
|
|
130
131
|
type: String
|
|
131
132
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const whatsAppConversationSchema = new mongoose.Schema({
|
|
4
|
+
wa_message_id: { type: String },
|
|
5
|
+
chat_id: { type: String, required: true },
|
|
6
|
+
contact_name: { type: String },
|
|
7
|
+
contact_phone: { type: String },
|
|
8
|
+
direction: { type: String, enum: ['inbound', 'outbound'] },
|
|
9
|
+
message_text: { type: String },
|
|
10
|
+
message_type: { type: String, default: 'text' },
|
|
11
|
+
timestamp: { type: Date },
|
|
12
|
+
is_read: { type: Boolean, default: false },
|
|
13
|
+
replied_by: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
|
14
|
+
linked_ticket_id: { type: mongoose.Schema.Types.ObjectId, ref: 'CustomerTicket', default: null },
|
|
15
|
+
linked_by: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
|
16
|
+
linked_at: { type: Date },
|
|
17
|
+
created_at: { type: Date, default: Date.now }
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
whatsAppConversationSchema.index({ chat_id: 1, timestamp: -1 });
|
|
21
|
+
whatsAppConversationSchema.index({ linked_ticket_id: 1 });
|
|
22
|
+
|
|
23
|
+
module.exports = mongoose.model('WhatsAppConversation', whatsAppConversationSchema);
|