@positivegrid/pg-mongoose-schema 27.2.0 → 27.2.2-beta.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 +25 -1
- package/package.json +1 -1
package/models/promotion.js
CHANGED
|
@@ -95,7 +95,14 @@ module.exports = function (mongoose) {
|
|
|
95
95
|
|
|
96
96
|
if (!_.isUndefined(params)) {
|
|
97
97
|
debug('getAvailableAnnouncement:querystring %o', params)
|
|
98
|
-
const {
|
|
98
|
+
const {
|
|
99
|
+
pname,
|
|
100
|
+
locale,
|
|
101
|
+
ta_device,
|
|
102
|
+
country,
|
|
103
|
+
device_list,
|
|
104
|
+
device_os
|
|
105
|
+
} = params
|
|
99
106
|
if (!_.isUndefined(pname) && _.isString(pname)) {
|
|
100
107
|
defaultQuery['$and'].push({
|
|
101
108
|
announce_for: { '$in': _.concat([pname], 'all') }
|
|
@@ -130,6 +137,23 @@ module.exports = function (mongoose) {
|
|
|
130
137
|
}]
|
|
131
138
|
})
|
|
132
139
|
}
|
|
140
|
+
|
|
141
|
+
if (!_.isUndefined(device_list) && _.isString(device_list)) {
|
|
142
|
+
const deviceList = device_list.split(',')
|
|
143
|
+
defaultQuery['$and'].push({
|
|
144
|
+
'device_list': { $in: deviceList }
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (!_.isUndefined(device_os) && _.isString(device_os)) {
|
|
149
|
+
defaultQuery['$and'].push({
|
|
150
|
+
'$or': [{
|
|
151
|
+
'device_os': 'all'
|
|
152
|
+
}, {
|
|
153
|
+
'device_os': device_os
|
|
154
|
+
}]
|
|
155
|
+
})
|
|
156
|
+
}
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
let ret
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "27.2.0",
|
|
3
|
+
"version": "27.2.2-beta.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",
|