@positivegrid/pg-mongoose-schema 27.7.4 → 27.7.6
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/promotion.js +4 -0
- package/models/user.js +0 -14
- package/package.json +1 -1
package/models/promotion.js
CHANGED
|
@@ -555,6 +555,10 @@ module.exports = (mongoose) => {
|
|
|
555
555
|
trial_days: { type: Number, default: 0 },
|
|
556
556
|
not_allow_same_product: { type: Boolean, default: false },
|
|
557
557
|
created_by: { type: String, default: null },
|
|
558
|
+
terminate: {
|
|
559
|
+
reason: { type: String },
|
|
560
|
+
time: { type: Date },
|
|
561
|
+
},
|
|
558
562
|
metadata: { type: Schema.Types.Mixed, default: null },
|
|
559
563
|
created_on: { type: Date, default: Date.now, required: true },
|
|
560
564
|
updated_on: { type: Date, default: Date.now, required: true }
|
package/models/user.js
CHANGED
|
@@ -70,21 +70,7 @@ module.exports = function (mongoose) {
|
|
|
70
70
|
UserProfileSchema
|
|
71
71
|
.index({ user_id: 1 }, { unique: true })
|
|
72
72
|
.index({ reset_password_token: 1 })
|
|
73
|
-
|
|
74
73
|
UserProfileSchema.index({full_name: 'text', first_name: 'text', last_name: 'text'})
|
|
75
|
-
UserProfileSchema.virtual('full_name').get(function () {
|
|
76
|
-
if (this.full_name) {
|
|
77
|
-
return this.full_name
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (!this.first_name && !this.last_name) {
|
|
81
|
-
const timestamp = new Date(this.date_joined).getTime().toString().padStart(8, '0').toUpperCase()
|
|
82
|
-
const objectId = new this._id.toString().slice(-4).toUpperCase()
|
|
83
|
-
return `PG_${timestamp}${objectId}`
|
|
84
|
-
} else {
|
|
85
|
-
return `${this.first_name} ${this.last_name}`
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
74
|
|
|
89
75
|
const UserAddressSchema = new Schema({
|
|
90
76
|
user_id: { type: ObjectId, ref: 'User', required: true },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "27.7.
|
|
3
|
+
"version": "27.7.6",
|
|
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",
|