@grapadigital/shared-schemas 1.0.165 → 1.0.166

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.
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "permissions": {
3
3
  "additionalDirectories": [
4
- "/home/josevitorjr/grapadigital/api-sales/docs/specs"
4
+ "/home/josevitorjr/grapadigital/api-sales/docs/specs",
5
+ "/home/josevitorjr/grapadigital/api-invoices/docs/specs",
6
+ "/home/josevitorjr/grapadigital/api-payments/docs/specs"
5
7
  ]
6
8
  }
7
9
  }
@@ -27,15 +27,18 @@ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Action } from './action.schema';
28
28
  import { Client } from './client.schema';
29
29
  import { Content } from './content.schema';
30
+ import { Influencer } from './influencer.schema';
30
31
  import { Profile } from './profile.schema';
31
32
  import { Recruitment } from './recruitment.schema';
32
33
  export type ScheduleDocument = HydratedDocument<Schedule>;
33
34
  export declare class Schedule {
34
35
  _id?: Types.ObjectId;
35
- recruitmentId: Types.ObjectId | Recruitment;
36
- profileId: Types.ObjectId | Profile;
36
+ recruitment: Types.ObjectId | Recruitment;
37
+ profile: Types.ObjectId | Profile;
38
+ influencer: Types.ObjectId | Influencer;
37
39
  socialnetwork: string;
38
- type: string;
40
+ type: 'post' | 'task';
41
+ format?: string;
39
42
  scheduledAt: Date;
40
43
  status: 'scheduled' | 'published' | 'late' | 'cancelled';
41
44
  contentId?: Types.ObjectId | Content;
@@ -24,22 +24,37 @@ __decorate([
24
24
  (0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345678' }),
25
25
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Recruitment', required: true }),
26
26
  __metadata("design:type", Object)
27
- ], Schedule.prototype, "recruitmentId", void 0);
27
+ ], Schedule.prototype, "recruitment", void 0);
28
28
  __decorate([
29
29
  (0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345679' }),
30
30
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: true }),
31
31
  __metadata("design:type", Object)
32
- ], Schedule.prototype, "profileId", void 0);
32
+ ], Schedule.prototype, "profile", void 0);
33
+ __decorate([
34
+ (0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345683' }),
35
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Influencer', required: true }),
36
+ __metadata("design:type", Object)
37
+ ], Schedule.prototype, "influencer", void 0);
33
38
  __decorate([
34
39
  (0, swagger_1.ApiProperty)({ example: 'instagram' }),
35
40
  (0, mongoose_1.Prop)({ type: String, required: true }),
36
41
  __metadata("design:type", String)
37
42
  ], Schedule.prototype, "socialnetwork", void 0);
38
43
  __decorate([
39
- (0, swagger_1.ApiProperty)({ example: 'reel' }),
40
- (0, mongoose_1.Prop)({ type: String, required: true }),
44
+ (0, swagger_1.ApiProperty)({ enum: ['post', 'task'], example: 'post' }),
45
+ (0, mongoose_1.Prop)({ type: String, enum: ['post', 'task'], required: true }),
41
46
  __metadata("design:type", String)
42
47
  ], Schedule.prototype, "type", void 0);
48
+ __decorate([
49
+ (0, swagger_1.ApiProperty)({ example: 'reel', required: false }),
50
+ (0, mongoose_1.Prop)({
51
+ type: String,
52
+ required: function () {
53
+ return this.type === 'post';
54
+ },
55
+ }),
56
+ __metadata("design:type", String)
57
+ ], Schedule.prototype, "format", void 0);
43
58
  __decorate([
44
59
  (0, swagger_1.ApiProperty)({ example: '2025-11-05T14:00:00.000Z' }),
45
60
  (0, mongoose_1.Prop)({ type: Date, required: true }),
@@ -76,5 +91,6 @@ exports.Schedule = Schedule;
76
91
  exports.ScheduleSchema = mongoose_1.SchemaFactory.createForClass(Schedule);
77
92
  exports.ScheduleSchema.index({ actionId: 1, scheduledAt: 1 });
78
93
  exports.ScheduleSchema.index({ clientId: 1 });
79
- exports.ScheduleSchema.index({ recruitmentId: 1 });
94
+ exports.ScheduleSchema.index({ recruitment: 1 });
95
+ exports.ScheduleSchema.index({ influencer: 1 });
80
96
  exports.ScheduleModel = (0, mongoose_2.model)('Schedule', exports.ScheduleSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.165",
3
+ "version": "1.0.166",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,6 +11,7 @@ import {
11
11
  import { Action } from './action.schema';
12
12
  import { Client } from './client.schema';
13
13
  import { Content } from './content.schema';
14
+ import { Influencer } from './influencer.schema';
14
15
  import { Profile } from './profile.schema';
15
16
  import { Recruitment } from './recruitment.schema';
16
17
 
@@ -24,19 +25,32 @@ export class Schedule {
24
25
 
25
26
  @ApiProperty({ example: '64bfc3a78d3f1e2a12345678' })
26
27
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment', required: true })
27
- recruitmentId: Types.ObjectId | Recruitment;
28
+ recruitment: Types.ObjectId | Recruitment;
28
29
 
29
30
  @ApiProperty({ example: '64bfc3a78d3f1e2a12345679' })
30
31
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
31
- profileId: Types.ObjectId | Profile;
32
+ profile: Types.ObjectId | Profile;
33
+
34
+ @ApiProperty({ example: '64bfc3a78d3f1e2a12345683' })
35
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Influencer', required: true })
36
+ influencer: Types.ObjectId | Influencer;
32
37
 
33
38
  @ApiProperty({ example: 'instagram' })
34
39
  @Prop({ type: String, required: true })
35
40
  socialnetwork: string;
36
41
 
37
- @ApiProperty({ example: 'reel' })
38
- @Prop({ type: String, required: true })
39
- type: string;
42
+ @ApiProperty({ enum: ['post', 'task'], example: 'post' })
43
+ @Prop({ type: String, enum: ['post', 'task'], required: true })
44
+ type: 'post' | 'task';
45
+
46
+ @ApiProperty({ example: 'reel', required: false })
47
+ @Prop({
48
+ type: String,
49
+ required: function (this: Schedule) {
50
+ return this.type === 'post';
51
+ },
52
+ })
53
+ format?: string;
40
54
 
41
55
  @ApiProperty({ example: '2025-11-05T14:00:00.000Z' })
42
56
  @Prop({ type: Date, required: true })
@@ -67,6 +81,7 @@ export const ScheduleSchema = SchemaFactory.createForClass(Schedule);
67
81
 
68
82
  ScheduleSchema.index({ actionId: 1, scheduledAt: 1 });
69
83
  ScheduleSchema.index({ clientId: 1 });
70
- ScheduleSchema.index({ recruitmentId: 1 });
84
+ ScheduleSchema.index({ recruitment: 1 });
85
+ ScheduleSchema.index({ influencer: 1 });
71
86
 
72
87
  export const ScheduleModel = MongooseModel('Schedule', ScheduleSchema);