@positivegrid/pg-mongoose-schema 27.5.0 → 27.6.1
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/payment.js +5 -3
- package/models/promotion.js +18 -0
- package/package.json +1 -1
package/models/payment.js
CHANGED
|
@@ -38,11 +38,11 @@ const _oemMetaToLicenseName = function (redeemMeta) {
|
|
|
38
38
|
return (!ret) ? null : { 'oem_name': redeemMeta['OEM_Name'], 'license_name': ret.display_name }
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
module.exports =
|
|
41
|
+
module.exports = (mongoose) => {
|
|
42
42
|
const Schema = mongoose.Schema
|
|
43
43
|
const ObjectId = Schema.Types.ObjectId
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
const ProductSchema = new Schema({
|
|
46
46
|
sku: { type: String, required: true, unique: true },
|
|
47
47
|
name: { type: String, required: true }, // jamup/bias(AMP1)/live(FX1)/amp2/fx2/pedal/proseries
|
|
48
48
|
display_name: { type: String, required: true },
|
|
@@ -51,10 +51,11 @@ module.exports = function (mongoose) {
|
|
|
51
51
|
product_type: { type: Number, default: 0, required: true }, // 0:license, 1:pack, 2: dummy, 3: Partner, 4: IAP, 5: redeem(upgrade), 6: hardware
|
|
52
52
|
status: { type: Number, default: 1, required: true }, // 0:offline, 1:online, 2:delete
|
|
53
53
|
quota: { type: Number, default: 1, required: true },
|
|
54
|
-
addition: { type: Number, required: true }, // 0:professional, 1:demo, 2: standard, 3: lite, 4: elite
|
|
54
|
+
addition: { type: Number, required: true }, // 0:professional, 1:demo, 2: standard, 3: lite, 4: elite, 5: test
|
|
55
55
|
version: { type: String, required: true },
|
|
56
56
|
max_purchase: { type: Number },
|
|
57
57
|
can_upgrade_addition: { type: Boolean },
|
|
58
|
+
can_free_trial: { type: Boolean, default: false },
|
|
58
59
|
upgrade: {
|
|
59
60
|
to: { type: ObjectId },
|
|
60
61
|
price: { type: Number },
|
|
@@ -94,6 +95,7 @@ module.exports = function (mongoose) {
|
|
|
94
95
|
from_gift: { type: ObjectId, ref: 'License', default: null },
|
|
95
96
|
from_guest: { type: ObjectId, ref: 'GuestCheckout', default: null },
|
|
96
97
|
from_remap: { type: ObjectId, ref: 'Product' },
|
|
98
|
+
from_free_trial: { type: ObjectId, ref: 'FreeTrial', default: null },
|
|
97
99
|
upgrade_to: { type: ObjectId, ref: 'License', default: null }, // Upgrade from which license
|
|
98
100
|
price_amount: { type: Number, default: null },
|
|
99
101
|
due_date: { type: Date, default: null },
|
package/models/promotion.js
CHANGED
|
@@ -40,6 +40,7 @@ module.exports = function (mongoose) {
|
|
|
40
40
|
const PublicAnnouncementSchema = new Schema({
|
|
41
41
|
title: { type: String, required: true },
|
|
42
42
|
content: { type: String, required: true },
|
|
43
|
+
type: { type: String, enum: ['announcement', 'freetrial'] },
|
|
43
44
|
country: [{ type: String }],
|
|
44
45
|
image: { type: String, default: null },
|
|
45
46
|
image_type: { type: String },
|
|
@@ -543,6 +544,22 @@ module.exports = function (mongoose) {
|
|
|
543
544
|
}, { collection: 'yotpo_loyalty_backup' })
|
|
544
545
|
YotpoLoyaltyBackupSchema.index({ email: 1, store_code: 1 }, { unique: true })
|
|
545
546
|
|
|
547
|
+
const FreeTrialSchema = new Schema({
|
|
548
|
+
campaign_name: { type: String, required: true },
|
|
549
|
+
campaign_code: { type: String, required: true },
|
|
550
|
+
content: { type: String, default: null },
|
|
551
|
+
products: [{ type: ObjectId, ref: 'Product', required: true }],
|
|
552
|
+
status: { type: Number, default: 1, required: true }, // 0:draft/1:actived/2:deactivated
|
|
553
|
+
start_time: { type: Date, default: null },
|
|
554
|
+
end_time: { type: Date, default: null },
|
|
555
|
+
trial_days: { type: Number, default: 0 },
|
|
556
|
+
metadata: { type: Schema.Types.Mixed, default: null },
|
|
557
|
+
created_on: { type: Date, default: Date.now, required: true },
|
|
558
|
+
updated_on: { type: Date, default: Date.now, required: true }
|
|
559
|
+
}, { collection: 'free_trial_campaign' })
|
|
560
|
+
FreeTrialSchema.index({ campaign_code: 1 }, { unique: true })
|
|
561
|
+
|
|
562
|
+
|
|
546
563
|
mongoose.model('LicenseCampaignMeta', LicenseCampaignMetaSchema)
|
|
547
564
|
mongoose.model('LicenseCampaignRecord', LicenseCampaignRecordSchema)
|
|
548
565
|
mongoose.model('PublicAnnouncement', PublicAnnouncementSchema)
|
|
@@ -562,4 +579,5 @@ module.exports = function (mongoose) {
|
|
|
562
579
|
mongoose.model('GearTrialRecord', GearTrialRecordSchema)
|
|
563
580
|
mongoose.model('YotpoLoyalty', YotpoLoyaltySchema)
|
|
564
581
|
mongoose.model('YotpoLoyaltyBackup', YotpoLoyaltyBackupSchema)
|
|
582
|
+
mongoose.model('FreeTrial', FreeTrialSchema)
|
|
565
583
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.6.1",
|
|
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",
|