@positivegrid/pg-mongoose-schema 27.2.2-beta.2 → 27.3.1

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.
@@ -138,31 +138,17 @@ module.exports = function (mongoose) {
138
138
  })
139
139
  }
140
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.push({
156
- 'device_list': {
157
- '$in': Array.from(singletoneProductName)
158
- }
141
+ if (!_.isUndefined(device_list)) {
142
+ if (_.isString(device_list) && !_.isEmpty(device_list)) {
143
+ const deviceList = device_list.split(',')
144
+ defaultQuery['$and'].push({
145
+ 'device_list': { $in: deviceList }
146
+ })
147
+ } else {
148
+ defaultQuery['$and'].push({
149
+ 'device_list': { $in: ['none'] }
159
150
  })
160
151
  }
161
- defaultQuery['$and'].push({
162
- '$or': [{
163
- 'device_list': { $in: deviceList }
164
- }].concat(allSelectedProduct)
165
- })
166
152
  }
167
153
 
168
154
  if (!_.isUndefined(device_os) && _.isString(device_os)) {
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.2.2-beta.2",
3
+ "version": "27.3.1",
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",