database-connector 2.4.15 → 2.4.17
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/Plan.js +34 -11
- package/models/PlanType.js +14 -5
- package/models/ReductionOffer.js +0 -9
- package/models/Settings.js +9 -0
- package/package.json +1 -1
package/models/Plan.js
CHANGED
|
@@ -23,10 +23,18 @@ const mongoose = require('mongoose');
|
|
|
23
23
|
* price:
|
|
24
24
|
* type: number
|
|
25
25
|
* description: Plan price for one store
|
|
26
|
-
*
|
|
27
|
-
* type:
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* storeReductionRules:
|
|
27
|
+
* type: array
|
|
28
|
+
* items:
|
|
29
|
+
* type: object
|
|
30
|
+
* properties:
|
|
31
|
+
* storeNumber:
|
|
32
|
+
* type: number
|
|
33
|
+
* description: The store position number (2 for second store, 3 for third, etc.)
|
|
34
|
+
* reductionPercentage:
|
|
35
|
+
* type: number
|
|
36
|
+
* description: Percentage of reduction for this store number
|
|
37
|
+
* description: Array of reduction rules for each additional store. First store uses full plan price.
|
|
30
38
|
* reductionOffers:
|
|
31
39
|
* type: array
|
|
32
40
|
* items:
|
|
@@ -42,7 +50,13 @@ const mongoose = require('mongoose');
|
|
|
42
50
|
* type: "Annual"
|
|
43
51
|
* months: 12
|
|
44
52
|
* price: 99.99
|
|
45
|
-
*
|
|
53
|
+
* storeReductionRules:
|
|
54
|
+
* - storeNumber: 2
|
|
55
|
+
* reductionPercentage: 10
|
|
56
|
+
* - storeNumber: 3
|
|
57
|
+
* reductionPercentage: 15
|
|
58
|
+
* - storeNumber: 4
|
|
59
|
+
* reductionPercentage: 20
|
|
46
60
|
* status: "active"
|
|
47
61
|
*/
|
|
48
62
|
const planSchema = new mongoose.Schema(
|
|
@@ -61,12 +75,21 @@ const planSchema = new mongoose.Schema(
|
|
|
61
75
|
type: Number,
|
|
62
76
|
required: true,
|
|
63
77
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
storeReductionRules: [
|
|
79
|
+
{
|
|
80
|
+
storeNumber: {
|
|
81
|
+
type: Number,
|
|
82
|
+
required: true,
|
|
83
|
+
min: 2,
|
|
84
|
+
},
|
|
85
|
+
reductionPercentage: {
|
|
86
|
+
type: Number,
|
|
87
|
+
required: true,
|
|
88
|
+
min: 0,
|
|
89
|
+
max: 100,
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
],
|
|
70
93
|
reductionOffers: [
|
|
71
94
|
{
|
|
72
95
|
type: mongoose.Schema.Types.ObjectId,
|
package/models/PlanType.js
CHANGED
|
@@ -15,14 +15,17 @@ const mongoose = require('mongoose');
|
|
|
15
15
|
* name:
|
|
16
16
|
* type: string
|
|
17
17
|
* description: Unique name for the plan type
|
|
18
|
-
*
|
|
18
|
+
* scheduled:
|
|
19
19
|
* type: string
|
|
20
20
|
* format: date-time
|
|
21
|
-
* description:
|
|
21
|
+
* description: Scheduled date to toggle active status (can be null). When this date is reached, active status is toggled and scheduled is reset to null.
|
|
22
22
|
* active:
|
|
23
23
|
* type: boolean
|
|
24
24
|
* default: true
|
|
25
|
-
* description: Whether this plan type is currently active
|
|
25
|
+
* description: Whether this plan type is currently active (has priority over monthsEnabled)
|
|
26
|
+
* monthsEnabled:
|
|
27
|
+
* type: number
|
|
28
|
+
* description: Number of months the plan type is available/visible (can be null). Active attribute has priority.
|
|
26
29
|
* features:
|
|
27
30
|
* type: object
|
|
28
31
|
* additionalProperties:
|
|
@@ -44,8 +47,9 @@ const mongoose = require('mongoose');
|
|
|
44
47
|
* example:
|
|
45
48
|
* id: "507f1f77bcf86cd799439011"
|
|
46
49
|
* name: "Premium"
|
|
47
|
-
*
|
|
50
|
+
* scheduled: null
|
|
48
51
|
* active: true
|
|
52
|
+
* monthsEnabled: 12
|
|
49
53
|
* features:
|
|
50
54
|
* socialMedia: true
|
|
51
55
|
* BIanalytics: false
|
|
@@ -60,7 +64,7 @@ const planTypeSchema = new mongoose.Schema(
|
|
|
60
64
|
required: true,
|
|
61
65
|
unique: true,
|
|
62
66
|
},
|
|
63
|
-
|
|
67
|
+
scheduled: {
|
|
64
68
|
type: Date,
|
|
65
69
|
required: false,
|
|
66
70
|
default: null,
|
|
@@ -69,6 +73,11 @@ const planTypeSchema = new mongoose.Schema(
|
|
|
69
73
|
type: Boolean,
|
|
70
74
|
default: true,
|
|
71
75
|
},
|
|
76
|
+
monthsEnabled: {
|
|
77
|
+
type: Number,
|
|
78
|
+
required: false,
|
|
79
|
+
default: null,
|
|
80
|
+
},
|
|
72
81
|
features: {
|
|
73
82
|
type: Map,
|
|
74
83
|
of: mongoose.Schema.Types.Mixed,
|
package/models/ReductionOffer.js
CHANGED
|
@@ -20,9 +20,6 @@ const mongoose = require('mongoose');
|
|
|
20
20
|
* discount:
|
|
21
21
|
* type: number
|
|
22
22
|
* description: Discount amount or percentage
|
|
23
|
-
* additionalStoreReductionPercentage:
|
|
24
|
-
* type: number
|
|
25
|
-
* description: Percentage of reduction on each new store added (can be null for no reduction)
|
|
26
23
|
* plan:
|
|
27
24
|
* type: string
|
|
28
25
|
* description: Reference to the plan
|
|
@@ -67,12 +64,6 @@ const ReductionOfferSchema = new mongoose.Schema(
|
|
|
67
64
|
type: Number,
|
|
68
65
|
required: true,
|
|
69
66
|
},
|
|
70
|
-
additionalStoreReductionPercentage: {
|
|
71
|
-
type: Number,
|
|
72
|
-
default: null,
|
|
73
|
-
min: 0,
|
|
74
|
-
max: 100,
|
|
75
|
-
},
|
|
76
67
|
plan: {
|
|
77
68
|
type: mongoose.Schema.Types.ObjectId,
|
|
78
69
|
required: true,
|
package/models/Settings.js
CHANGED
|
@@ -18,6 +18,10 @@ const mongoose = require('mongoose');
|
|
|
18
18
|
* type: number
|
|
19
19
|
* default: 15
|
|
20
20
|
* description: Maximum number of targeted users for system operations
|
|
21
|
+
* max_stores_in_plan:
|
|
22
|
+
* type: number
|
|
23
|
+
* default: 10
|
|
24
|
+
* description: Maximum number of stores allowed in a plan
|
|
21
25
|
* createdAt:
|
|
22
26
|
* type: string
|
|
23
27
|
* format: date-time
|
|
@@ -28,6 +32,7 @@ const mongoose = require('mongoose');
|
|
|
28
32
|
* id: "507f1f77bcf86cd799439011"
|
|
29
33
|
* max_pollution_threshold: 20
|
|
30
34
|
* max_targeted_users: 15
|
|
35
|
+
* max_stores_in_plan: 10
|
|
31
36
|
* createdAt: "2025-11-01T10:30:00.000Z"
|
|
32
37
|
* updatedAt: "2025-12-01T15:45:00.000Z"
|
|
33
38
|
*/
|
|
@@ -41,6 +46,10 @@ const SettingsSchema = new mongoose.Schema(
|
|
|
41
46
|
type: Number,
|
|
42
47
|
default: 15,
|
|
43
48
|
},
|
|
49
|
+
max_stores_in_plan: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 10,
|
|
52
|
+
},
|
|
44
53
|
},
|
|
45
54
|
{
|
|
46
55
|
timestamps: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "database-connector",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.17",
|
|
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": {
|