@positivegrid/pg-mongoose-schema 28.0.0-beta.4 → 28.0.0-beta.5
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/dist/index.cjs +136 -1
- package/dist/index.d.mts +40 -1
- package/dist/index.mjs +136 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4757,6 +4757,136 @@ function buildUser(mongoose) {
|
|
|
4757
4757
|
follow_platform: 1,
|
|
4758
4758
|
follow_user_id: 1
|
|
4759
4759
|
}, { unique: true });
|
|
4760
|
+
const UserPointsSchema = new Schema({
|
|
4761
|
+
user_id: {
|
|
4762
|
+
type: ObjectId,
|
|
4763
|
+
ref: "User",
|
|
4764
|
+
required: true
|
|
4765
|
+
},
|
|
4766
|
+
points: {
|
|
4767
|
+
type: Number,
|
|
4768
|
+
default: 0,
|
|
4769
|
+
min: 0
|
|
4770
|
+
},
|
|
4771
|
+
lifetime_earned: {
|
|
4772
|
+
type: Number,
|
|
4773
|
+
default: 0,
|
|
4774
|
+
min: 0
|
|
4775
|
+
},
|
|
4776
|
+
created_on: {
|
|
4777
|
+
type: Date,
|
|
4778
|
+
default: Date.now
|
|
4779
|
+
},
|
|
4780
|
+
updated_on: {
|
|
4781
|
+
type: Date,
|
|
4782
|
+
default: Date.now
|
|
4783
|
+
}
|
|
4784
|
+
}, { collection: "user_points" });
|
|
4785
|
+
UserPointsSchema.index({ user_id: 1 }, { unique: true });
|
|
4786
|
+
const UserRewardHistorySchema = new Schema({
|
|
4787
|
+
user_point_id: {
|
|
4788
|
+
type: ObjectId,
|
|
4789
|
+
ref: "UserPoints",
|
|
4790
|
+
required: true
|
|
4791
|
+
},
|
|
4792
|
+
point_change: {
|
|
4793
|
+
type: Number,
|
|
4794
|
+
required: true
|
|
4795
|
+
},
|
|
4796
|
+
event: {
|
|
4797
|
+
type: String,
|
|
4798
|
+
required: true
|
|
4799
|
+
},
|
|
4800
|
+
created_on: {
|
|
4801
|
+
type: Date,
|
|
4802
|
+
default: Date.now
|
|
4803
|
+
},
|
|
4804
|
+
updated_on: {
|
|
4805
|
+
type: Date,
|
|
4806
|
+
default: Date.now
|
|
4807
|
+
}
|
|
4808
|
+
}, { collection: "user_reward_history" });
|
|
4809
|
+
UserRewardHistorySchema.index({
|
|
4810
|
+
user_point_id: 1,
|
|
4811
|
+
event: 1
|
|
4812
|
+
}, { unique: true });
|
|
4813
|
+
const RewardPointsRedeemListSchema = new Schema({
|
|
4814
|
+
name: {
|
|
4815
|
+
type: String,
|
|
4816
|
+
required: true
|
|
4817
|
+
},
|
|
4818
|
+
skus: {
|
|
4819
|
+
type: [String],
|
|
4820
|
+
default: []
|
|
4821
|
+
},
|
|
4822
|
+
discount_percent: {
|
|
4823
|
+
type: Number,
|
|
4824
|
+
required: true
|
|
4825
|
+
},
|
|
4826
|
+
points_required: {
|
|
4827
|
+
type: Number,
|
|
4828
|
+
required: true,
|
|
4829
|
+
min: 0
|
|
4830
|
+
},
|
|
4831
|
+
created_on: {
|
|
4832
|
+
type: Date,
|
|
4833
|
+
default: Date.now
|
|
4834
|
+
}
|
|
4835
|
+
}, { collection: "reward_points_redeem_list" });
|
|
4836
|
+
const UserRedeemRewardPointsRecordSchema = new Schema({
|
|
4837
|
+
user_id: {
|
|
4838
|
+
type: ObjectId,
|
|
4839
|
+
ref: "User",
|
|
4840
|
+
required: true
|
|
4841
|
+
},
|
|
4842
|
+
reward_points_redeem_id: {
|
|
4843
|
+
type: ObjectId,
|
|
4844
|
+
ref: "RewardPointsRedeemList",
|
|
4845
|
+
required: true
|
|
4846
|
+
},
|
|
4847
|
+
discount_code: {
|
|
4848
|
+
type: String,
|
|
4849
|
+
required: true
|
|
4850
|
+
},
|
|
4851
|
+
created_on: {
|
|
4852
|
+
type: Date,
|
|
4853
|
+
default: Date.now
|
|
4854
|
+
}
|
|
4855
|
+
}, { collection: "user_redeem_reward_points_record" });
|
|
4856
|
+
UserRedeemRewardPointsRecordSchema.index({
|
|
4857
|
+
user_id: 1,
|
|
4858
|
+
created_on: -1
|
|
4859
|
+
});
|
|
4860
|
+
const IntermediateUserOrderRewardSchema = new Schema({
|
|
4861
|
+
email: {
|
|
4862
|
+
type: String,
|
|
4863
|
+
required: true,
|
|
4864
|
+
lowercase: true,
|
|
4865
|
+
trim: true
|
|
4866
|
+
},
|
|
4867
|
+
order_id: {
|
|
4868
|
+
type: Number,
|
|
4869
|
+
required: true
|
|
4870
|
+
},
|
|
4871
|
+
price: {
|
|
4872
|
+
type: Number,
|
|
4873
|
+
required: true,
|
|
4874
|
+
min: 0
|
|
4875
|
+
},
|
|
4876
|
+
status: {
|
|
4877
|
+
type: Number,
|
|
4878
|
+
default: 1
|
|
4879
|
+
},
|
|
4880
|
+
created_on: {
|
|
4881
|
+
type: Date,
|
|
4882
|
+
default: Date.now
|
|
4883
|
+
}
|
|
4884
|
+
}, { collection: "intermediate_user_order_reward" });
|
|
4885
|
+
IntermediateUserOrderRewardSchema.index({
|
|
4886
|
+
email: 1,
|
|
4887
|
+
order_id: 1
|
|
4888
|
+
}, { unique: true });
|
|
4889
|
+
IntermediateUserOrderRewardSchema.index({ status: 1 });
|
|
4760
4890
|
UserSchema.method({
|
|
4761
4891
|
authenticate(plainText) {
|
|
4762
4892
|
const passwordArr = this.password.split("$");
|
|
@@ -5042,7 +5172,12 @@ function buildUser(mongoose) {
|
|
|
5042
5172
|
UserReferral: mongoose.model("UserReferral", UserReferralSchema),
|
|
5043
5173
|
UserEmailStatus: mongoose.model("UserEmailStatus", UserEmailStatusSchema),
|
|
5044
5174
|
UserToken: mongoose.model("UserToken", UserTokenSchema),
|
|
5045
|
-
UserFollow: mongoose.model("UserFollow", UserFollowSchema)
|
|
5175
|
+
UserFollow: mongoose.model("UserFollow", UserFollowSchema),
|
|
5176
|
+
UserPoints: mongoose.model("UserPoints", UserPointsSchema),
|
|
5177
|
+
UserRewardHistory: mongoose.model("UserRewardHistory", UserRewardHistorySchema),
|
|
5178
|
+
RewardPointsRedeemList: mongoose.model("RewardPointsRedeemList", RewardPointsRedeemListSchema),
|
|
5179
|
+
UserRedeemRewardPointsRecord: mongoose.model("UserRedeemRewardPointsRecord", UserRedeemRewardPointsRecordSchema),
|
|
5180
|
+
IntermediateUserOrderReward: mongoose.model("IntermediateUserOrderReward", IntermediateUserOrderRewardSchema)
|
|
5046
5181
|
};
|
|
5047
5182
|
}
|
|
5048
5183
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -172,6 +172,40 @@ interface IUserFollow {
|
|
|
172
172
|
follow_user_id: Schema.Types.ObjectId;
|
|
173
173
|
follow_platform?: string;
|
|
174
174
|
}
|
|
175
|
+
interface IUserPoints {
|
|
176
|
+
user_id: Schema.Types.ObjectId;
|
|
177
|
+
points: number;
|
|
178
|
+
lifetime_earned: number;
|
|
179
|
+
created_on: Date;
|
|
180
|
+
updated_on: Date;
|
|
181
|
+
}
|
|
182
|
+
interface IUserRewardHistory {
|
|
183
|
+
user_point_id: Schema.Types.ObjectId;
|
|
184
|
+
point_change: number;
|
|
185
|
+
event: string;
|
|
186
|
+
created_on: Date;
|
|
187
|
+
updated_on: Date;
|
|
188
|
+
}
|
|
189
|
+
interface IRewardPointsRedeemList {
|
|
190
|
+
name: string;
|
|
191
|
+
skus: string[];
|
|
192
|
+
discount_percent: number;
|
|
193
|
+
points_required: number;
|
|
194
|
+
created_on: Date;
|
|
195
|
+
}
|
|
196
|
+
interface IUserRedeemRewardPointsRecord {
|
|
197
|
+
user_id: Schema.Types.ObjectId;
|
|
198
|
+
reward_points_redeem_id: Schema.Types.ObjectId;
|
|
199
|
+
discount_code: string;
|
|
200
|
+
created_on: Date;
|
|
201
|
+
}
|
|
202
|
+
interface IIntermediateUserOrderReward {
|
|
203
|
+
email: string;
|
|
204
|
+
order_id: number;
|
|
205
|
+
price: number;
|
|
206
|
+
status: number;
|
|
207
|
+
created_on: Date;
|
|
208
|
+
}
|
|
175
209
|
type SimpleModel$3<T> = Model<T, {}, {}, {}>;
|
|
176
210
|
interface UserModels {
|
|
177
211
|
User: UserModel;
|
|
@@ -183,6 +217,11 @@ interface UserModels {
|
|
|
183
217
|
UserEmailStatus: SimpleModel$3<IUserEmailStatus>;
|
|
184
218
|
UserToken: UserTokenModel;
|
|
185
219
|
UserFollow: SimpleModel$3<IUserFollow>;
|
|
220
|
+
UserPoints: SimpleModel$3<IUserPoints>;
|
|
221
|
+
UserRewardHistory: SimpleModel$3<IUserRewardHistory>;
|
|
222
|
+
RewardPointsRedeemList: SimpleModel$3<IRewardPointsRedeemList>;
|
|
223
|
+
UserRedeemRewardPointsRecord: SimpleModel$3<IUserRedeemRewardPointsRecord>;
|
|
224
|
+
IntermediateUserOrderReward: SimpleModel$3<IIntermediateUserOrderReward>;
|
|
186
225
|
}
|
|
187
226
|
//#endregion
|
|
188
227
|
//#region src/models/banks.d.ts
|
|
@@ -1291,4 +1330,4 @@ type DemoUserTrackerDoc = HydratedDocument<IDemoUserTracker>;
|
|
|
1291
1330
|
type RegistryType = "account" | "hardware" | undefined;
|
|
1292
1331
|
declare function register(mongoose: Mongoose, type?: RegistryType): void;
|
|
1293
1332
|
//#endregion
|
|
1294
|
-
export { type AccessTokenModel, type ActivationStatusModel, type AdditionalPurchaseModel, AuthError, type AuthorizationCodeDoc, type AuthorizationCodeModel, type B2bDealerModel, type B2bRedeemModel, type B2bRedeemOrderModel, type BankListDoc, type BankListModel, type BankPresetsDoc, type BankPresetsModel, type BanksModels, type BcCartUpdateStatusModel, type CAMPAIGN_TYPE, type CnCouponDoc, type CnCouponMethods, type CnCouponModel, type CnSalesMetaModel, type CountryHardwareSkuModel, type CrashDataModel, type DataSourceType, type DemoUserTrackerDoc, type DemoUserTrackerModel, type DeviceDoc, type DeviceModel, type DeviceModels, type FLAG_EMAIL_EVENTS, type FeaturedListDoc, type FeaturedListModel, type FeaturedListModels, type FeaturedPresetModel, type GenericDataModel, type HardwareActivationConflictModel, type HardwareActivationMetaModel, type HardwareActivationRecordModel, type HardwareModels, type HardwareSeriesNumberModel, type HomeConfigDoc, type HomeConfigModel, type IAccessToken, type IActionButton, type IActivationStatus, type IApikey, type IAuthorizationCode, type IB2bDealer, type IB2bRedeem, type IB2bRedeemOrder, type IBankList, type IBankPresets, type ICampaignUserInfo, type ICnCoupon, type ICountryHardwareSku, type ICouponPromotion, type ICrashData, type IDataSource, type IDemoUserTracker, type IDevice, type IFeaturedList, type IFeaturedListVirtuals, type IFeaturedPreset, type IFreeTrial, type IGearTrialMeta, type IGearTrialRecord, type IGenericData, type IHardwareActivationConflict, type IHardwareActivationMeta, type IHardwareActivationRecord, type IHardwareSeriesNumber, type IHomeConfig, type IIapActivation, type IIapEvent, type IIasBuyOption, type IIasPromotion, type IIasStorePageMeta, type IItemInventoryHistory, type IKeyValue, type ILicense, type ILicenseCampaignMeta, type ILicenseCampaignRecord, type ILicenseVirtuals, type IOauthClient, type IOemRedeemPromotion, type IPartnerCoupon, type IPartnerRedeem, type IPartnerSalesHistory, type IPartnerSalesMeta, type IPgConfig, type IPgLogging, type IPreset, type IPresetVirtuals, type IProduct, type IPromotion, type IPublicAnnouncement, type IPublicAnnouncementFreeTrial, type IPublicAnnouncementUserList, type IPublicAnnouncementUserListLog, type IRedeemCode, type IRefreshToken, type ISection, type ISpecialOffer, type ITierSalesMeta, type ITierSalesRules, type IToneTheme, type IToneThemeFeaturedList, type IToneThemeVirtuals, type IUser, type IUserAddress, type IUserAuth, type IUserEmailStatus, type IUserFollow, type IUserMetadata, type IUserMethods, type IUserProduct, type IUserProductTracker, type IUserProfile, type IUserReferral, type IUserToken, type IUserVirtuals, type IWarehouseInventory, type IYotpoLoyalty, type IYotpoLoyaltyBackup, type IapActivationModel, type IapEventModel, type ItemInventoryHistoryModel, type KeyValueModel, type LICENSE_ADDITION, type LicenseAdditionKey, type LicenseDoc, type LicenseModel, type LicenseUpgradeMetaModel, type OEM_APOGEE_SUPPORT_LICENSE, type OEM_FOCUSRITE_SUPPORT_LICENSE, type OEM_PROMOTION_TYPE, type OEM_PROSONUS_SUPPORT_LICENSE, type OauthClientModel, type OauthModels, type OemRedeemPromotionModel, type PRODUCTS, type PURCHASE_ITEM_TYPE, type ParsedGenericSerialNumber, type ParsedSerialNumber, type ParsedSparkSerialNumber, type PartnerCouponModel, type PartnerModels, type PartnerRedeemModel, type PartnerSalesHistoryModel, type PartnerSalesMetaModel, type PaymentModels, type PgConfigDoc, type PgConfigModel, type PgConfigModels, type PgLoggingModel, type PresetCommentModel, type PresetDoc, type PresetLikeModel, type PresetModel, type PresetModels, type Product, type ProductModel, type PromotionModels, type PublicAnnouncementDoc, type PublicAnnouncementFreeTrialModel, type PublicAnnouncementModel, type PublicAnnouncementUserListModel, type RedeemCodeDoc, type RedeemCodeModel, type RefreshTokenModel, RegistryType, type SaveTrackInput, type SectionType, type SimpleModel, type ToneThemeDoc, type ToneThemeFeaturedListDoc, type ToneThemeFeaturedListModel, type ToneThemeModel, type UserDoc, type UserModel, type UserModels, type UserProductModel, type UserProfileDoc, type UserProfileModel, type UserTokenDoc, type UserTokenModel, type UserTrackModels, type WarehouseInventoryModel, type _buildLicenseTierQuery, type _buildPresetVersionQuery, type _buildSortQuery, type _filterKeyword, type _handlePresetVersion, type _identifyHardwareByModel, type _identifyItemTypeBySku, type _oemMetaToLicenseName, type _parseHardwareSerialNumber, type _parsePageParams, type _queryCompatibilityHandler, register as default, register };
|
|
1333
|
+
export { type AccessTokenModel, type ActivationStatusModel, type AdditionalPurchaseModel, AuthError, type AuthorizationCodeDoc, type AuthorizationCodeModel, type B2bDealerModel, type B2bRedeemModel, type B2bRedeemOrderModel, type BankListDoc, type BankListModel, type BankPresetsDoc, type BankPresetsModel, type BanksModels, type BcCartUpdateStatusModel, type CAMPAIGN_TYPE, type CnCouponDoc, type CnCouponMethods, type CnCouponModel, type CnSalesMetaModel, type CountryHardwareSkuModel, type CrashDataModel, type DataSourceType, type DemoUserTrackerDoc, type DemoUserTrackerModel, type DeviceDoc, type DeviceModel, type DeviceModels, type FLAG_EMAIL_EVENTS, type FeaturedListDoc, type FeaturedListModel, type FeaturedListModels, type FeaturedPresetModel, type GenericDataModel, type HardwareActivationConflictModel, type HardwareActivationMetaModel, type HardwareActivationRecordModel, type HardwareModels, type HardwareSeriesNumberModel, type HomeConfigDoc, type HomeConfigModel, type IAccessToken, type IActionButton, type IActivationStatus, type IApikey, type IAuthorizationCode, type IB2bDealer, type IB2bRedeem, type IB2bRedeemOrder, type IBankList, type IBankPresets, type ICampaignUserInfo, type ICnCoupon, type ICountryHardwareSku, type ICouponPromotion, type ICrashData, type IDataSource, type IDemoUserTracker, type IDevice, type IFeaturedList, type IFeaturedListVirtuals, type IFeaturedPreset, type IFreeTrial, type IGearTrialMeta, type IGearTrialRecord, type IGenericData, type IHardwareActivationConflict, type IHardwareActivationMeta, type IHardwareActivationRecord, type IHardwareSeriesNumber, type IHomeConfig, type IIapActivation, type IIapEvent, type IIasBuyOption, type IIasPromotion, type IIasStorePageMeta, type IIntermediateUserOrderReward, type IItemInventoryHistory, type IKeyValue, type ILicense, type ILicenseCampaignMeta, type ILicenseCampaignRecord, type ILicenseVirtuals, type IOauthClient, type IOemRedeemPromotion, type IPartnerCoupon, type IPartnerRedeem, type IPartnerSalesHistory, type IPartnerSalesMeta, type IPgConfig, type IPgLogging, type IPreset, type IPresetVirtuals, type IProduct, type IPromotion, type IPublicAnnouncement, type IPublicAnnouncementFreeTrial, type IPublicAnnouncementUserList, type IPublicAnnouncementUserListLog, type IRedeemCode, type IRefreshToken, type IRewardPointsRedeemList, type ISection, type ISpecialOffer, type ITierSalesMeta, type ITierSalesRules, type IToneTheme, type IToneThemeFeaturedList, type IToneThemeVirtuals, type IUser, type IUserAddress, type IUserAuth, type IUserEmailStatus, type IUserFollow, type IUserMetadata, type IUserMethods, type IUserPoints, type IUserProduct, type IUserProductTracker, type IUserProfile, type IUserRedeemRewardPointsRecord, type IUserReferral, type IUserRewardHistory, type IUserToken, type IUserVirtuals, type IWarehouseInventory, type IYotpoLoyalty, type IYotpoLoyaltyBackup, type IapActivationModel, type IapEventModel, type ItemInventoryHistoryModel, type KeyValueModel, type LICENSE_ADDITION, type LicenseAdditionKey, type LicenseDoc, type LicenseModel, type LicenseUpgradeMetaModel, type OEM_APOGEE_SUPPORT_LICENSE, type OEM_FOCUSRITE_SUPPORT_LICENSE, type OEM_PROMOTION_TYPE, type OEM_PROSONUS_SUPPORT_LICENSE, type OauthClientModel, type OauthModels, type OemRedeemPromotionModel, type PRODUCTS, type PURCHASE_ITEM_TYPE, type ParsedGenericSerialNumber, type ParsedSerialNumber, type ParsedSparkSerialNumber, type PartnerCouponModel, type PartnerModels, type PartnerRedeemModel, type PartnerSalesHistoryModel, type PartnerSalesMetaModel, type PaymentModels, type PgConfigDoc, type PgConfigModel, type PgConfigModels, type PgLoggingModel, type PresetCommentModel, type PresetDoc, type PresetLikeModel, type PresetModel, type PresetModels, type Product, type ProductModel, type PromotionModels, type PublicAnnouncementDoc, type PublicAnnouncementFreeTrialModel, type PublicAnnouncementModel, type PublicAnnouncementUserListModel, type RedeemCodeDoc, type RedeemCodeModel, type RefreshTokenModel, RegistryType, type SaveTrackInput, type SectionType, type SimpleModel, type ToneThemeDoc, type ToneThemeFeaturedListDoc, type ToneThemeFeaturedListModel, type ToneThemeModel, type UserDoc, type UserModel, type UserModels, type UserProductModel, type UserProfileDoc, type UserProfileModel, type UserTokenDoc, type UserTokenModel, type UserTrackModels, type WarehouseInventoryModel, type _buildLicenseTierQuery, type _buildPresetVersionQuery, type _buildSortQuery, type _filterKeyword, type _handlePresetVersion, type _identifyHardwareByModel, type _identifyItemTypeBySku, type _oemMetaToLicenseName, type _parseHardwareSerialNumber, type _parsePageParams, type _queryCompatibilityHandler, register as default, register };
|
package/dist/index.mjs
CHANGED
|
@@ -4729,6 +4729,136 @@ function buildUser(mongoose) {
|
|
|
4729
4729
|
follow_platform: 1,
|
|
4730
4730
|
follow_user_id: 1
|
|
4731
4731
|
}, { unique: true });
|
|
4732
|
+
const UserPointsSchema = new Schema({
|
|
4733
|
+
user_id: {
|
|
4734
|
+
type: ObjectId,
|
|
4735
|
+
ref: "User",
|
|
4736
|
+
required: true
|
|
4737
|
+
},
|
|
4738
|
+
points: {
|
|
4739
|
+
type: Number,
|
|
4740
|
+
default: 0,
|
|
4741
|
+
min: 0
|
|
4742
|
+
},
|
|
4743
|
+
lifetime_earned: {
|
|
4744
|
+
type: Number,
|
|
4745
|
+
default: 0,
|
|
4746
|
+
min: 0
|
|
4747
|
+
},
|
|
4748
|
+
created_on: {
|
|
4749
|
+
type: Date,
|
|
4750
|
+
default: Date.now
|
|
4751
|
+
},
|
|
4752
|
+
updated_on: {
|
|
4753
|
+
type: Date,
|
|
4754
|
+
default: Date.now
|
|
4755
|
+
}
|
|
4756
|
+
}, { collection: "user_points" });
|
|
4757
|
+
UserPointsSchema.index({ user_id: 1 }, { unique: true });
|
|
4758
|
+
const UserRewardHistorySchema = new Schema({
|
|
4759
|
+
user_point_id: {
|
|
4760
|
+
type: ObjectId,
|
|
4761
|
+
ref: "UserPoints",
|
|
4762
|
+
required: true
|
|
4763
|
+
},
|
|
4764
|
+
point_change: {
|
|
4765
|
+
type: Number,
|
|
4766
|
+
required: true
|
|
4767
|
+
},
|
|
4768
|
+
event: {
|
|
4769
|
+
type: String,
|
|
4770
|
+
required: true
|
|
4771
|
+
},
|
|
4772
|
+
created_on: {
|
|
4773
|
+
type: Date,
|
|
4774
|
+
default: Date.now
|
|
4775
|
+
},
|
|
4776
|
+
updated_on: {
|
|
4777
|
+
type: Date,
|
|
4778
|
+
default: Date.now
|
|
4779
|
+
}
|
|
4780
|
+
}, { collection: "user_reward_history" });
|
|
4781
|
+
UserRewardHistorySchema.index({
|
|
4782
|
+
user_point_id: 1,
|
|
4783
|
+
event: 1
|
|
4784
|
+
}, { unique: true });
|
|
4785
|
+
const RewardPointsRedeemListSchema = new Schema({
|
|
4786
|
+
name: {
|
|
4787
|
+
type: String,
|
|
4788
|
+
required: true
|
|
4789
|
+
},
|
|
4790
|
+
skus: {
|
|
4791
|
+
type: [String],
|
|
4792
|
+
default: []
|
|
4793
|
+
},
|
|
4794
|
+
discount_percent: {
|
|
4795
|
+
type: Number,
|
|
4796
|
+
required: true
|
|
4797
|
+
},
|
|
4798
|
+
points_required: {
|
|
4799
|
+
type: Number,
|
|
4800
|
+
required: true,
|
|
4801
|
+
min: 0
|
|
4802
|
+
},
|
|
4803
|
+
created_on: {
|
|
4804
|
+
type: Date,
|
|
4805
|
+
default: Date.now
|
|
4806
|
+
}
|
|
4807
|
+
}, { collection: "reward_points_redeem_list" });
|
|
4808
|
+
const UserRedeemRewardPointsRecordSchema = new Schema({
|
|
4809
|
+
user_id: {
|
|
4810
|
+
type: ObjectId,
|
|
4811
|
+
ref: "User",
|
|
4812
|
+
required: true
|
|
4813
|
+
},
|
|
4814
|
+
reward_points_redeem_id: {
|
|
4815
|
+
type: ObjectId,
|
|
4816
|
+
ref: "RewardPointsRedeemList",
|
|
4817
|
+
required: true
|
|
4818
|
+
},
|
|
4819
|
+
discount_code: {
|
|
4820
|
+
type: String,
|
|
4821
|
+
required: true
|
|
4822
|
+
},
|
|
4823
|
+
created_on: {
|
|
4824
|
+
type: Date,
|
|
4825
|
+
default: Date.now
|
|
4826
|
+
}
|
|
4827
|
+
}, { collection: "user_redeem_reward_points_record" });
|
|
4828
|
+
UserRedeemRewardPointsRecordSchema.index({
|
|
4829
|
+
user_id: 1,
|
|
4830
|
+
created_on: -1
|
|
4831
|
+
});
|
|
4832
|
+
const IntermediateUserOrderRewardSchema = new Schema({
|
|
4833
|
+
email: {
|
|
4834
|
+
type: String,
|
|
4835
|
+
required: true,
|
|
4836
|
+
lowercase: true,
|
|
4837
|
+
trim: true
|
|
4838
|
+
},
|
|
4839
|
+
order_id: {
|
|
4840
|
+
type: Number,
|
|
4841
|
+
required: true
|
|
4842
|
+
},
|
|
4843
|
+
price: {
|
|
4844
|
+
type: Number,
|
|
4845
|
+
required: true,
|
|
4846
|
+
min: 0
|
|
4847
|
+
},
|
|
4848
|
+
status: {
|
|
4849
|
+
type: Number,
|
|
4850
|
+
default: 1
|
|
4851
|
+
},
|
|
4852
|
+
created_on: {
|
|
4853
|
+
type: Date,
|
|
4854
|
+
default: Date.now
|
|
4855
|
+
}
|
|
4856
|
+
}, { collection: "intermediate_user_order_reward" });
|
|
4857
|
+
IntermediateUserOrderRewardSchema.index({
|
|
4858
|
+
email: 1,
|
|
4859
|
+
order_id: 1
|
|
4860
|
+
}, { unique: true });
|
|
4861
|
+
IntermediateUserOrderRewardSchema.index({ status: 1 });
|
|
4732
4862
|
UserSchema.method({
|
|
4733
4863
|
authenticate(plainText) {
|
|
4734
4864
|
const passwordArr = this.password.split("$");
|
|
@@ -5014,7 +5144,12 @@ function buildUser(mongoose) {
|
|
|
5014
5144
|
UserReferral: mongoose.model("UserReferral", UserReferralSchema),
|
|
5015
5145
|
UserEmailStatus: mongoose.model("UserEmailStatus", UserEmailStatusSchema),
|
|
5016
5146
|
UserToken: mongoose.model("UserToken", UserTokenSchema),
|
|
5017
|
-
UserFollow: mongoose.model("UserFollow", UserFollowSchema)
|
|
5147
|
+
UserFollow: mongoose.model("UserFollow", UserFollowSchema),
|
|
5148
|
+
UserPoints: mongoose.model("UserPoints", UserPointsSchema),
|
|
5149
|
+
UserRewardHistory: mongoose.model("UserRewardHistory", UserRewardHistorySchema),
|
|
5150
|
+
RewardPointsRedeemList: mongoose.model("RewardPointsRedeemList", RewardPointsRedeemListSchema),
|
|
5151
|
+
UserRedeemRewardPointsRecord: mongoose.model("UserRedeemRewardPointsRecord", UserRedeemRewardPointsRecordSchema),
|
|
5152
|
+
IntermediateUserOrderReward: mongoose.model("IntermediateUserOrderReward", IntermediateUserOrderRewardSchema)
|
|
5018
5153
|
};
|
|
5019
5154
|
}
|
|
5020
5155
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "28.0.0-beta.
|
|
3
|
+
"version": "28.0.0-beta.5",
|
|
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",
|