@grapadigital/shared-schemas 1.0.168 → 1.0.169
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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas/task.schema.d.ts +79 -0
- package/dist/schemas/task.schema.js +147 -0
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/schemas/{schedule.schema.ts → task.schema.ts} +83 -48
- package/.claude/settings.json +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './schemas/campaign.schema';
|
|
|
7
7
|
export * from './schemas/payment.schema';
|
|
8
8
|
export * from './schemas/profile.schema';
|
|
9
9
|
export * from './schemas/recruitment.schema';
|
|
10
|
-
export * from './schemas/
|
|
10
|
+
export * from './schemas/task.schema';
|
|
11
11
|
export * from './schemas/token.schema';
|
|
12
12
|
export * from './schemas/webhook.schema';
|
|
13
13
|
export * from './schemas/sale.schema';
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ __exportStar(require("./schemas/campaign.schema"), exports);
|
|
|
23
23
|
__exportStar(require("./schemas/payment.schema"), exports);
|
|
24
24
|
__exportStar(require("./schemas/profile.schema"), exports);
|
|
25
25
|
__exportStar(require("./schemas/recruitment.schema"), exports);
|
|
26
|
-
__exportStar(require("./schemas/
|
|
26
|
+
__exportStar(require("./schemas/task.schema"), exports);
|
|
27
27
|
__exportStar(require("./schemas/token.schema"), exports);
|
|
28
28
|
__exportStar(require("./schemas/webhook.schema"), exports);
|
|
29
29
|
__exportStar(require("./schemas/sale.schema"), exports);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/session" />
|
|
19
|
+
/// <reference types="mongoose/types/types" />
|
|
20
|
+
/// <reference types="mongoose/types/utility" />
|
|
21
|
+
/// <reference types="mongoose/types/validation" />
|
|
22
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
23
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
|
+
import { Action } from './action.schema';
|
|
28
|
+
import { Client } from './client.schema';
|
|
29
|
+
import { Content } from './content.schema';
|
|
30
|
+
import { Influencer } from './influencer.schema';
|
|
31
|
+
import { Profile } from './profile.schema';
|
|
32
|
+
import { Recruitment } from './recruitment.schema';
|
|
33
|
+
export type TaskDocument = HydratedDocument<Task>;
|
|
34
|
+
export declare const TASK_FORMAT_VALUES: readonly ["reel", "image", "carousel", "story", "tiktok", "youtube", "linkedin", "pinterest"];
|
|
35
|
+
export type TaskFormat = (typeof TASK_FORMAT_VALUES)[number];
|
|
36
|
+
export declare const TASK_TYPE_VALUES: readonly ["briefing", "script", "production", "posting", "analytics"];
|
|
37
|
+
export type TaskType = (typeof TASK_TYPE_VALUES)[number];
|
|
38
|
+
export declare const TASK_STATUS_BY_TYPE: Record<TaskType, string[]>;
|
|
39
|
+
export declare class Task {
|
|
40
|
+
_id?: Types.ObjectId;
|
|
41
|
+
recruitment: Types.ObjectId | Recruitment;
|
|
42
|
+
action: Types.ObjectId | Action;
|
|
43
|
+
client: Types.ObjectId | Client;
|
|
44
|
+
profile: Types.ObjectId | Profile;
|
|
45
|
+
influencer: Types.ObjectId | Influencer;
|
|
46
|
+
deliverableId: Types.ObjectId;
|
|
47
|
+
format: TaskFormat;
|
|
48
|
+
sequence: number;
|
|
49
|
+
type: TaskType;
|
|
50
|
+
status: string;
|
|
51
|
+
link?: string;
|
|
52
|
+
dueDate?: Date | null;
|
|
53
|
+
contentId?: Types.ObjectId | Content;
|
|
54
|
+
socialnetwork?: string;
|
|
55
|
+
requiredTags?: string;
|
|
56
|
+
observation?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare const TaskSchema: MongooseSchema<Task, import("mongoose").Model<Task, any, any, any, import("mongoose").Document<unknown, any, Task, any, {}> & Task & Required<{
|
|
59
|
+
_id: Types.ObjectId;
|
|
60
|
+
}> & {
|
|
61
|
+
__v: number;
|
|
62
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Task, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Task>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Task> & Required<{
|
|
63
|
+
_id: Types.ObjectId;
|
|
64
|
+
}> & {
|
|
65
|
+
__v: number;
|
|
66
|
+
}>;
|
|
67
|
+
export declare const TaskModel: import("mongoose").Model<Task, {}, {}, {}, import("mongoose").Document<unknown, {}, Task, {}, import("mongoose").DefaultSchemaOptions> & Task & Required<{
|
|
68
|
+
_id: Types.ObjectId;
|
|
69
|
+
}> & {
|
|
70
|
+
__v: number;
|
|
71
|
+
}, MongooseSchema<Task, import("mongoose").Model<Task, any, any, any, import("mongoose").Document<unknown, any, Task, any, {}> & Task & Required<{
|
|
72
|
+
_id: Types.ObjectId;
|
|
73
|
+
}> & {
|
|
74
|
+
__v: number;
|
|
75
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Task, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Task>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Task> & Required<{
|
|
76
|
+
_id: Types.ObjectId;
|
|
77
|
+
}> & {
|
|
78
|
+
__v: number;
|
|
79
|
+
}>>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TaskModel = exports.TaskSchema = exports.Task = exports.TASK_STATUS_BY_TYPE = exports.TASK_TYPE_VALUES = exports.TASK_FORMAT_VALUES = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const mongoose_2 = require("mongoose");
|
|
16
|
+
exports.TASK_FORMAT_VALUES = [
|
|
17
|
+
'reel',
|
|
18
|
+
'image',
|
|
19
|
+
'carousel',
|
|
20
|
+
'story',
|
|
21
|
+
'tiktok',
|
|
22
|
+
'youtube',
|
|
23
|
+
'linkedin',
|
|
24
|
+
'pinterest',
|
|
25
|
+
];
|
|
26
|
+
exports.TASK_TYPE_VALUES = [
|
|
27
|
+
'briefing',
|
|
28
|
+
'script',
|
|
29
|
+
'production',
|
|
30
|
+
'posting',
|
|
31
|
+
'analytics',
|
|
32
|
+
];
|
|
33
|
+
exports.TASK_STATUS_BY_TYPE = {
|
|
34
|
+
briefing: ['awaiting', 'received'],
|
|
35
|
+
script: ['pending', 'approval', 'rework', 'approved'],
|
|
36
|
+
production: ['pending', 'approval', 'rework', 'approved', 'cancelled'],
|
|
37
|
+
posting: ['pending', 'scheduled', 'published', 'late', 'cancelled'],
|
|
38
|
+
analytics: ['requested', 'received'],
|
|
39
|
+
};
|
|
40
|
+
let Task = class Task {
|
|
41
|
+
};
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345670' }),
|
|
44
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
45
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
46
|
+
], Task.prototype, "_id", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345678' }),
|
|
49
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Recruitment', required: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], Task.prototype, "recruitment", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345681' }),
|
|
54
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: true }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], Task.prototype, "action", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345682' }),
|
|
59
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Client', required: true }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], Task.prototype, "client", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345679' }),
|
|
64
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: true }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], Task.prototype, "profile", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345683' }),
|
|
69
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Influencer', required: true }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], Task.prototype, "influencer", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345684' }),
|
|
74
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: true }),
|
|
75
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
76
|
+
], Task.prototype, "deliverableId", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, swagger_1.ApiProperty)({ enum: exports.TASK_FORMAT_VALUES, example: 'reel' }),
|
|
79
|
+
(0, mongoose_1.Prop)({ type: String, enum: exports.TASK_FORMAT_VALUES, required: true }),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], Task.prototype, "format", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, swagger_1.ApiProperty)({ example: 1 }),
|
|
84
|
+
(0, mongoose_1.Prop)({ type: Number, required: true }),
|
|
85
|
+
__metadata("design:type", Number)
|
|
86
|
+
], Task.prototype, "sequence", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, swagger_1.ApiProperty)({ enum: exports.TASK_TYPE_VALUES, example: 'briefing' }),
|
|
89
|
+
(0, mongoose_1.Prop)({ type: String, enum: exports.TASK_TYPE_VALUES, required: true }),
|
|
90
|
+
__metadata("design:type", String)
|
|
91
|
+
], Task.prototype, "type", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, swagger_1.ApiProperty)({ example: 'awaiting' }),
|
|
94
|
+
(0, mongoose_1.Prop)({
|
|
95
|
+
type: String,
|
|
96
|
+
required: true,
|
|
97
|
+
validate: {
|
|
98
|
+
validator: function (value) {
|
|
99
|
+
return exports.TASK_STATUS_BY_TYPE[this.type]?.includes(value) ?? false;
|
|
100
|
+
},
|
|
101
|
+
message: 'status inválido para o type da task',
|
|
102
|
+
},
|
|
103
|
+
}),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], Task.prototype, "status", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, swagger_1.ApiProperty)({ example: 'https://drive.google.com/...', required: false }),
|
|
108
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
109
|
+
__metadata("design:type", String)
|
|
110
|
+
], Task.prototype, "link", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, swagger_1.ApiProperty)({ example: null, required: false }),
|
|
113
|
+
(0, mongoose_1.Prop)({ type: Date, required: false, default: null }),
|
|
114
|
+
__metadata("design:type", Object)
|
|
115
|
+
], Task.prototype, "dueDate", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345680', required: false }),
|
|
118
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Content', required: false }),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], Task.prototype, "contentId", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, swagger_1.ApiProperty)({ example: 'instagram', required: false }),
|
|
123
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
124
|
+
__metadata("design:type", String)
|
|
125
|
+
], Task.prototype, "socialnetwork", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, swagger_1.ApiProperty)({ example: '@marca, #publi, #ad', required: false }),
|
|
128
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
129
|
+
__metadata("design:type", String)
|
|
130
|
+
], Task.prototype, "requiredTags", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, swagger_1.ApiProperty)({ example: 'Confirmar com o cliente antes de publicar', required: false }),
|
|
133
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
134
|
+
__metadata("design:type", String)
|
|
135
|
+
], Task.prototype, "observation", void 0);
|
|
136
|
+
Task = __decorate([
|
|
137
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
138
|
+
], Task);
|
|
139
|
+
exports.Task = Task;
|
|
140
|
+
exports.TaskSchema = mongoose_1.SchemaFactory.createForClass(Task);
|
|
141
|
+
exports.TaskSchema.index({ deliverableId: 1 });
|
|
142
|
+
exports.TaskSchema.index({ recruitment: 1 });
|
|
143
|
+
exports.TaskSchema.index({ action: 1, type: 1, status: 1 });
|
|
144
|
+
exports.TaskSchema.index({ dueDate: 1 });
|
|
145
|
+
exports.TaskSchema.index({ client: 1, dueDate: 1 });
|
|
146
|
+
exports.TaskSchema.index({ influencer: 1, dueDate: 1 });
|
|
147
|
+
exports.TaskModel = (0, mongoose_2.model)('Task', exports.TaskSchema);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './schemas/campaign.schema';
|
|
|
7
7
|
export * from './schemas/payment.schema';
|
|
8
8
|
export * from './schemas/profile.schema';
|
|
9
9
|
export * from './schemas/recruitment.schema';
|
|
10
|
-
export * from './schemas/
|
|
10
|
+
export * from './schemas/task.schema';
|
|
11
11
|
export * from './schemas/token.schema';
|
|
12
12
|
export * from './schemas/webhook.schema';
|
|
13
13
|
export * from './schemas/sale.schema';
|
|
@@ -15,10 +15,39 @@ import { Influencer } from './influencer.schema';
|
|
|
15
15
|
import { Profile } from './profile.schema';
|
|
16
16
|
import { Recruitment } from './recruitment.schema';
|
|
17
17
|
|
|
18
|
-
export type
|
|
18
|
+
export type TaskDocument = HydratedDocument<Task>;
|
|
19
|
+
|
|
20
|
+
export const TASK_FORMAT_VALUES = [
|
|
21
|
+
'reel',
|
|
22
|
+
'image',
|
|
23
|
+
'carousel',
|
|
24
|
+
'story',
|
|
25
|
+
'tiktok',
|
|
26
|
+
'youtube',
|
|
27
|
+
'linkedin',
|
|
28
|
+
'pinterest',
|
|
29
|
+
] as const;
|
|
30
|
+
export type TaskFormat = (typeof TASK_FORMAT_VALUES)[number];
|
|
31
|
+
|
|
32
|
+
export const TASK_TYPE_VALUES = [
|
|
33
|
+
'briefing',
|
|
34
|
+
'script',
|
|
35
|
+
'production',
|
|
36
|
+
'posting',
|
|
37
|
+
'analytics',
|
|
38
|
+
] as const;
|
|
39
|
+
export type TaskType = (typeof TASK_TYPE_VALUES)[number];
|
|
40
|
+
|
|
41
|
+
export const TASK_STATUS_BY_TYPE: Record<TaskType, string[]> = {
|
|
42
|
+
briefing: ['awaiting', 'received'],
|
|
43
|
+
script: ['pending', 'approval', 'rework', 'approved'],
|
|
44
|
+
production: ['pending', 'approval', 'rework', 'approved', 'cancelled'],
|
|
45
|
+
posting: ['pending', 'scheduled', 'published', 'late', 'cancelled'],
|
|
46
|
+
analytics: ['requested', 'received'],
|
|
47
|
+
};
|
|
19
48
|
|
|
20
49
|
@Schema({ timestamps: true })
|
|
21
|
-
export class
|
|
50
|
+
export class Task {
|
|
22
51
|
@ApiProperty({ example: '64bfc3a78d3f1e2a12345670' })
|
|
23
52
|
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
24
53
|
_id?: Types.ObjectId;
|
|
@@ -27,6 +56,14 @@ export class Schedule {
|
|
|
27
56
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment', required: true })
|
|
28
57
|
recruitment: Types.ObjectId | Recruitment;
|
|
29
58
|
|
|
59
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345681' })
|
|
60
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
|
|
61
|
+
action: Types.ObjectId | Action;
|
|
62
|
+
|
|
63
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345682' })
|
|
64
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Client', required: true })
|
|
65
|
+
client: Types.ObjectId | Client;
|
|
66
|
+
|
|
30
67
|
@ApiProperty({ example: '64bfc3a78d3f1e2a12345679' })
|
|
31
68
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
|
|
32
69
|
profile: Types.ObjectId | Profile;
|
|
@@ -35,69 +72,67 @@ export class Schedule {
|
|
|
35
72
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Influencer', required: true })
|
|
36
73
|
influencer: Types.ObjectId | Influencer;
|
|
37
74
|
|
|
38
|
-
@ApiProperty({ example: '
|
|
39
|
-
@Prop({ type:
|
|
40
|
-
|
|
75
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345684' })
|
|
76
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
|
|
77
|
+
deliverableId: Types.ObjectId;
|
|
78
|
+
|
|
79
|
+
@ApiProperty({ enum: TASK_FORMAT_VALUES, example: 'reel' })
|
|
80
|
+
@Prop({ type: String, enum: TASK_FORMAT_VALUES, required: true })
|
|
81
|
+
format: TaskFormat;
|
|
82
|
+
|
|
83
|
+
@ApiProperty({ example: 1 })
|
|
84
|
+
@Prop({ type: Number, required: true })
|
|
85
|
+
sequence: number;
|
|
41
86
|
|
|
42
|
-
@ApiProperty({ enum:
|
|
43
|
-
@Prop({ type: String, enum:
|
|
44
|
-
type:
|
|
87
|
+
@ApiProperty({ enum: TASK_TYPE_VALUES, example: 'briefing' })
|
|
88
|
+
@Prop({ type: String, enum: TASK_TYPE_VALUES, required: true })
|
|
89
|
+
type: TaskType;
|
|
45
90
|
|
|
46
|
-
@ApiProperty({ example: '
|
|
91
|
+
@ApiProperty({ example: 'awaiting' })
|
|
47
92
|
@Prop({
|
|
48
93
|
type: String,
|
|
49
|
-
required:
|
|
50
|
-
|
|
94
|
+
required: true,
|
|
95
|
+
validate: {
|
|
96
|
+
validator: function (this: Task, value: string) {
|
|
97
|
+
return TASK_STATUS_BY_TYPE[this.type]?.includes(value) ?? false;
|
|
98
|
+
},
|
|
99
|
+
message: 'status inválido para o type da task',
|
|
51
100
|
},
|
|
52
101
|
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@ApiProperty({ example: 'Mostrar o produto em uso, destacar a promoção', required: false })
|
|
56
|
-
@Prop({ type: String, required: false })
|
|
57
|
-
briefing?: string;
|
|
58
|
-
|
|
59
|
-
@ApiProperty({ example: '@marca, #publi, #ad', required: false })
|
|
60
|
-
@Prop({ type: String, required: false })
|
|
61
|
-
requiredTags?: string;
|
|
102
|
+
status: string;
|
|
62
103
|
|
|
63
104
|
@ApiProperty({ example: 'https://drive.google.com/...', required: false })
|
|
64
105
|
@Prop({ type: String, required: false })
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@ApiProperty({ example: 'Confirmar com o cliente antes de publicar', required: false })
|
|
68
|
-
@Prop({ type: String, required: false })
|
|
69
|
-
observation?: string;
|
|
70
|
-
|
|
71
|
-
@ApiProperty({ example: '2025-11-05T14:00:00.000Z' })
|
|
72
|
-
@Prop({ type: Date, required: true })
|
|
73
|
-
scheduledAt: Date;
|
|
106
|
+
link?: string;
|
|
74
107
|
|
|
75
|
-
@ApiProperty({
|
|
76
|
-
@Prop({
|
|
77
|
-
|
|
78
|
-
enum: ['scheduled', 'published', 'late', 'cancelled'],
|
|
79
|
-
required: true,
|
|
80
|
-
})
|
|
81
|
-
status: 'scheduled' | 'published' | 'late' | 'cancelled';
|
|
108
|
+
@ApiProperty({ example: null, required: false })
|
|
109
|
+
@Prop({ type: Date, required: false, default: null })
|
|
110
|
+
dueDate?: Date | null;
|
|
82
111
|
|
|
83
112
|
@ApiProperty({ example: '64bfc3a78d3f1e2a12345680', required: false })
|
|
84
113
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Content', required: false })
|
|
85
114
|
contentId?: Types.ObjectId | Content;
|
|
86
115
|
|
|
87
|
-
@ApiProperty({ example: '
|
|
88
|
-
@Prop({ type:
|
|
89
|
-
|
|
116
|
+
@ApiProperty({ example: 'instagram', required: false })
|
|
117
|
+
@Prop({ type: String, required: false })
|
|
118
|
+
socialnetwork?: string;
|
|
90
119
|
|
|
91
|
-
@ApiProperty({ example: '
|
|
92
|
-
@Prop({ type:
|
|
93
|
-
|
|
120
|
+
@ApiProperty({ example: '@marca, #publi, #ad', required: false })
|
|
121
|
+
@Prop({ type: String, required: false })
|
|
122
|
+
requiredTags?: string;
|
|
123
|
+
|
|
124
|
+
@ApiProperty({ example: 'Confirmar com o cliente antes de publicar', required: false })
|
|
125
|
+
@Prop({ type: String, required: false })
|
|
126
|
+
observation?: string;
|
|
94
127
|
}
|
|
95
128
|
|
|
96
|
-
export const
|
|
129
|
+
export const TaskSchema = SchemaFactory.createForClass(Task);
|
|
97
130
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
131
|
+
TaskSchema.index({ deliverableId: 1 });
|
|
132
|
+
TaskSchema.index({ recruitment: 1 });
|
|
133
|
+
TaskSchema.index({ action: 1, type: 1, status: 1 });
|
|
134
|
+
TaskSchema.index({ dueDate: 1 });
|
|
135
|
+
TaskSchema.index({ client: 1, dueDate: 1 });
|
|
136
|
+
TaskSchema.index({ influencer: 1, dueDate: 1 });
|
|
102
137
|
|
|
103
|
-
export const
|
|
138
|
+
export const TaskModel = MongooseModel('Task', TaskSchema);
|
package/.claude/settings.json
DELETED