@positivegrid/pg-mongoose-schema 26.1.0 → 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 +20 -1
  2. package/package.json +1 -1
package/models/preset.js CHANGED
@@ -237,7 +237,10 @@ module.exports = function (mongoose) {
237
237
  rating_count: { type: Number, default: 0 },
238
238
  image_url: { type: String },
239
239
  thumb_url: { type: String },
240
- signal_chain_type: { type: Number },
240
+ signal_chain_type: {
241
+ type: String,
242
+ enum: ['in1', 'in2']
243
+ },
241
244
  created_on: { type: Date, default: Date.now },
242
245
  updated_on: { type: Date, default: Date.now }
243
246
  }, { collection: 'jamup_preset', toJSON: { virtuals: true }, toObject: { virtuals: true } })
@@ -246,6 +249,15 @@ module.exports = function (mongoose) {
246
249
  description: 1,
247
250
  category: 1
248
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
+ })
249
261
 
250
262
  const PresetSongMappingSchema = new Schema({
251
263
  preset_id: { type: ObjectId, ref: 'Preset', required: true },
@@ -495,6 +507,13 @@ module.exports = function (mongoose) {
495
507
  searchCondition = _.assign({}, searchCondition, { created_on: { $gte: moment().subtract(1, 'month').toDate() } })
496
508
  }
497
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
+
498
517
  searchCondition = _handlePresetVersion(searchCondition, req)
499
518
 
500
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.0",
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",