@positivegrid/pg-mongoose-schema 27.0.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 +10 -3
  2. package/package.json +1 -1
package/models/preset.js CHANGED
@@ -522,6 +522,9 @@ module.exports = function (mongoose) {
522
522
  if (_.has(req.query, 'signal_chain_type')) {
523
523
  searchCondition.signal_chain_type = req.query.signal_chain_type
524
524
  }
525
+ if (_.has(req.query, 'no_dspid')) {
526
+ searchCondition['preset_meta.dspId'] = { $nin: String(req.query.no_dspid).split(',') }
527
+ }
525
528
  }
526
529
 
527
530
  searchCondition = _handlePresetVersion(searchCondition, req)
@@ -748,6 +751,12 @@ module.exports = function (mongoose) {
748
751
  },
749
752
  getPresetLikeList: function (query, sort, req, cb) {
750
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
+ }
751
760
 
752
761
  const aggregateQuery = [{
753
762
  '$match': _.assign({}, _queryCompatibilityHandler(query), { user_id: mongoose.Types.ObjectId(query['user_id']) })
@@ -761,9 +770,7 @@ module.exports = function (mongoose) {
761
770
  }, {
762
771
  '$unwind': '$preset'
763
772
  }, {
764
- '$match': {
765
- 'preset.status': { '$eq': 0 }
766
- }
773
+ '$match': defaultPresetCondition
767
774
  }]
768
775
  const presetQuery = _handlePresetVersion({}, req)
769
776
  if (_.isEmpty(presetQuery)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@positivegrid/pg-mongoose-schema",
3
- "version": "27.0.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",