@grapadigital/shared-schemas 1.0.210 → 1.0.211
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.
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
27
|
import { Action } from './action.schema';
|
|
28
|
+
import type { Influencer } from './influencer.schema';
|
|
28
29
|
import { Profile } from './profile.schema';
|
|
29
30
|
export type RecruitmentDocument = HydratedDocument<Recruitment>;
|
|
30
31
|
export declare class Delivery {
|
|
@@ -187,17 +188,30 @@ export declare const ScopeSchema: MongooseSchema<Scope, import("mongoose").Model
|
|
|
187
188
|
} & {
|
|
188
189
|
__v: number;
|
|
189
190
|
}>;
|
|
191
|
+
export declare class RecruitmentProfile {
|
|
192
|
+
profile: Types.ObjectId | Profile;
|
|
193
|
+
primetagId?: string;
|
|
194
|
+
}
|
|
195
|
+
export declare const RecruitmentProfileSchema: MongooseSchema<RecruitmentProfile, import("mongoose").Model<RecruitmentProfile, any, any, any, import("mongoose").Document<unknown, any, RecruitmentProfile, any, {}> & RecruitmentProfile & {
|
|
196
|
+
_id: Types.ObjectId;
|
|
197
|
+
} & {
|
|
198
|
+
__v: number;
|
|
199
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, RecruitmentProfile, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<RecruitmentProfile>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<RecruitmentProfile> & {
|
|
200
|
+
_id: Types.ObjectId;
|
|
201
|
+
} & {
|
|
202
|
+
__v: number;
|
|
203
|
+
}>;
|
|
190
204
|
export declare class Recruitment {
|
|
191
205
|
_id?: Types.ObjectId;
|
|
192
206
|
username: string;
|
|
193
207
|
picture: string;
|
|
194
208
|
status: 'selected' | 'inContact' | 'inApproval' | 'recruited' | 'removed';
|
|
195
209
|
action: Types.ObjectId | Action;
|
|
196
|
-
|
|
210
|
+
influencer: Types.ObjectId | Influencer;
|
|
211
|
+
profiles: RecruitmentProfile[];
|
|
197
212
|
scope?: Scope;
|
|
198
213
|
createdAt?: Date;
|
|
199
214
|
updatedAt?: Date;
|
|
200
|
-
primetagId?: string;
|
|
201
215
|
useAmbassadorContract?: boolean;
|
|
202
216
|
}
|
|
203
217
|
export declare const RecruitmentSchema: MongooseSchema<Recruitment, import("mongoose").Model<Recruitment, any, any, any, import("mongoose").Document<unknown, any, Recruitment, any, {}> & Recruitment & Required<{
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RecruitmentModel = exports.RecruitmentSchema = exports.Recruitment = exports.ScopeSchema = exports.Scope = exports.ScopeEstimatesSchema = exports.ScopeEstimates = exports.ScopeEstimateBreakdownSchema = exports.ScopeEstimateBreakdown = exports.ScopeEstimateMetricsSchema = exports.ScopeEstimateMetrics = exports.CollabSchema = exports.Collab = exports.ExchangeSchema = exports.Exchange = exports.InstallmentInfoSchema = exports.InstallmentInfo = exports.RightsSchema = exports.Rights = exports.RightSchema = exports.Right = exports.DeliverySchema = exports.Delivery = void 0;
|
|
12
|
+
exports.RecruitmentModel = exports.RecruitmentSchema = exports.Recruitment = exports.RecruitmentProfileSchema = exports.RecruitmentProfile = exports.ScopeSchema = exports.Scope = exports.ScopeEstimatesSchema = exports.ScopeEstimates = exports.ScopeEstimateBreakdownSchema = exports.ScopeEstimateBreakdown = exports.ScopeEstimateMetricsSchema = exports.ScopeEstimateMetrics = exports.CollabSchema = exports.Collab = exports.ExchangeSchema = exports.Exchange = exports.InstallmentInfoSchema = exports.InstallmentInfo = exports.RightsSchema = exports.Rights = exports.RightSchema = exports.Right = exports.DeliverySchema = exports.Delivery = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
15
|
let Delivery = class Delivery {
|
|
@@ -280,6 +280,26 @@ Scope = __decorate([
|
|
|
280
280
|
], Scope);
|
|
281
281
|
exports.Scope = Scope;
|
|
282
282
|
exports.ScopeSchema = mongoose_1.SchemaFactory.createForClass(Scope);
|
|
283
|
+
// Perfil participante do recrutamento — cada um tem a sua collaboration na
|
|
284
|
+
// Primetag (primetagId = collaboration_id), criada quando o recrutamento vira
|
|
285
|
+
// 'recruited'.
|
|
286
|
+
let RecruitmentProfile = class RecruitmentProfile {
|
|
287
|
+
};
|
|
288
|
+
__decorate([
|
|
289
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: true }),
|
|
290
|
+
__metadata("design:type", Object)
|
|
291
|
+
], RecruitmentProfile.prototype, "profile", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
294
|
+
__metadata("design:type", String)
|
|
295
|
+
], RecruitmentProfile.prototype, "primetagId", void 0);
|
|
296
|
+
RecruitmentProfile = __decorate([
|
|
297
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
298
|
+
], RecruitmentProfile);
|
|
299
|
+
exports.RecruitmentProfile = RecruitmentProfile;
|
|
300
|
+
exports.RecruitmentProfileSchema = mongoose_1.SchemaFactory.createForClass(RecruitmentProfile);
|
|
301
|
+
// 1 por (action, influencer): o scope (entregas + pagamento) é do influenciador
|
|
302
|
+
// na campanha inteira, dividido entre todos os perfis de `profiles`.
|
|
283
303
|
let Recruitment = class Recruitment {
|
|
284
304
|
};
|
|
285
305
|
__decorate([
|
|
@@ -307,9 +327,13 @@ __decorate([
|
|
|
307
327
|
__metadata("design:type", Object)
|
|
308
328
|
], Recruitment.prototype, "action", void 0);
|
|
309
329
|
__decorate([
|
|
310
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: '
|
|
330
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Influencer', required: true }),
|
|
311
331
|
__metadata("design:type", Object)
|
|
312
|
-
], Recruitment.prototype, "
|
|
332
|
+
], Recruitment.prototype, "influencer", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
(0, mongoose_1.Prop)({ type: [exports.RecruitmentProfileSchema], default: [] }),
|
|
335
|
+
__metadata("design:type", Array)
|
|
336
|
+
], Recruitment.prototype, "profiles", void 0);
|
|
313
337
|
__decorate([
|
|
314
338
|
(0, mongoose_1.Prop)({ type: exports.ScopeSchema }),
|
|
315
339
|
__metadata("design:type", Scope)
|
|
@@ -322,10 +346,6 @@ __decorate([
|
|
|
322
346
|
(0, mongoose_1.Prop)({ default: Date.now, required: false }),
|
|
323
347
|
__metadata("design:type", Date)
|
|
324
348
|
], Recruitment.prototype, "updatedAt", void 0);
|
|
325
|
-
__decorate([
|
|
326
|
-
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
327
|
-
__metadata("design:type", String)
|
|
328
|
-
], Recruitment.prototype, "primetagId", void 0);
|
|
329
349
|
__decorate([
|
|
330
350
|
(0, mongoose_1.Prop)({ type: Boolean, required: false, default: false }),
|
|
331
351
|
__metadata("design:type", Boolean)
|
|
@@ -337,7 +357,9 @@ exports.Recruitment = Recruitment;
|
|
|
337
357
|
exports.RecruitmentSchema = mongoose_1.SchemaFactory.createForClass(Recruitment);
|
|
338
358
|
exports.RecruitmentSchema.index({ action: 1, status: 1 });
|
|
339
359
|
exports.RecruitmentSchema.index({ action: 1 });
|
|
340
|
-
exports.RecruitmentSchema.index({
|
|
341
|
-
exports.RecruitmentSchema.index({ profile: 1, status: 1
|
|
360
|
+
exports.RecruitmentSchema.index({ action: 1, influencer: 1 }, { unique: true });
|
|
361
|
+
exports.RecruitmentSchema.index({ 'profiles.profile': 1, status: 1 });
|
|
362
|
+
exports.RecruitmentSchema.index({ influencer: 1, status: 1, 'scope.exclusivity': 1 });
|
|
363
|
+
exports.RecruitmentSchema.index({ action: 1, 'profiles.primetagId': 1 });
|
|
342
364
|
exports.RecruitmentSchema.index({ username: 1, _id: 1 });
|
|
343
365
|
exports.RecruitmentModel = (0, mongoose_2.model)('Recruitment', exports.RecruitmentSchema);
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
2
|
import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
|
|
3
3
|
import { Action } from './action.schema';
|
|
4
|
+
import type { Influencer } from './influencer.schema';
|
|
4
5
|
import { Profile } from './profile.schema';
|
|
5
6
|
|
|
6
7
|
export type RecruitmentDocument = HydratedDocument<Recruitment>;
|
|
@@ -179,6 +180,22 @@ export class Scope {
|
|
|
179
180
|
|
|
180
181
|
export const ScopeSchema = SchemaFactory.createForClass(Scope);
|
|
181
182
|
|
|
183
|
+
// Perfil participante do recrutamento — cada um tem a sua collaboration na
|
|
184
|
+
// Primetag (primetagId = collaboration_id), criada quando o recrutamento vira
|
|
185
|
+
// 'recruited'.
|
|
186
|
+
@Schema({ _id: false })
|
|
187
|
+
export class RecruitmentProfile {
|
|
188
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
|
|
189
|
+
profile: Types.ObjectId | Profile;
|
|
190
|
+
|
|
191
|
+
@Prop({ type: String, required: false })
|
|
192
|
+
primetagId?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export const RecruitmentProfileSchema = SchemaFactory.createForClass(RecruitmentProfile);
|
|
196
|
+
|
|
197
|
+
// 1 por (action, influencer): o scope (entregas + pagamento) é do influenciador
|
|
198
|
+
// na campanha inteira, dividido entre todos os perfis de `profiles`.
|
|
182
199
|
@Schema({ timestamps: true })
|
|
183
200
|
export class Recruitment {
|
|
184
201
|
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
@@ -200,8 +217,11 @@ export class Recruitment {
|
|
|
200
217
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action' })
|
|
201
218
|
action: Types.ObjectId | Action;
|
|
202
219
|
|
|
203
|
-
@Prop({ type: MongooseSchema.Types.ObjectId, ref: '
|
|
204
|
-
|
|
220
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Influencer', required: true })
|
|
221
|
+
influencer: Types.ObjectId | Influencer;
|
|
222
|
+
|
|
223
|
+
@Prop({ type: [RecruitmentProfileSchema], default: [] })
|
|
224
|
+
profiles: RecruitmentProfile[];
|
|
205
225
|
|
|
206
226
|
@Prop({ type: ScopeSchema })
|
|
207
227
|
scope?: Scope;
|
|
@@ -212,9 +232,6 @@ export class Recruitment {
|
|
|
212
232
|
@Prop({ default: Date.now, required: false })
|
|
213
233
|
updatedAt?: Date;
|
|
214
234
|
|
|
215
|
-
@Prop({ type: String, required: false })
|
|
216
|
-
primetagId?: string;
|
|
217
|
-
|
|
218
235
|
// Toggle: paga via contrato de embaixador do influenciador (valor fixo
|
|
219
236
|
// recorrente, ver Influencer.contracts) em vez de scope.payment/advisorPayment.
|
|
220
237
|
// Só pode haver 1 contrato ativo por (influencer, client) ao mesmo tempo,
|
|
@@ -227,8 +244,10 @@ export const RecruitmentSchema = SchemaFactory.createForClass(Recruitment);
|
|
|
227
244
|
|
|
228
245
|
RecruitmentSchema.index({ action: 1, status: 1 });
|
|
229
246
|
RecruitmentSchema.index({ action: 1 });
|
|
230
|
-
RecruitmentSchema.index({
|
|
231
|
-
RecruitmentSchema.index({ profile: 1, status: 1
|
|
247
|
+
RecruitmentSchema.index({ action: 1, influencer: 1 }, { unique: true });
|
|
248
|
+
RecruitmentSchema.index({ 'profiles.profile': 1, status: 1 });
|
|
249
|
+
RecruitmentSchema.index({ influencer: 1, status: 1, 'scope.exclusivity': 1 });
|
|
250
|
+
RecruitmentSchema.index({ action: 1, 'profiles.primetagId': 1 });
|
|
232
251
|
RecruitmentSchema.index({ username: 1, _id: 1 });
|
|
233
252
|
|
|
234
253
|
export const RecruitmentModel = MongooseModel('Recruitment', RecruitmentSchema);
|