@positivegrid/pg-mongoose-schema 27.1.3 → 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/preset.js +1 -1
- package/models/promotion.js +29 -1
- package/package.json +1 -1
package/models/preset.js
CHANGED
|
@@ -213,7 +213,7 @@ module.exports = function (mongoose) {
|
|
|
213
213
|
name: { type: String, index: true, required: true },
|
|
214
214
|
creator_id: { type: ObjectId, ref: 'User', required: true },
|
|
215
215
|
preset_for: { type: String, required: true },
|
|
216
|
-
status: { type: Number, default: 0, required: true }, // 0:alive, 1:delete, 2: offline, 3: special(limited)
|
|
216
|
+
status: { type: Number, default: 0, required: true }, // 0:alive, 1:delete, 2: offline, 3: special(limited), 4: processing (Spark: PVN)
|
|
217
217
|
description: { type: String },
|
|
218
218
|
tags: { type: [{ type: String }], default: () => null },
|
|
219
219
|
is_featured: { type: Boolean, default: false },
|
package/models/promotion.js
CHANGED
|
@@ -42,6 +42,8 @@ module.exports = function (mongoose) {
|
|
|
42
42
|
content: { type: String, required: true },
|
|
43
43
|
country: [{ type: String }],
|
|
44
44
|
image: { type: String, default: null },
|
|
45
|
+
image_type: { type: String },
|
|
46
|
+
message_type: { type: String },
|
|
45
47
|
action_button: [{
|
|
46
48
|
type: { type: String, required: true },
|
|
47
49
|
text: { type: String, required: true },
|
|
@@ -58,6 +60,8 @@ module.exports = function (mongoose) {
|
|
|
58
60
|
// This field use to filter by target audience device
|
|
59
61
|
// e.g, desktop/ios/hardware
|
|
60
62
|
target_audience_device: [{ type: String, required: true }],
|
|
63
|
+
device_os: { type: String },
|
|
64
|
+
device_list: [{ type: String }],
|
|
61
65
|
// If accouncement would be filtered by specific license users
|
|
62
66
|
// which would be the query condition to filter
|
|
63
67
|
// e.g., demo/lite/std/pro/elite
|
|
@@ -91,7 +95,14 @@ module.exports = function (mongoose) {
|
|
|
91
95
|
|
|
92
96
|
if (!_.isUndefined(params)) {
|
|
93
97
|
debug('getAvailableAnnouncement:querystring %o', params)
|
|
94
|
-
const {
|
|
98
|
+
const {
|
|
99
|
+
pname,
|
|
100
|
+
locale,
|
|
101
|
+
ta_device,
|
|
102
|
+
country,
|
|
103
|
+
device_list,
|
|
104
|
+
device_os
|
|
105
|
+
} = params
|
|
95
106
|
if (!_.isUndefined(pname) && _.isString(pname)) {
|
|
96
107
|
defaultQuery['$and'].push({
|
|
97
108
|
announce_for: { '$in': _.concat([pname], 'all') }
|
|
@@ -126,6 +137,23 @@ module.exports = function (mongoose) {
|
|
|
126
137
|
}]
|
|
127
138
|
})
|
|
128
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
|
+
}
|
|
129
157
|
}
|
|
130
158
|
|
|
131
159
|
let ret
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "27.
|
|
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",
|