@positivegrid/pg-mongoose-schema 27.2.2-beta.1 → 27.3.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/promotion.js +1 -45
- package/models/user.js +2 -1
- package/package.json +1 -1
package/models/promotion.js
CHANGED
|
@@ -95,14 +95,7 @@ module.exports = function (mongoose) {
|
|
|
95
95
|
|
|
96
96
|
if (!_.isUndefined(params)) {
|
|
97
97
|
debug('getAvailableAnnouncement:querystring %o', params)
|
|
98
|
-
const {
|
|
99
|
-
pname,
|
|
100
|
-
locale,
|
|
101
|
-
ta_device,
|
|
102
|
-
country,
|
|
103
|
-
device_list,
|
|
104
|
-
device_os
|
|
105
|
-
} = params
|
|
98
|
+
const { pname, locale, ta_device, country } = params
|
|
106
99
|
if (!_.isUndefined(pname) && _.isString(pname)) {
|
|
107
100
|
defaultQuery['$and'].push({
|
|
108
101
|
announce_for: { '$in': _.concat([pname], 'all') }
|
|
@@ -137,43 +130,6 @@ module.exports = function (mongoose) {
|
|
|
137
130
|
}]
|
|
138
131
|
})
|
|
139
132
|
}
|
|
140
|
-
|
|
141
|
-
if (!_.isUndefined(device_list) && _.isString(device_list)) {
|
|
142
|
-
const deviceList = device_list.split(',')
|
|
143
|
-
|
|
144
|
-
// all value must follow the same format
|
|
145
|
-
// e.g., spark_all, spark_gen2, spark_40
|
|
146
|
-
const singletoneProductName = new Set()
|
|
147
|
-
deviceList.forEach(deviceItem => {
|
|
148
|
-
const tmp = deviceItem.split('_')
|
|
149
|
-
if (tmp.length === 2) {
|
|
150
|
-
singletoneProductName.add(`${tmp[0]}_all`)
|
|
151
|
-
}
|
|
152
|
-
})
|
|
153
|
-
const allSelectedProduct = []
|
|
154
|
-
if (singletoneProductName.size > 0) {
|
|
155
|
-
allSelectedProduct = [{
|
|
156
|
-
'device_list': {
|
|
157
|
-
'$in': Array.from(singletoneProductName)
|
|
158
|
-
}
|
|
159
|
-
}]
|
|
160
|
-
}
|
|
161
|
-
defaultQuery['$and'].push({
|
|
162
|
-
'$or': [{
|
|
163
|
-
'device_list': { $in: deviceList }
|
|
164
|
-
}].concat(allSelectedProduct)
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (!_.isUndefined(device_os) && _.isString(device_os)) {
|
|
169
|
-
defaultQuery['$and'].push({
|
|
170
|
-
'$or': [{
|
|
171
|
-
'device_os': 'all'
|
|
172
|
-
}, {
|
|
173
|
-
'device_os': device_os
|
|
174
|
-
}]
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
133
|
}
|
|
178
134
|
|
|
179
135
|
let ret
|
package/models/user.js
CHANGED
|
@@ -100,7 +100,8 @@ module.exports = function (mongoose) {
|
|
|
100
100
|
auth: {
|
|
101
101
|
firebase_id: { type: String },
|
|
102
102
|
google_id: { type: String },
|
|
103
|
-
apple_id: { type: String }
|
|
103
|
+
apple_id: { type: String },
|
|
104
|
+
wechat_id: { type: String }
|
|
104
105
|
},
|
|
105
106
|
metadata: {
|
|
106
107
|
gdpr: { type: Boolean, default: false },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.3.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",
|