payservedb 2.9.3 → 2.9.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "2.9.3",
3
+ "version": "2.9.5",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -3,35 +3,18 @@ const mongoose = require('mongoose');
3
3
  const requisitionSchema = new mongoose.Schema({
4
4
  facilityId: {
5
5
  type: mongoose.Schema.Types.ObjectId,
6
- ref: 'Facility',
7
- required: true,
6
+ ref: 'Facility',
7
+ required: [true, 'Facility ID is required']
8
8
  },
9
- spareOrStockId: {
9
+ stockId: {
10
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,
11
+ ref: 'Stocksandspare',
12
+ required: [true, 'stock ID is required']
18
13
  },
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: {
14
+ description: {
30
15
  type: String,
31
- enum: ['Pending', 'Approved', 'Rejected', 'Completed'],
32
16
  required: true,
33
- default: 'Pending',
34
- },
17
+ }
35
18
  }, {
36
19
  timestamps: true,
37
20
  });
@@ -1,19 +1,63 @@
1
1
  const mongoose = require('mongoose');
2
2
 
3
3
  const SettingsSchema = new mongoose.Schema({
4
+ // Basic Settings
4
5
  name: {
5
6
  type: String,
6
- required:true
7
+ required: [true, 'Name is required']
7
8
  },
8
9
  size: {
9
10
  type: String,
10
- required:true
11
+ required: [true, 'Size is required']
11
12
  },
12
-
13
+
14
+ // Tax Settings
15
+ taxSettings: [{
16
+ facilityId: {
17
+ type: mongoose.Schema.Types.ObjectId,
18
+ ref: 'Facility',
19
+ required: [true, 'Facility ID is required']
20
+ },
21
+ taxRate: {
22
+ type: Number,
23
+ required: [true, 'Tax rate is required'],
24
+ min: [0, 'Tax rate cannot be negative']
25
+ },
26
+ country: {
27
+ type: String,
28
+ required: [true, 'Country is required'],
29
+ trim: true,
30
+ minlength: [1, 'Country name must be at least 1 character long']
31
+ },
32
+ currency: {
33
+ type: String,
34
+ required: [true, 'Currency is required'],
35
+ trim: true,
36
+ minlength: [1, 'Currency code must be at least 1 character long']
37
+ }
38
+ }],
39
+
40
+ // Invoice Settings
41
+ invoiceSettings: {
42
+ termsAndConditions: {
43
+ type: String,
44
+ default: 'Payment is due within 15 days'
45
+ },
46
+ paymentDetails: {
47
+ bankName: {
48
+ type: String,
49
+ required: [true, 'Bank name is required']
50
+ },
51
+ accountNumber: {
52
+ type: String,
53
+ required: [true, 'Account number is required']
54
+ }
55
+ }
56
+ }
13
57
  }, {
14
- timestamps: true, // Automatically add createdAt and updatedAt fields
58
+ timestamps: true
15
59
  });
16
60
 
17
61
  const Settings = mongoose.model('Settings', SettingsSchema);
18
62
 
19
- module.exports = Settings;
63
+ module.exports = Settings;
@@ -14,35 +14,35 @@ const ticketSchema = new mongoose.Schema({
14
14
  type: String,
15
15
  },
16
16
  description: {
17
- type: String,
17
+ type: String,
18
18
  },
19
19
  priority: {
20
- type: String,
20
+ type: String,
21
21
  },
22
22
  image: {
23
23
  type: String,
24
24
  },
25
25
  date: {
26
- type: Date,
26
+ type: Date,
27
27
  },
28
28
  time: {
29
29
  type: String,
30
30
  },
31
31
  extras: {
32
- type: String,
32
+ type: String,
33
33
  },
34
34
  status: {
35
35
  type: String,
36
- enum: ['open', 'on hold', 'ongoing', 'resolved', 'cancelled', 'closed'],
37
- required: true,
38
- default: 'open',
36
+ enum: ['open', 'on hold', 'ongoing', 'resolved', 'cancelled', 'closed'],
37
+ required: true,
38
+ default: 'open',
39
39
  },
40
40
  customerId: {
41
41
  type: mongoose.Schema.Types.ObjectId,
42
42
  ref: 'Customer',
43
43
  },
44
44
  ticketNumber: {
45
- type: Number,
45
+ type: Number,
46
46
  },
47
47
  needsFix: {
48
48
  type: String,
@@ -67,9 +67,21 @@ const ticketSchema = new mongoose.Schema({
67
67
  type: String,
68
68
  required: false,
69
69
  },
70
- amount: {
70
+ services: [
71
+ {
72
+ description: {
73
+ type: String,
74
+ required: false,
75
+ },
76
+ amount: {
77
+ type: Number,
78
+ required: true,
79
+ },
80
+ },
81
+ ],
82
+ totalAmount: {
71
83
  type: Number,
72
- required: false,
84
+ required: false
73
85
  },
74
86
  payer: {
75
87
  type: String,
@@ -79,16 +91,12 @@ const ticketSchema = new mongoose.Schema({
79
91
  type: Boolean,
80
92
  default: false,
81
93
  },
82
- serviceDescription: {
83
- type: [String],
84
- required: false
85
- },
86
94
  costAttachment: {
87
- type: String,
88
- required: false
89
- }
95
+ type: String,
96
+ required: false,
97
+ },
90
98
  }, {
91
- timestamps: true,
99
+ timestamps: true,
92
100
  });
93
101
 
94
- module.exports = mongoose.model('Ticket', ticketSchema);
102
+ module.exports = mongoose.model('Ticket', ticketSchema);