payservedb 5.1.0 → 5.1.1
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 +2 -3
- package/src/models/levycontract.js +82 -79
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payservedb",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"dotenv": "^16.4.5",
|
|
14
14
|
"moment-timezone": "^0.5.47",
|
|
15
|
-
"mongoose": "^8.3.5"
|
|
16
|
-
"payservedb": "^5.0.9"
|
|
15
|
+
"mongoose": "^8.3.5"
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -1,83 +1,86 @@
|
|
|
1
1
|
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
4
|
+
const LevyContractSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
contractName: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: [true, 'Contract name is required']
|
|
9
|
+
},
|
|
10
|
+
levyId: {
|
|
11
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
12
|
+
ref: 'Levy',
|
|
13
|
+
required: [true, 'Levy ID is required']
|
|
14
|
+
},
|
|
15
|
+
customerId: {
|
|
16
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
17
|
+
ref: 'Customer',
|
|
18
|
+
required: [true, 'Customer ID is required']
|
|
19
|
+
},
|
|
20
|
+
unitId: {
|
|
21
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
22
|
+
ref: 'Unit',
|
|
23
|
+
required: [true, 'Unit ID is required']
|
|
24
|
+
},
|
|
25
|
+
amount: {
|
|
26
|
+
type: Number,
|
|
27
|
+
required: [true, 'Amount is required'],
|
|
28
|
+
min: [0, 'Amount cannot be negative']
|
|
29
|
+
},
|
|
30
|
+
startDate: {
|
|
31
|
+
type: Date,
|
|
32
|
+
required: [true, 'Start date is required']
|
|
33
|
+
},
|
|
34
|
+
endDate: {
|
|
35
|
+
type: Date,
|
|
36
|
+
required: [true, 'End date is required']
|
|
37
|
+
},
|
|
38
|
+
status: {
|
|
39
|
+
type: String,
|
|
40
|
+
enum: ['Active', 'Inactive', 'Completed', 'Suspended', 'Terminated'],
|
|
41
|
+
default: 'Active',
|
|
42
|
+
required: [true, 'Status is required']
|
|
43
|
+
},
|
|
44
|
+
// Replace single doubleEntryAccount with two separate accounts
|
|
45
|
+
invoiceDoubleEntryAccount: {
|
|
46
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
47
|
+
ref: 'GLAccountDoubleEntries',
|
|
48
|
+
required: [true, 'Invoice double entry account is required']
|
|
49
|
+
},
|
|
50
|
+
paymentDoubleEntryAccount: {
|
|
51
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
52
|
+
ref: 'GLAccountDoubleEntries',
|
|
53
|
+
required: [true, 'Payment double entry account is required']
|
|
54
|
+
},
|
|
55
|
+
balanceBroughtForward: {
|
|
56
|
+
type: Number,
|
|
57
|
+
default: 0
|
|
58
|
+
},
|
|
59
|
+
paymentFrequency: {
|
|
60
|
+
type: String,
|
|
61
|
+
enum: ['Daily', 'Weekly', 'Bi-Weekly', 'Monthly', 'Quarterly', 'Semi-Annually', 'Annually'],
|
|
62
|
+
default: 'Monthly'
|
|
63
|
+
},
|
|
64
|
+
facilityId: {
|
|
65
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
66
|
+
ref: 'Facility',
|
|
67
|
+
required: [true, 'Facility ID is required']
|
|
68
|
+
},
|
|
69
|
+
createdBy: {
|
|
70
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
71
|
+
ref: 'User'
|
|
72
|
+
},
|
|
73
|
+
updatedBy: {
|
|
74
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
75
|
+
ref: 'User'
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const LevyContract = mongoose.model('LevyContract', levyContractSchema);
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
timestamps: true,
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
82
|
|
|
83
|
-
module.exports =
|
|
83
|
+
module.exports = {
|
|
84
|
+
schema: LevyContractSchema,
|
|
85
|
+
name: 'LevyContract'
|
|
86
|
+
};
|