@grapadigital/shared-schemas 1.0.211 → 1.0.213

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.
@@ -57,7 +57,7 @@ export declare class Commission {
57
57
  reason?: string;
58
58
  createdAt?: Date;
59
59
  updatedAt?: Date;
60
- organization?: Types.ObjectId;
60
+ organization: Types.ObjectId;
61
61
  payment?: Types.ObjectId;
62
62
  }
63
63
  export declare const CommissionSchema: MongooseSchema<Commission, import("mongoose").Model<Commission, any, any, any, import("mongoose").Document<unknown, any, Commission, any, {}> & Commission & Required<{
@@ -109,7 +109,7 @@ __decorate([
109
109
  __metadata("design:type", Date)
110
110
  ], Commission.prototype, "updatedAt", void 0);
111
111
  __decorate([
112
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: false }),
112
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: true }),
113
113
  __metadata("design:type", mongoose_2.Types.ObjectId)
114
114
  ], Commission.prototype, "organization", void 0);
115
115
  __decorate([
@@ -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.213",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -87,8 +87,8 @@ export class Commission {
87
87
  @Prop({ type: Date, default: Date.now, required: false })
88
88
  updatedAt?: Date;
89
89
 
90
- @Prop({ type: MongooseSchema.Types.ObjectId, required: false })
91
- organization?: Types.ObjectId;
90
+ @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
91
+ organization: Types.ObjectId;
92
92
 
93
93
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Payment', required: false })
94
94
  payment?: Types.ObjectId;
@@ -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 });