payservedb 3.1.1 → 3.1.3
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 +1 -1
- package/src/models/country_tax.js +25 -15
package/package.json
CHANGED
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
const mongoose = require('mongoose');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const countryTaxRateSchema = new mongoose.Schema({
|
|
3
|
+
const CountryTaxRateSchema = new mongoose.Schema({
|
|
5
4
|
facilityId: {
|
|
6
|
-
type:
|
|
7
|
-
|
|
8
|
-
required: [true, 'Facility ID is required']
|
|
5
|
+
type: String,
|
|
6
|
+
required: true
|
|
9
7
|
},
|
|
10
8
|
taxRate: {
|
|
11
9
|
type: Number,
|
|
12
|
-
required:
|
|
13
|
-
min: [0, 'Tax rate cannot be negative']
|
|
10
|
+
required: true
|
|
14
11
|
},
|
|
15
12
|
country: {
|
|
16
13
|
type: String,
|
|
17
|
-
required:
|
|
18
|
-
trim: true,
|
|
19
|
-
minlength: [1, 'Country name must be at least 1 character long']
|
|
14
|
+
required: true
|
|
20
15
|
},
|
|
21
16
|
currency: {
|
|
22
17
|
type: String,
|
|
23
|
-
required:
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
taxType: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
enum: [
|
|
24
|
+
'rental_income',
|
|
25
|
+
'capital_gains',
|
|
26
|
+
'vat',
|
|
27
|
+
'stamp_duty',
|
|
28
|
+
'land_rates',
|
|
29
|
+
'land_rent',
|
|
30
|
+
'withholding'
|
|
31
|
+
]
|
|
26
32
|
}
|
|
27
33
|
}, {
|
|
28
|
-
timestamps: true
|
|
34
|
+
timestamps: true
|
|
29
35
|
});
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
// Add compound index to ensure unique tax type per facility
|
|
38
|
+
CountryTaxRateSchema.index({ facilityId: 1, taxType: 1 }, { unique: true });
|
|
39
|
+
|
|
40
|
+
// Register the model
|
|
41
|
+
const CountryTaxRate = mongoose.model('CountryTaxRate', CountryTaxRateSchema);
|
|
32
42
|
|
|
33
43
|
module.exports = CountryTaxRate;
|