database-connector 2.3.8 → 2.3.10

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/CHANGELOG.md CHANGED
@@ -13,9 +13,11 @@
13
13
  - **Product Model**: Updated `rayonId` field to reference the new `Rayon` model
14
14
  - Changed from untyped ObjectId to proper `ref: 'Rayon'` reference
15
15
  - Updated Swagger documentation to reflect model reference
16
+ - Added `subRayonId` field (ObjectId, nullable) to reference sub-rayons within Rayon model
16
17
  - **Store Model**: Refactored `storeRayons` field from embedded objects to ObjectId references
17
- - Changed from array of embedded objects with `name` field to array of ObjectId references
18
- - Now references the `Rayon` model for better data normalization
18
+ - Changed from array of embedded objects with `name` field to structured array with `rayonId` and `subRayons`
19
+ - Now references the `Rayon` model with support for sub-rayons (similar to `productCategorieIds` structure)
20
+ - Structure: `{ rayonId: ObjectId, subRayons: [ObjectId] }`
19
21
  - **Database Schema Documentation**: Updated `DATABASE_SCHEMA.md`
20
22
  - Added Rayon entity to ER diagram
21
23
  - Added Rayon model description in Catalog Models section
package/models/Product.js CHANGED
@@ -42,6 +42,9 @@ const { policySchema } = require('database-connector/models/Policy');
42
42
  * rayonId:
43
43
  * type: string
44
44
  * description: Reference to Rayon model
45
+ * subRayonId:
46
+ * type: string
47
+ * description: Reference to sub-rayon within Rayon model
45
48
  * images:
46
49
  * type: array
47
50
  * items:
@@ -123,6 +126,10 @@ const productSchema = new mongoose.Schema(
123
126
  ref: 'Rayon',
124
127
  // required: true,
125
128
  },
129
+ subRayonId: {
130
+ type: mongoose.Schema.Types.ObjectId,
131
+ default: null
132
+ },
126
133
  //customCategory: { type: String, required: true },
127
134
  //customCategoryId: { type: String, required: true },
128
135
  images: [{ type: String, required: true }],
package/models/Store.js CHANGED
@@ -90,6 +90,20 @@ const { policySchema } = require('database-connector/models/Policy');
90
90
  * subscriptionId:
91
91
  * type: string
92
92
  * description: Reference to subscription
93
+ * storeRayons:
94
+ * type: array
95
+ * items:
96
+ * type: object
97
+ * properties:
98
+ * rayonId:
99
+ * type: string
100
+ * description: Reference to Rayon model
101
+ * subRayons:
102
+ * type: array
103
+ * items:
104
+ * type: string
105
+ * description: Array of sub-rayon ObjectIds
106
+ * description: Store rayons with their sub-rayons
93
107
  * reports:
94
108
  * type: array
95
109
  * items:
@@ -342,8 +356,15 @@ const storeSchema = new mongoose.Schema(
342
356
  ],
343
357
  storeRayons: [
344
358
  {
345
- type: mongoose.Schema.Types.ObjectId,
346
- ref: 'Rayon',
359
+ rayonId: {
360
+ type: mongoose.Schema.Types.ObjectId,
361
+ ref: 'Rayon',
362
+ },
363
+ subRayons: [
364
+ {
365
+ type: mongoose.Schema.Types.ObjectId,
366
+ },
367
+ ],
347
368
  },
348
369
  ],
349
370
  templateId: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "database-connector",
3
- "version": "2.3.8",
3
+ "version": "2.3.10",
4
4
  "description": "MongoDB models package with Mongoose schemas for e-commerce applications. Includes User, Product, Store, Order and more with built-in validation and virtual properties.",
5
5
  "main": "models/index.js",
6
6
  "scripts": {