@francesco_ksh/app-ksh-mgd-schemas 1.4.9 → 1.5.2

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.
@@ -28,7 +28,7 @@ const discountSchema = new Schema(
28
28
  type: Number,
29
29
  },
30
30
  appliesTo: {
31
- type: Array, // items, shipping, packaging
31
+ type: Array, // products, shipping, packaging
32
32
  },
33
33
 
34
34
  listings: [
@@ -45,7 +45,7 @@ const discountSchema = new Schema(
45
45
  type: Array,
46
46
  },
47
47
  minOrderValue: {
48
- required: {
48
+ isRequired: {
49
49
  type: Boolean,
50
50
  },
51
51
  value: {
@@ -76,11 +76,14 @@ const discountSchema = new Schema(
76
76
  },
77
77
  status: {
78
78
  type: String,
79
- enum: ['active', 'inactive', 'expired', 'scheduled', 'deleted'],
80
- },
81
- usedBy: {
82
- type: Array,
79
+ enum: ['active', 'inactive', 'expired', 'scheduled'],
83
80
  },
81
+ usedBy: [
82
+ {
83
+ type: Schema.Types.ObjectId,
84
+ ref: 'User',
85
+ },
86
+ ],
84
87
  date: {
85
88
  type: Date,
86
89
  default: Date.now,
package/models/Listing.js CHANGED
@@ -10,6 +10,24 @@ const listingSchema = new Schema(
10
10
  required: true,
11
11
  sparse: true,
12
12
  },
13
+ discounts: {
14
+ active: {
15
+ type: Boolean,
16
+ },
17
+ activeDiscount: {
18
+ type: Schema.Types.ObjectId,
19
+ ref: 'Discount',
20
+ },
21
+ priceBeforeDiscount: {
22
+ type: Number,
23
+ },
24
+ discounts: [
25
+ {
26
+ type: Schema.Types.ObjectId,
27
+ ref: 'Discount',
28
+ },
29
+ ],
30
+ },
13
31
  // TO BE REMOVED //
14
32
  category: {
15
33
  type: [String],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@francesco_ksh/app-ksh-mgd-schemas",
3
- "version": "1.4.9",
3
+ "version": "1.5.2",
4
4
  "description": "Mongoose schema definitions",
5
5
  "main": "index.js",
6
6
  "repository": {