payservedb 2.4.9 → 2.4.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/package.json +1 -1
- package/src/models/audit.js +17 -0
- package/src/models/company.js +1 -0
- package/src/models/invoice.js +0 -1
- package/src/models/lease.js +26 -0
- package/src/models/leasetemplate.js +13 -0
- package/src/models/reminder.js +0 -1
- package/src/models/report.js +14 -0
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const AuditSchema = new mongoose.Schema({
|
|
4
|
+
entityType: {
|
|
5
|
+
type: String,
|
|
6
|
+
enum: ['lease', 'invoice'],
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
entityId: { type: mongoose.Schema.Types.ObjectId, required: true },
|
|
10
|
+
action: { type: String, required: true },
|
|
11
|
+
changedBy: { type: String, required: true },
|
|
12
|
+
changes: { type: mongoose.Schema.Types.Mixed, required: true },
|
|
13
|
+
timestamp: { type: Date, default: Date.now },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
module.exports = mongoose.model('Audit', AuditSchema);
|
|
17
|
+
|
package/src/models/company.js
CHANGED
|
@@ -17,6 +17,7 @@ const companySchema = new mongoose.Schema({
|
|
|
17
17
|
city: { type: String, required: true },
|
|
18
18
|
registrationNumber:{ type: String, required: true },
|
|
19
19
|
companyTaxNumber:{type:String,required:true},
|
|
20
|
+
companyPinNumber:{type:String,required:true},
|
|
20
21
|
logo: {
|
|
21
22
|
type: String,
|
|
22
23
|
trim: false,
|
package/src/models/invoice.js
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const LeaseSchema = new mongoose.Schema({
|
|
4
|
+
customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer', required: true },
|
|
5
|
+
startDate: { type: Date, required: true },
|
|
6
|
+
endDate: { type: Date, required: true },
|
|
7
|
+
facilityId: { type: mongoose.Schema.Types.ObjectId, ref: 'Facility', required: true },
|
|
8
|
+
rentValue: { type: Number, required: true, min: 0 },
|
|
9
|
+
paymentFrequency: {
|
|
10
|
+
type: String,
|
|
11
|
+
enum: ['monthly', 'quarterly', 'annually'],
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
levies: { type: [LevySchema], default: [] },
|
|
15
|
+
penalties: { type: [PenaltySchema], default: [] },
|
|
16
|
+
status: {
|
|
17
|
+
type: String,
|
|
18
|
+
enum: ['active', 'expired', 'terminated', 'draft'],
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
templateId: { type: mongoose.Schema.Types.ObjectId, ref: 'LeaseTemplate', required: true },
|
|
22
|
+
signedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
|
|
23
|
+
unsignedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
module.exports = mongoose.model('Lease', LeaseSchema);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const LeaseTemplateSchema = new mongoose.Schema({
|
|
5
|
+
name: { type: String, required: true },
|
|
6
|
+
description: { type: String, required: true },
|
|
7
|
+
templateContent: { type: String, required: true },
|
|
8
|
+
createdBy: { type: String, required: true },
|
|
9
|
+
createdAt: { type: Date, default: Date.now },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
module.exports = mongoose.model('LeaseTemplate', LeaseTemplateSchema);
|
|
13
|
+
|
package/src/models/reminder.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const ReportSchema = new mongoose.Schema({
|
|
4
|
+
type: {
|
|
5
|
+
type: String,
|
|
6
|
+
enum: ['revenue', 'leasePerformance', 'expiredLeases'],
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
data: { type: mongoose.Schema.Types.Mixed, required: true },
|
|
10
|
+
generatedAt: { type: Date, default: Date.now },
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
module.exports = mongoose.model('Report', ReportSchema);
|
|
14
|
+
|