payservedb 3.7.6 → 3.7.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
@@ -122,6 +122,7 @@ const models = {
122
122
  Account: require('./src/models/account'),
123
123
  FacilityPaymentDetails: require('./src/models/facility_payment_details'),
124
124
  DefaultPaymentDetails: require('./src/models/default_payment_details'),
125
+ Currency: require('./src/models/currency_settings'),
125
126
  UserAccount: require('./src/models/user_account')
126
127
 
127
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "3.7.6",
3
+ "version": "3.7.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,35 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ // Define the schema for currency settings
4
+ const currencySchema = new mongoose.Schema({
5
+ facilityId: {
6
+ type: mongoose.Schema.Types.ObjectId,
7
+ ref: 'Facility',
8
+ required: true
9
+ },
10
+ currencyName: {
11
+ type: String,
12
+ required: [true, 'Currency name is required'],
13
+ trim: true,
14
+ },
15
+ currencyShortCode: {
16
+ type: String,
17
+ required: [true, 'Currency short code is required'],
18
+ trim: true,
19
+ uppercase: true,
20
+ minlength: [3, 'Currency short code must be 3 characters'],
21
+ maxlength: [3, 'Currency short code must be 3 characters']
22
+ },
23
+ isDefaultCurrency: {
24
+ type: Boolean,
25
+ default: false
26
+ }
27
+ }, {
28
+ timestamps: true
29
+ });
30
+
31
+ // Add any indexes if needed
32
+ currencySchema.index({ currencyShortCode: 1 }, { unique: true });
33
+
34
+ const Currency = mongoose.model('Currency', currencySchema);
35
+ module.exports = Currency;
@@ -6,6 +6,11 @@ const leaseAgreementSchema = new mongoose.Schema({
6
6
  ref: 'Facility',
7
7
  required: true
8
8
  },
9
+ currency: {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'Currency',
12
+ required: true
13
+ },
9
14
  unitNumber: {
10
15
  type: mongoose.Schema.Types.ObjectId,
11
16
  ref: 'Unit',
@@ -137,6 +142,9 @@ const leaseAgreementSchema = new mongoose.Schema({
137
142
  timestamps: true
138
143
  });
139
144
 
145
+ // Add index for multi-tenancy queries
146
+ leaseAgreementSchema.index({ facilityId: 1 });
147
+
140
148
  const LeaseAgreement = mongoose.model('LeaseAgreement', leaseAgreementSchema);
141
149
 
142
- module.exports = LeaseAgreement;
150
+ module.exports = LeaseAgreement;