@positivegrid/pg-mongoose-schema 27.1.0 → 27.1.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.
Files changed (2) hide show
  1. package/models/preset.js +7 -3
  2. package/package.json +1 -1
package/models/preset.js CHANGED
@@ -751,6 +751,12 @@ module.exports = function (mongoose) {
751
751
  },
752
752
  getPresetLikeList: function (query, sort, req, cb) {
753
753
  const pageParams = parsePageParams(req.query)
754
+ const defaultPresetCondition = {
755
+ 'preset.status': { '$eq': 0 }
756
+ }
757
+ if (_.has(query, 'no_dspid')) {
758
+ defaultPresetCondition['preset.preset_meta.dspId'] = { '$nin': String(query.no_dspid).split(',') }
759
+ }
754
760
 
755
761
  const aggregateQuery = [{
756
762
  '$match': _.assign({}, _queryCompatibilityHandler(query), { user_id: mongoose.Types.ObjectId(query['user_id']) })
@@ -764,9 +770,7 @@ module.exports = function (mongoose) {
764
770
  }, {
765
771
  '$unwind': '$preset'
766
772
  }, {
767
- '$match': {
768
- 'preset.status': { '$eq': 0 }
769
- }
773
+ '$match': defaultPresetCondition
770
774
  }]
771
775
  const presetQuery = _handlePresetVersion({}, req)
772
776
  if (_.isEmpty(presetQuery)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@positivegrid/pg-mongoose-schema",
3
- "version": "27.1.0",
3
+ "version": "27.1.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",