payservedb 2.5.6 → 2.5.7

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
@@ -84,7 +84,10 @@ const models = {
84
84
  LeaseTemplate:require('./src/models/leasetemplate'),
85
85
  Report:require('./src/models/report'),
86
86
  Ticket:require('./src/models/tickets'),
87
- Stocksandspare:require('./src/models/stocksandspare')
87
+ Stocksandspare:require('./src/models/stocksandspare'),
88
+ ServiceVendor:require('./src/models/servicevendor'),
89
+ MaintenanceService:require('./src/models/maintenanceservice'),
90
+ Requisition:require('./src/models/maintenancerequisition')
88
91
 
89
92
  };
90
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -19,10 +19,6 @@ const assetSchema = new mongoose.Schema({
19
19
  type: String, // Year or full date, e.g., '2023' or '2023-01-01'
20
20
  required: true,
21
21
  },
22
- // assignedTo: {
23
- // type: String, // Name of the person or department the asset is assigned to
24
- // default: 'Unassigned', // Default if not yet assigned
25
- // }, Commented out, moved to the vendor schema
26
22
  insuranceStatus: {
27
23
  type: String,
28
24
  enum: ['Insured', 'Not Insured', 'Expired'],
@@ -0,0 +1,39 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const requisitionSchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ required: true,
8
+ },
9
+ spareOrStockId: {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'Stocksandspare',
12
+ required: true,
13
+ },
14
+ vendorId: {
15
+ type: mongoose.Schema.Types.ObjectId,
16
+ ref: 'ServiceVendor',
17
+ required: true,
18
+ },
19
+ date: {
20
+ type: Date,
21
+ required: true,
22
+ default: Date.now,
23
+ },
24
+ quantity: {
25
+ type: Number,
26
+ required: true,
27
+ min: 1,
28
+ },
29
+ status: {
30
+ type: String,
31
+ enum: ['Pending', 'Approved', 'Rejected', 'Completed'],
32
+ required: true,
33
+ default: 'Pending',
34
+ },
35
+ }, {
36
+ timestamps: true,
37
+ });
38
+
39
+ module.exports = mongoose.model('Requisition', requisitionSchema);
@@ -0,0 +1,17 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const maintenanceServiceSchema = new mongoose.Schema({
4
+ name: {
5
+ type: String,
6
+ required: true,
7
+ },
8
+ facilityId: {
9
+ type: mongoose.Schema.Types.ObjectId,
10
+ ref: 'Facility',
11
+ required: true,
12
+ },
13
+ }, {
14
+ timestamps: true,
15
+ });
16
+
17
+ module.exports = mongoose.model('MaintenanceService', maintenanceServiceSchema);
@@ -0,0 +1,34 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const serviceVendorSchema = new mongoose.Schema({
4
+ name: {
5
+ type: String,
6
+ required: true,
7
+ },
8
+ service: {
9
+ type: mongoose.Schema.Types.ObjectId,
10
+ ref: 'MaintenanceService',
11
+ required: true,
12
+ },
13
+ agreement: {
14
+ type: String,
15
+ required: true,
16
+ },
17
+ dates: {
18
+ type: [Date],
19
+ required: true,
20
+ },
21
+ assignedAssets: [{
22
+ type: mongoose.Schema.Types.ObjectId,
23
+ ref: 'Asset',
24
+ }],
25
+ facilityId: {
26
+ type: mongoose.Schema.Types.ObjectId,
27
+ ref: 'Facility',
28
+ required: true,
29
+ },
30
+ }, {
31
+ timestamps: true,
32
+ });
33
+
34
+ module.exports = mongoose.model('ServiceVendor', serviceVendorSchema);
@@ -20,25 +20,6 @@ const stockAndSparesSchema = new mongoose.Schema({
20
20
  required: true,
21
21
  min: 0,
22
22
  },
23
- requisitions: [
24
- {
25
- date: {
26
- type: Date,
27
- required: true,
28
- default: Date.now,
29
- },
30
- quantity: {
31
- type: Number,
32
- required: true,
33
- min: 1, // Minimum requisition is 1
34
- },
35
- status: {
36
- type: String,
37
- enum: ['Pending', 'Approved', 'Rejected', 'Completed'],
38
- required: true,
39
- },
40
- },
41
- ],
42
23
  }, {
43
24
  timestamps: true,
44
25
  });