@positivegrid/pg-mongoose-schema 27.1.0 → 27.1.2
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 +10 -4
- package/package.json +1 -1
package/models/preset.js
CHANGED
|
@@ -751,9 +751,17 @@ 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
|
+
let filterQuery = {}
|
|
758
|
+
if (_.has(query, 'no_dspid')) {
|
|
759
|
+
defaultPresetCondition['preset.preset_meta.dspId'] = { '$nin': String(query.no_dspid).split(',') }
|
|
760
|
+
filterQuery = _.omit(query, ['no_dspid'])
|
|
761
|
+
}
|
|
754
762
|
|
|
755
763
|
const aggregateQuery = [{
|
|
756
|
-
'$match': _.assign({}, _queryCompatibilityHandler(
|
|
764
|
+
'$match': _.assign({}, _queryCompatibilityHandler(filterQuery), { user_id: mongoose.Types.ObjectId(filterQuery['user_id']) })
|
|
757
765
|
}, {
|
|
758
766
|
'$lookup': {
|
|
759
767
|
'from': 'jamup_preset',
|
|
@@ -764,9 +772,7 @@ module.exports = function (mongoose) {
|
|
|
764
772
|
}, {
|
|
765
773
|
'$unwind': '$preset'
|
|
766
774
|
}, {
|
|
767
|
-
'$match':
|
|
768
|
-
'preset.status': { '$eq': 0 }
|
|
769
|
-
}
|
|
775
|
+
'$match': defaultPresetCondition
|
|
770
776
|
}]
|
|
771
777
|
const presetQuery = _handlePresetVersion({}, req)
|
|
772
778
|
if (_.isEmpty(presetQuery)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positivegrid/pg-mongoose-schema",
|
|
3
|
-
"version": "27.1.
|
|
3
|
+
"version": "27.1.2",
|
|
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",
|