database-connector 2.3.9 → 2.3.11
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 +4 -2
- package/models/Rayon.js +20 -0
- package/models/Store.js +23 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
### Added
|
|
6
6
|
- **Rayon Model**: Created new independent `Rayon` model for product and store organization
|
|
7
7
|
- Schema includes `name` field and `subRayons` array for hierarchical organization
|
|
8
|
+
- Added `confirmed` boolean on rayon and sub-rayons (default: false)
|
|
8
9
|
- Added Swagger documentation for API endpoints
|
|
9
10
|
- Indexed `name` field for performance optimization
|
|
10
11
|
- Exported Rayon model in `models/index.js`
|
|
@@ -15,8 +16,9 @@
|
|
|
15
16
|
- Updated Swagger documentation to reflect model reference
|
|
16
17
|
- Added `subRayonId` field (ObjectId, nullable) to reference sub-rayons within Rayon model
|
|
17
18
|
- **Store Model**: Refactored `storeRayons` field from embedded objects to ObjectId references
|
|
18
|
-
- Changed from array of embedded objects with `name` field to array
|
|
19
|
-
- Now references the `Rayon` model for
|
|
19
|
+
- Changed from array of embedded objects with `name` field to structured array with `rayonId` and `subRayons`
|
|
20
|
+
- Now references the `Rayon` model with support for sub-rayons (similar to `productCategorieIds` structure)
|
|
21
|
+
- Structure: `{ rayonId: ObjectId, subRayons: [ObjectId] }`
|
|
20
22
|
- **Database Schema Documentation**: Updated `DATABASE_SCHEMA.md`
|
|
21
23
|
- Added Rayon entity to ER diagram
|
|
22
24
|
- Added Rayon model description in Catalog Models section
|
package/models/Rayon.js
CHANGED
|
@@ -15,6 +15,10 @@ const mongoose = require('mongoose');
|
|
|
15
15
|
* name:
|
|
16
16
|
* type: string
|
|
17
17
|
* description: Rayon name
|
|
18
|
+
* confirmed:
|
|
19
|
+
* type: boolean
|
|
20
|
+
* default: false
|
|
21
|
+
* description: Whether the rayon is confirmed
|
|
18
22
|
* subRayons:
|
|
19
23
|
* type: array
|
|
20
24
|
* items:
|
|
@@ -23,6 +27,10 @@ const mongoose = require('mongoose');
|
|
|
23
27
|
* name:
|
|
24
28
|
* type: string
|
|
25
29
|
* description: Sub-rayon name
|
|
30
|
+
* confirmed:
|
|
31
|
+
* type: boolean
|
|
32
|
+
* default: false
|
|
33
|
+
* description: Whether the sub-rayon is confirmed
|
|
26
34
|
* description: List of sub-rayons within this rayon
|
|
27
35
|
* createdAt:
|
|
28
36
|
* type: string
|
|
@@ -33,10 +41,14 @@ const mongoose = require('mongoose');
|
|
|
33
41
|
* example:
|
|
34
42
|
* id: "507f1f77bcf86cd799439011"
|
|
35
43
|
* name: "Electronics"
|
|
44
|
+
* confirmed: false
|
|
36
45
|
* subRayons:
|
|
37
46
|
* - name: "Mobile Phones"
|
|
47
|
+
* confirmed: false
|
|
38
48
|
* - name: "Laptops"
|
|
49
|
+
* confirmed: false
|
|
39
50
|
* - name: "Accessories"
|
|
51
|
+
* confirmed: false
|
|
40
52
|
* createdAt: "2025-11-01T10:30:00.000Z"
|
|
41
53
|
* updatedAt: "2025-12-01T15:45:00.000Z"
|
|
42
54
|
*/
|
|
@@ -46,12 +58,20 @@ const rayonSchema = new mongoose.Schema(
|
|
|
46
58
|
type: String,
|
|
47
59
|
required: true,
|
|
48
60
|
},
|
|
61
|
+
confirmed: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
49
65
|
subRayons: [
|
|
50
66
|
{
|
|
51
67
|
name: {
|
|
52
68
|
type: String,
|
|
53
69
|
required: true,
|
|
54
70
|
},
|
|
71
|
+
confirmed: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false,
|
|
74
|
+
},
|
|
55
75
|
},
|
|
56
76
|
],
|
|
57
77
|
},
|
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
|
-
|
|
346
|
-
|
|
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.
|
|
3
|
+
"version": "2.3.11",
|
|
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": {
|