@grapadigital/shared-schemas 1.0.211 → 1.0.212

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.
@@ -357,7 +357,9 @@ exports.Recruitment = Recruitment;
357
357
  exports.RecruitmentSchema = mongoose_1.SchemaFactory.createForClass(Recruitment);
358
358
  exports.RecruitmentSchema.index({ action: 1, status: 1 });
359
359
  exports.RecruitmentSchema.index({ action: 1 });
360
- exports.RecruitmentSchema.index({ action: 1, influencer: 1 }, { unique: true });
360
+ // Parcial: recrutamentos legados cujo perfil não tem influenciador ficaram no
361
+ // formato antigo (sem `influencer`) e não entram na unicidade.
362
+ exports.RecruitmentSchema.index({ action: 1, influencer: 1 }, { unique: true, partialFilterExpression: { influencer: { $type: 'objectId' } } });
361
363
  exports.RecruitmentSchema.index({ 'profiles.profile': 1, status: 1 });
362
364
  exports.RecruitmentSchema.index({ influencer: 1, status: 1, 'scope.exclusivity': 1 });
363
365
  exports.RecruitmentSchema.index({ action: 1, 'profiles.primetagId': 1 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.211",
3
+ "version": "1.0.212",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -244,7 +244,12 @@ export const RecruitmentSchema = SchemaFactory.createForClass(Recruitment);
244
244
 
245
245
  RecruitmentSchema.index({ action: 1, status: 1 });
246
246
  RecruitmentSchema.index({ action: 1 });
247
- RecruitmentSchema.index({ action: 1, influencer: 1 }, { unique: true });
247
+ // Parcial: recrutamentos legados cujo perfil não tem influenciador ficaram no
248
+ // formato antigo (sem `influencer`) e não entram na unicidade.
249
+ RecruitmentSchema.index(
250
+ { action: 1, influencer: 1 },
251
+ { unique: true, partialFilterExpression: { influencer: { $type: 'objectId' } } },
252
+ );
248
253
  RecruitmentSchema.index({ 'profiles.profile': 1, status: 1 });
249
254
  RecruitmentSchema.index({ influencer: 1, status: 1, 'scope.exclusivity': 1 });
250
255
  RecruitmentSchema.index({ action: 1, 'profiles.primetagId': 1 });