@positivegrid/pg-mongoose-schema 26.1.1 → 26.2.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.
Files changed (2) hide show
  1. package/models/preset.js +16 -0
  2. package/package.json +1 -1
package/models/preset.js CHANGED
@@ -249,6 +249,15 @@ module.exports = function (mongoose) {
249
249
  description: 1,
250
250
  category: 1
251
251
  })
252
+ PresetSchema.index({
253
+ preset_for: 1,
254
+ status: 1
255
+ })
256
+ PresetSchema.index({
257
+ preset_for: 1,
258
+ signal_chain_type: 1,
259
+ status: 1
260
+ })
252
261
 
253
262
  const PresetSongMappingSchema = new Schema({
254
263
  preset_id: { type: ObjectId, ref: 'Preset', required: true },
@@ -498,6 +507,13 @@ module.exports = function (mongoose) {
498
507
  searchCondition = _.assign({}, searchCondition, { created_on: { $gte: moment().subtract(1, 'month').toDate() } })
499
508
  }
500
509
 
510
+ // signal_chain_type query only works in Spark for now
511
+ if (searchCondition.preset_for === 'spark') {
512
+ if (_.has(req.query, 'signal_chain_type')) {
513
+ searchCondition.signal_chain_type = req.query.signal_chain_type
514
+ }
515
+ }
516
+
501
517
  searchCondition = _handlePresetVersion(searchCondition, req)
502
518
 
503
519
  debug('getPresetsBySearch:full_text %j %j', searchCondition, sortCondition)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@positivegrid/pg-mongoose-schema",
3
- "version": "26.1.1",
3
+ "version": "26.2.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",