database-connector 2.3.9 → 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
@@ -15,8 +15,9 @@
15
15
  - Updated Swagger documentation to reflect model reference
16
16
  - Added `subRayonId` field (ObjectId, nullable) to reference sub-rayons within Rayon model
17
17
  - **Store Model**: Refactored `storeRayons` field from embedded objects to ObjectId references
18
- - Changed from array of embedded objects with `name` field to array of ObjectId references
19
- - 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] }`
20
21
  - **Database Schema Documentation**: Updated `DATABASE_SCHEMA.md`
21
22
  - Added Rayon entity to ER diagram
22
23
  - Added Rayon model description in Catalog Models section
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.9",
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": {