@positivegrid/pg-mongoose-schema 26.5.0 → 26.7.0

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/partner.js CHANGED
@@ -16,6 +16,8 @@ module.exports = function (mongoose) {
16
16
  status: { type: Number, default: 1, required: true }, // 1: active, 2: inactive
17
17
  created_on: { type: Date, default: Date.now }
18
18
  }, { collection: 'pg_partner_sales_meta' })
19
+ PartnerSalesMetaSchema.index({ partner_name: 1, status: 1 })
20
+ PartnerSalesMetaSchema.index({ sales_product: 1, sales_bundle: 1, status: 1 })
19
21
 
20
22
  const PURCHASE_ITEM_TYPE = ['license', 'bundle']
21
23
  const PartnerRedeemSchema = new Schema({
@@ -31,6 +33,16 @@ module.exports = function (mongoose) {
31
33
  updated_on: { type: Date, default: Date.now }
32
34
  }, { collection: 'pg_partner_redeem' })
33
35
 
36
+ const PartnerSalesHistorySchema = new Schema({
37
+ partner_name: { type: String, required: true },
38
+ sku: { type: String, required: true },
39
+ title: { type: String, required: true },
40
+ previous_price: { type: Number, required: true },
41
+ current_price: { type: Number, required: true },
42
+ updated_on: { type: Date, default: Date.now }
43
+ }, { collection: 'pg_partner_sales_history' })
44
+ PartnerSalesHistorySchema.index({ partner_name: 1, sku: 1 })
45
+
34
46
  /**
35
47
  * B2bRedeemSchema is the db table for B2B redeem purchase records.
36
48
  * Our dealer will purchase the redeem code they need and all detail will save in pg_b2b_redeem_order and pg_b2b_redeem
@@ -245,6 +257,7 @@ module.exports = function (mongoose) {
245
257
 
246
258
  mongoose.model('PartnerSalesMeta', PartnerSalesMetaSchema)
247
259
  mongoose.model('PartnerRedeem', PartnerRedeemSchema)
260
+ mongoose.model('PartnerSalesHistory', PartnerSalesHistorySchema)
248
261
  mongoose.model('B2bRedeemOrder', B2bRedeemOrderSchema)
249
262
  mongoose.model('B2bRedeem', B2bRedeemSchema)
250
263
  mongoose.model('B2bDealer', B2bDealerSchema)
package/models/payment.js CHANGED
@@ -305,7 +305,7 @@ module.exports = function (mongoose) {
305
305
 
306
306
  const GuestCheckoutSchema = new Schema({
307
307
  email: { type: String, required: true },
308
- status: { type: Number, default: 1, required: true }, // 1:Wait for Binding/2: Bind to target account/3: Error
308
+ status: { type: Number, default: 1, required: true }, // 1:Wait for Binding/2: Bind to target account/3: Error/4: Refund
309
309
  bc_order_id: { type: Number, default: null },
310
310
  user_id: { type: ObjectId, ref: 'User', default: null },
311
311
  purchased_items: [{
@@ -24,9 +24,11 @@ module.exports = function (mongoose) {
24
24
  const KeyValueSchema = new Schema({
25
25
  key: { type: String, required: true },
26
26
  value: { type: Schema.Types.Mixed, required: true },
27
- created_on: { type: Date, default: Date.now }
27
+ created_on: { type: Date, default: Date.now },
28
+ expire_at: { type: Date, default: null }
28
29
  }, { collection: 'pg_key_value' })
29
30
  KeyValueSchema.index({ key: 1 })
31
+ KeyValueSchema.index({ expire_at: 1 }, { expireAfterSeconds: 0 })
30
32
 
31
33
  const CrashDataSchema = new Schema({
32
34
  product: { type: String, required: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@positivegrid/pg-mongoose-schema",
3
- "version": "26.5.0",
3
+ "version": "26.7.0",
4
4
  "description": "Positive Grid mongoose schema",
5
5
  "author": "Ferrari Lee <shiyung@positivegrid.com>",
6
6
  "homepage": "https://git.positivegrid.com:8443/backend/pg-mongoose-schema",