payservedb 2.6.1 → 2.6.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/models/lease.js +71 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,32 +1,77 @@
1
1
  const mongoose = require("mongoose");
2
2
 
3
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
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ required: true
8
+ },
9
+ customerId: {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'Customer',
12
+ required: true
13
+ },
14
+ propertyManagerId: {
15
+ type: mongoose.Schema.Types.ObjectId,
16
+ ref: 'User',
17
+ required: true
18
+ },
19
+ startDate: {
20
+ type: Date,
21
+ required: true
22
+ },
23
+ endDate: {
24
+ type: Date,
25
+ required: true
26
+ },
27
+ rentValue: {
28
+ type: Number,
29
+ required: true,
30
+ min: 0
13
31
  },
14
32
  levies: [{
15
- type: mongoose.Schema.Types.ObjectId,
16
- ref: 'Levy'
17
- }],
33
+ type: mongoose.Schema.Types.ObjectId,
34
+ ref: 'Levy'
35
+ }],
36
+ securityDeposit: {
37
+ type: Number
38
+ },
39
+ responsibilities: {
40
+ type: String
41
+ },
18
42
  penalties: [{
19
- type: mongoose.Schema.Types.ObjectId,
20
- ref: 'Penalty'
21
- }],
22
- status: {
23
- type: String,
24
- enum: ['active', 'expired', 'terminated', 'draft'],
25
- required: true
26
- },
27
- templateId: { type: mongoose.Schema.Types.ObjectId, ref: 'LeaseTemplate', required: true },
28
- signedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
29
- unsignedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
30
- });
31
-
32
- module.exports = mongoose.model('Lease', LeaseSchema);
43
+ type: mongoose.Schema.Types.ObjectId,
44
+ ref: 'Penalty'
45
+ }],
46
+ paymentFrequency: {
47
+ type: String,
48
+ enum: ['monthly', 'quarterly', 'annually'],
49
+ required: true
50
+ },
51
+ status: {
52
+ type: String,
53
+ enum: ['active', 'expired', 'terminated', 'draft'],
54
+ required: true
55
+ },
56
+ templateId: {
57
+ type: mongoose.Schema.Types.ObjectId,
58
+ ref: 'LeaseTemplate',
59
+ required: true
60
+ },
61
+ signedCopy: {
62
+ type: String
63
+ },
64
+ unsignedCopyUrl: {
65
+ type: String,
66
+ match: /^https?:\/\/.*/,
67
+ required: false
68
+ },
69
+ createdAt: {
70
+ type: Date,
71
+ default: Date.now
72
+ }
73
+ });
74
+
75
+ const Lease = mongoose.model('Lease', LeaseSchema);
76
+
77
+ module.exports = Lease;