@positivegrid/pg-mongoose-schema 26.6.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 +13 -0
- package/package.json +1 -1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "26.
|
|
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",
|