payservedb 1.3.8 → 1.3.9

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
@@ -68,7 +68,10 @@ const models = {
68
68
  EntryExit:require('./src/models/entry_exit'),
69
69
  Guard:require('./src/models/guard'),
70
70
  Visitor:require('./src/models/visitor'),
71
- VisitLog:require('./src/models/visitLog')
71
+ VisitLog:require('./src/models/visitLog'),
72
+ Contract:require('./src/models/contract'),
73
+ Levy:require('./src/models/levy'),
74
+ LevyType:require('./src/models/levytype')
72
75
  };
73
76
 
74
77
  // Function to get models dynamically from a specific database connection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -12,4 +12,4 @@
12
12
  "dependencies": {
13
13
  "mongoose": "^8.3.5"
14
14
  }
15
- }
15
+ }
@@ -0,0 +1,32 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const contractSchema = new mongoose.Schema({
4
+ contractName: {
5
+ type: String,
6
+ required: true
7
+ },
8
+ contractPhoneNumber: {
9
+ type: String,
10
+ required: true
11
+ },
12
+ contractStart: {
13
+ type: Date,
14
+ required: true
15
+ },
16
+ contractEnd: {
17
+ type: Date,
18
+ required: true
19
+ },
20
+ facilityId: {
21
+ type: mongoose.Schema.Types.ObjectId,
22
+ ref: 'Facility',
23
+ required: true
24
+ },
25
+ },
26
+ { timestamps: true });
27
+
28
+ contractSchema.index({ contractName: 1 });
29
+
30
+ const Contract = mongoose.model('Contract', contractSchema);
31
+
32
+ module.exports = Contract;
@@ -0,0 +1,39 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const LevySchema = new mongoose.Schema({
4
+ levyName: {
5
+ type: String,
6
+ required: [true, 'Levy name is required'],
7
+ trim: true,
8
+ },
9
+ levyType: {
10
+ type: String,
11
+ required: [true, 'Levy type is required'],
12
+ trim: true,
13
+ },
14
+ levyApplicant: {
15
+ type: String,
16
+ required: [true, 'Levy applicant is required'],
17
+ trim: true,
18
+ },
19
+ collectionFrequency: {
20
+ type: String,
21
+ required: [true, 'Collection Frequency is required'],
22
+ trim: true,
23
+ },
24
+ invoiceDate: {
25
+ type: String,
26
+ required: [true, 'Invoice Date is required'],
27
+ trim: true,
28
+ },
29
+ facilityId: {
30
+ type: mongoose.Schema.Types.ObjectId,
31
+ ref: 'Facility',
32
+ }
33
+ }, {
34
+ timestamps: true, // Automatically add createdAt and updatedAt fields
35
+ });
36
+
37
+ const Levy = mongoose.model('Levy', LevySchema);
38
+
39
+ module.exports = Levy;
@@ -0,0 +1,19 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const LevyTypeSchema = new mongoose.Schema({
4
+ levyType: {
5
+ type: String,
6
+ required: [true, 'Levy type is required'],
7
+ trim: true,
8
+ },
9
+ facilityId: {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'Facility',
12
+ }
13
+ }, {
14
+ timestamps: true, // Automatically add createdAt and updatedAt fields
15
+ });
16
+
17
+ const LevyType = mongoose.model('LevyType', LevyTypeSchema);
18
+
19
+ module.exports = LevyType;