database-connector 2.5.6 → 2.5.8

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/models/Policy.js CHANGED
@@ -19,17 +19,11 @@ const { Schema } = require('mongoose');
19
19
  * pickup:
20
20
  * type: object
21
21
  * properties:
22
- * enabled:
23
- * type: boolean
24
- * default: false
25
22
  * timeLimit:
26
23
  * type: number
27
24
  * delivery:
28
25
  * type: object
29
26
  * properties:
30
- * enabled:
31
- * type: boolean
32
- * default: false
33
27
  * delivery:
34
28
  * type: boolean
35
29
  * zone:
@@ -109,6 +103,12 @@ const { Schema } = require('mongoose');
109
103
  * order:
110
104
  * type: object
111
105
  * properties:
106
+ * enabled:
107
+ * type: boolean
108
+ * default: false
109
+ * autoValidateOrder:
110
+ * type: boolean
111
+ * default: false
112
112
  * notification:
113
113
  * type: object
114
114
  * properties:
@@ -167,13 +167,11 @@ const policySchema = new Schema(
167
167
  },
168
168
  pickup: {
169
169
  type: {
170
- enabled: { type: Boolean, default: false },
171
170
  timeLimit: { type: Number, default: null }
172
171
  }
173
172
  },
174
173
  delivery: {
175
174
  type: {
176
- enabled: { type: Boolean, default: false },
177
175
  delivery: { type: Boolean, default: null },
178
176
  zone: {
179
177
  centerPoint: {
@@ -226,6 +224,8 @@ const policySchema = new Schema(
226
224
  },
227
225
  order: {
228
226
  type: {
227
+ enabled: { type: Boolean, default: false },
228
+ autoValidateOrder: { type: Boolean, default: false },
229
229
  notification: {
230
230
  realtime: { type: Boolean, default: null },
231
231
  time: { type: Number, default: null },
package/models/Store.js CHANGED
@@ -22,9 +22,11 @@ const { policySchema } = require('database-connector/models/Policy');
22
22
  * description: Store name
23
23
  * sellerId:
24
24
  * type: string
25
- * description: Reference to the seller/owner
25
+ * description: Reference to the seller/owner (User ObjectId)
26
26
  * address:
27
27
  * type: object
28
+ * required:
29
+ * - city
28
30
  * properties:
29
31
  * city:
30
32
  * type: string
@@ -53,20 +55,92 @@ const { policySchema } = require('database-connector/models/Policy');
53
55
  * type: array
54
56
  * items:
55
57
  * type: number
56
- * description: [longitude, latitude]
58
+ * minItems: 2
59
+ * maxItems: 2
60
+ * description: "[longitude, latitude]"
57
61
  * image:
58
62
  * type: string
59
63
  * description: Store image URL
64
+ * customCategorie:
65
+ * type: array
66
+ * description: Custom categories defined by the store
67
+ * items:
68
+ * type: object
69
+ * required:
70
+ * - name
71
+ * properties:
72
+ * name:
73
+ * type: string
74
+ * productIds:
75
+ * type: array
76
+ * items:
77
+ * type: string
78
+ * description: Product ObjectId
79
+ * categories:
80
+ * type: array
81
+ * description: Store categories with associated products
82
+ * items:
83
+ * type: object
84
+ * required:
85
+ * - name
86
+ * properties:
87
+ * name:
88
+ * type: string
89
+ * productIds:
90
+ * type: array
91
+ * items:
92
+ * type: string
93
+ * description: Product ObjectId
94
+ * isActive:
95
+ * type: boolean
96
+ * default: true
97
+ * description: Whether the store is active
98
+ * policy:
99
+ * $ref: '#/components/schemas/Policy'
100
+ * description: Store policy (working time, pickup, delivery, reservation, return)
101
+ * offers:
102
+ * type: array
103
+ * description: Store offers/promotions
104
+ * items:
105
+ * type: object
106
+ * required:
107
+ * - name
108
+ * - description
109
+ * - discount
110
+ * properties:
111
+ * name:
112
+ * type: string
113
+ * description:
114
+ * type: string
115
+ * image:
116
+ * type: string
117
+ * timestamps:
118
+ * type: string
119
+ * format: date-time
120
+ * discount:
121
+ * type: number
122
+ * default: 0
123
+ * productId:
124
+ * type: string
125
+ * description: Product ObjectId
126
+ * followers:
127
+ * type: array
128
+ * description: Users following this store
129
+ * items:
130
+ * type: object
131
+ * properties:
132
+ * userId:
133
+ * type: string
134
+ * description: User ObjectId
135
+ * date:
136
+ * type: string
137
+ * format: date-time
60
138
  * description:
61
139
  * type: string
62
140
  * description: Store description
63
141
  * registrationNumber:
64
142
  * type: string
65
143
  * description: Store registration number
66
- * isActive:
67
- * type: boolean
68
- * default: true
69
- * description: Whether the store is active
70
144
  * ratingCount:
71
145
  * type: number
72
146
  * default: 0
@@ -75,10 +149,84 @@ const { policySchema } = require('database-connector/models/Policy');
75
149
  * type: number
76
150
  * default: 0
77
151
  * description: Sum of all ratings
152
+ * rating:
153
+ * type: number
154
+ * readOnly: true
155
+ * description: Computed virtual field (ratingSum / ratingCount)
78
156
  * revenue:
79
157
  * type: number
80
158
  * default: 0
81
159
  * description: Store revenue
160
+ * workingTime:
161
+ * type: object
162
+ * description: Store working hours configuration
163
+ * properties:
164
+ * option:
165
+ * type: string
166
+ * default: ""
167
+ * description: Working time option type
168
+ * fixedHours:
169
+ * type: array
170
+ * description: Fixed opening/closing hours
171
+ * items:
172
+ * type: object
173
+ * required:
174
+ * - openTime
175
+ * - closeTime
176
+ * properties:
177
+ * openTime:
178
+ * type: string
179
+ * closeTime:
180
+ * type: string
181
+ * customizedHours:
182
+ * type: object
183
+ * description: "Map of day-specific hours (key: day name, value: array of time slots)"
184
+ * additionalProperties:
185
+ * type: array
186
+ * items:
187
+ * type: object
188
+ * required:
189
+ * - openTime
190
+ * - closeTime
191
+ * properties:
192
+ * openTime:
193
+ * type: string
194
+ * closeTime:
195
+ * type: string
196
+ * storeCategorieIds:
197
+ * type: array
198
+ * description: References to StoreCategory documents
199
+ * items:
200
+ * type: string
201
+ * description: StoreCategory ObjectId
202
+ * productCategorieIds:
203
+ * type: array
204
+ * description: Product categories associated with the store
205
+ * items:
206
+ * type: object
207
+ * properties:
208
+ * categoryId:
209
+ * type: string
210
+ * description: Category ObjectId
211
+ * subCategories:
212
+ * type: array
213
+ * items:
214
+ * type: string
215
+ * description: Sub-category ObjectId
216
+ * storeRayons:
217
+ * type: array
218
+ * description: Store rayons with their sub-rayons
219
+ * items:
220
+ * type: object
221
+ * properties:
222
+ * rayonId:
223
+ * type: string
224
+ * description: Rayon ObjectId
225
+ * subRayons:
226
+ * type: array
227
+ * items:
228
+ * type: string
229
+ * description: Sub-rayon ObjectId
82
230
  * templateId:
83
231
  * type: number
84
232
  * default: 1
@@ -91,6 +239,30 @@ const { policySchema } = require('database-connector/models/Policy');
91
239
  * type: boolean
92
240
  * default: false
93
241
  * description: Whether the store is confirmed/verified
242
+ * subscriptionId:
243
+ * type: string
244
+ * description: Reference to Subscription ObjectId
245
+ * reports:
246
+ * type: array
247
+ * description: Store reports
248
+ * items:
249
+ * type: object
250
+ * required:
251
+ * - date
252
+ * properties:
253
+ * idUser:
254
+ * type: string
255
+ * description: User ObjectId of the reporter
256
+ * message:
257
+ * type: string
258
+ * description: Report message
259
+ * date:
260
+ * type: string
261
+ * format: date-time
262
+ * description: Report date
263
+ * qrCode:
264
+ * type: string
265
+ * description: QR Code associated with the store
94
266
  * physicalMerchantInfo:
95
267
  * type: object
96
268
  * description: Info specific to physical merchant (Commerçant physique)
@@ -120,6 +292,23 @@ const { policySchema } = require('database-connector/models/Policy');
120
292
  * type: number
121
293
  * realTimePosition:
122
294
  * type: boolean
295
+ * default: false
296
+ * marketCalendar:
297
+ * type: array
298
+ * description: Scheduled market dates and locations
299
+ * items:
300
+ * type: object
301
+ * properties:
302
+ * date:
303
+ * type: string
304
+ * location:
305
+ * type: string
306
+ * marketName:
307
+ * type: string
308
+ * latitude:
309
+ * type: number
310
+ * longitude:
311
+ * type: number
123
312
  * standPhoto:
124
313
  * type: string
125
314
  * visibleName:
@@ -136,6 +325,7 @@ const { policySchema } = require('database-connector/models/Policy');
136
325
  * type: string
137
326
  * visitPossible:
138
327
  * type: boolean
328
+ * default: false
139
329
  * labels:
140
330
  * type: array
141
331
  * items:
@@ -147,6 +337,7 @@ const { policySchema } = require('database-connector/models/Policy');
147
337
  * type: string
148
338
  * directSale:
149
339
  * type: boolean
340
+ * default: false
150
341
  * saleLocations:
151
342
  * type: array
152
343
  * items:
@@ -160,10 +351,14 @@ const { policySchema } = require('database-connector/models/Policy');
160
351
  * type: number
161
352
  * deliveryScope:
162
353
  * type: string
163
- * enum: [local, national]
354
+ * nullable: true
355
+ * enum: [local, national, null]
356
+ * default: null
164
357
  * availableQuantities:
165
358
  * type: string
166
- * enum: [small_series, volume, both]
359
+ * nullable: true
360
+ * enum: [small_series, volume, both, null]
361
+ * default: null
167
362
  * eMerchantInfo:
168
363
  * type: object
169
364
  * description: Info specific to e-merchant (E-commerçant)
@@ -176,39 +371,6 @@ const { policySchema } = require('database-connector/models/Policy');
176
371
  * type: string
177
372
  * approximateProductCount:
178
373
  * type: number
179
- * subscriptionId:
180
- * type: string
181
- * description: Reference to subscription
182
- * storeRayons:
183
- * type: array
184
- * items:
185
- * type: object
186
- * properties:
187
- * rayonId:
188
- * type: string
189
- * description: Reference to Rayon model
190
- * subRayons:
191
- * type: array
192
- * items:
193
- * type: string
194
- * description: Array of sub-rayon ObjectIds
195
- * description: Store rayons with their sub-rayons
196
- * reports:
197
- * type: array
198
- * items:
199
- * type: object
200
- * properties:
201
- * idUser:
202
- * type: string
203
- * description: Reference to user who reported
204
- * message:
205
- * type: string
206
- * description: Report message
207
- * date:
208
- * type: string
209
- * format: date-time
210
- * description: Report date
211
- * description: Store reports
212
374
  * createdAt:
213
375
  * type: string
214
376
  * format: date-time
@@ -224,8 +386,11 @@ const { policySchema } = require('database-connector/models/Policy');
224
386
  * isActive: true
225
387
  * ratingCount: 150
226
388
  * ratingSum: 735
389
+ * rating: 4.9
227
390
  * revenue: 25000
228
391
  * activated: true
392
+ * confirmed: false
393
+ * qrCode: "data:image/png;base64,..."
229
394
  * createdAt: "2025-11-01T10:30:00.000Z"
230
395
  * updatedAt: "2025-12-01T15:45:00.000Z"
231
396
  */
@@ -512,6 +677,8 @@ const storeSchema = new mongoose.Schema(
512
677
  date: { type: String },
513
678
  location: { type: String },
514
679
  marketName: { type: String },
680
+ latitude: { type: Number, default: null },
681
+ longitude: { type: Number, default: null },
515
682
  },
516
683
  ],
517
684
  standPhoto: { type: String, default: null },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "database-connector",
3
- "version": "2.5.6",
3
+ "version": "2.5.8",
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": {