@grapadigital/shared-schemas 1.0.170 → 1.0.172
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.
|
@@ -61,6 +61,8 @@ declare class Note {
|
|
|
61
61
|
owner: string;
|
|
62
62
|
createdAt: Date;
|
|
63
63
|
}
|
|
64
|
+
export declare const ACTION_BUSINESS_UNIT_VALUES: readonly ["service", "comercial", "squad_a", "squad_b"];
|
|
65
|
+
export type ActionBusinessUnit = (typeof ACTION_BUSINESS_UNIT_VALUES)[number];
|
|
64
66
|
export declare const ACTION_STATUS_VALUES: readonly ["config", "script", "production", "posting", "analytics", "finished", "onHold", "cancelled", "inProgress", "archived"];
|
|
65
67
|
export type ActionStatus = (typeof ACTION_STATUS_VALUES)[number];
|
|
66
68
|
export declare class Action {
|
|
@@ -101,6 +103,7 @@ export declare class Action {
|
|
|
101
103
|
objective?: string;
|
|
102
104
|
description?: string;
|
|
103
105
|
tags?: string[];
|
|
106
|
+
businessUnit?: ActionBusinessUnit;
|
|
104
107
|
}
|
|
105
108
|
export declare const ActionSchema: MongooseSchema<Action, import("mongoose").Model<Action, any, any, any, import("mongoose").Document<unknown, any, Action, any, {}> & Action & Required<{
|
|
106
109
|
_id: Types.ObjectId;
|
|
@@ -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.ActionModel = exports.ActionSchema = exports.Action = exports.ACTION_STATUS_VALUES = exports.ResponsiblesSchema = exports.Responsibles = exports.ResponsibleSchema = exports.Responsible = void 0;
|
|
12
|
+
exports.ActionModel = exports.ActionSchema = exports.Action = exports.ACTION_STATUS_VALUES = exports.ACTION_BUSINESS_UNIT_VALUES = exports.ResponsiblesSchema = exports.Responsibles = exports.ResponsibleSchema = exports.Responsible = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const swagger_1 = require("@nestjs/swagger");
|
|
15
15
|
const mongoose_2 = require("mongoose");
|
|
@@ -74,6 +74,12 @@ Note = __decorate([
|
|
|
74
74
|
(0, mongoose_1.Schema)({ _id: false })
|
|
75
75
|
], Note);
|
|
76
76
|
const NoteSchema = mongoose_1.SchemaFactory.createForClass(Note);
|
|
77
|
+
exports.ACTION_BUSINESS_UNIT_VALUES = [
|
|
78
|
+
'service',
|
|
79
|
+
'comercial',
|
|
80
|
+
'squad_a',
|
|
81
|
+
'squad_b',
|
|
82
|
+
];
|
|
77
83
|
exports.ACTION_STATUS_VALUES = [
|
|
78
84
|
'config',
|
|
79
85
|
'script',
|
|
@@ -288,6 +294,11 @@ __decorate([
|
|
|
288
294
|
(0, mongoose_1.Prop)({ type: [String], required: false }),
|
|
289
295
|
__metadata("design:type", Array)
|
|
290
296
|
], Action.prototype, "tags", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
(0, swagger_1.ApiProperty)({ enum: exports.ACTION_BUSINESS_UNIT_VALUES, required: false }),
|
|
299
|
+
(0, mongoose_1.Prop)({ type: String, enum: exports.ACTION_BUSINESS_UNIT_VALUES, required: false }),
|
|
300
|
+
__metadata("design:type", String)
|
|
301
|
+
], Action.prototype, "businessUnit", void 0);
|
|
291
302
|
Action = __decorate([
|
|
292
303
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
293
304
|
], Action);
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
|
-
import { Action } from './action.schema';
|
|
27
|
+
import { Action, ActionBusinessUnit } from './action.schema';
|
|
28
28
|
import { Client } from './client.schema';
|
|
29
29
|
import { Content } from './content.schema';
|
|
30
30
|
import { Influencer } from './influencer.schema';
|
|
@@ -33,9 +33,11 @@ import { Recruitment } from './recruitment.schema';
|
|
|
33
33
|
export type TaskDocument = HydratedDocument<Task>;
|
|
34
34
|
export declare const TASK_FORMAT_VALUES: readonly ["reel", "image", "carousel", "story", "tiktok", "youtube", "linkedin", "pinterest"];
|
|
35
35
|
export type TaskFormat = (typeof TASK_FORMAT_VALUES)[number];
|
|
36
|
-
export declare const TASK_TYPE_VALUES: readonly ["briefing", "script", "production", "posting", "analytics"];
|
|
36
|
+
export declare const TASK_TYPE_VALUES: readonly ["briefing", "script", "production", "posting", "analytics", "diagnosis"];
|
|
37
37
|
export type TaskType = (typeof TASK_TYPE_VALUES)[number];
|
|
38
38
|
export declare const TASK_STATUS_BY_TYPE: Record<TaskType, string[]>;
|
|
39
|
+
export declare const TASK_STATUS_VALUES: readonly ["awaiting", "pending", "late", "done", "approval", "rework", "cancelled"];
|
|
40
|
+
export type TaskStatus = (typeof TASK_STATUS_VALUES)[number];
|
|
39
41
|
export declare class Task {
|
|
40
42
|
_id?: Types.ObjectId;
|
|
41
43
|
recruitment: Types.ObjectId | Recruitment;
|
|
@@ -44,16 +46,18 @@ export declare class Task {
|
|
|
44
46
|
profile: Types.ObjectId | Profile;
|
|
45
47
|
influencer: Types.ObjectId | Influencer;
|
|
46
48
|
deliverableId: Types.ObjectId;
|
|
47
|
-
format
|
|
49
|
+
format?: TaskFormat;
|
|
48
50
|
sequence: number;
|
|
49
51
|
type: TaskType;
|
|
50
|
-
status:
|
|
52
|
+
status: TaskStatus;
|
|
51
53
|
link?: string;
|
|
52
54
|
dueDate?: Date | null;
|
|
53
55
|
contentId?: Types.ObjectId | Content;
|
|
54
56
|
socialnetwork?: string;
|
|
55
57
|
requiredTags?: string;
|
|
56
58
|
observation?: string;
|
|
59
|
+
organization: Types.ObjectId;
|
|
60
|
+
businessUnit?: ActionBusinessUnit;
|
|
57
61
|
}
|
|
58
62
|
export declare const TaskSchema: MongooseSchema<Task, import("mongoose").Model<Task, any, any, any, import("mongoose").Document<unknown, any, Task, any, {}> & Task & Required<{
|
|
59
63
|
_id: Types.ObjectId;
|
|
@@ -9,10 +9,11 @@ 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.TaskModel = exports.TaskSchema = exports.Task = exports.TASK_STATUS_BY_TYPE = exports.TASK_TYPE_VALUES = exports.TASK_FORMAT_VALUES = void 0;
|
|
12
|
+
exports.TaskModel = exports.TaskSchema = exports.Task = exports.TASK_STATUS_VALUES = exports.TASK_STATUS_BY_TYPE = exports.TASK_TYPE_VALUES = exports.TASK_FORMAT_VALUES = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const swagger_1 = require("@nestjs/swagger");
|
|
15
15
|
const mongoose_2 = require("mongoose");
|
|
16
|
+
const action_schema_1 = require("./action.schema");
|
|
16
17
|
exports.TASK_FORMAT_VALUES = [
|
|
17
18
|
'reel',
|
|
18
19
|
'image',
|
|
@@ -29,14 +30,25 @@ exports.TASK_TYPE_VALUES = [
|
|
|
29
30
|
'production',
|
|
30
31
|
'posting',
|
|
31
32
|
'analytics',
|
|
33
|
+
'diagnosis',
|
|
32
34
|
];
|
|
33
35
|
exports.TASK_STATUS_BY_TYPE = {
|
|
34
|
-
briefing: ['awaiting', '
|
|
35
|
-
script: ['pending', 'approval', 'rework', '
|
|
36
|
-
production: ['pending', '
|
|
37
|
-
posting: ['
|
|
38
|
-
analytics: ['
|
|
36
|
+
briefing: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
37
|
+
script: ['awaiting', 'pending', 'late', 'done', 'approval', 'rework', 'cancelled'],
|
|
38
|
+
production: ['awaiting', 'pending', 'late', 'done', 'approval', 'rework', 'cancelled'],
|
|
39
|
+
posting: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
40
|
+
analytics: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
41
|
+
diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
39
42
|
};
|
|
43
|
+
exports.TASK_STATUS_VALUES = [
|
|
44
|
+
'awaiting',
|
|
45
|
+
'pending',
|
|
46
|
+
'late',
|
|
47
|
+
'done',
|
|
48
|
+
'approval',
|
|
49
|
+
'rework',
|
|
50
|
+
'cancelled',
|
|
51
|
+
];
|
|
40
52
|
let Task = class Task {
|
|
41
53
|
};
|
|
42
54
|
__decorate([
|
|
@@ -75,8 +87,14 @@ __decorate([
|
|
|
75
87
|
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
76
88
|
], Task.prototype, "deliverableId", void 0);
|
|
77
89
|
__decorate([
|
|
78
|
-
(0, swagger_1.ApiProperty)({ enum: exports.TASK_FORMAT_VALUES, example: 'reel' }),
|
|
79
|
-
(0, mongoose_1.Prop)({
|
|
90
|
+
(0, swagger_1.ApiProperty)({ enum: exports.TASK_FORMAT_VALUES, example: 'reel', required: false }),
|
|
91
|
+
(0, mongoose_1.Prop)({
|
|
92
|
+
type: String,
|
|
93
|
+
enum: exports.TASK_FORMAT_VALUES,
|
|
94
|
+
required: function () {
|
|
95
|
+
return this.type !== 'diagnosis';
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
80
98
|
__metadata("design:type", String)
|
|
81
99
|
], Task.prototype, "format", void 0);
|
|
82
100
|
__decorate([
|
|
@@ -90,17 +108,8 @@ __decorate([
|
|
|
90
108
|
__metadata("design:type", String)
|
|
91
109
|
], Task.prototype, "type", void 0);
|
|
92
110
|
__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
|
-
}),
|
|
111
|
+
(0, swagger_1.ApiProperty)({ enum: exports.TASK_STATUS_VALUES, example: 'awaiting' }),
|
|
112
|
+
(0, mongoose_1.Prop)({ type: String, enum: exports.TASK_STATUS_VALUES, required: true }),
|
|
104
113
|
__metadata("design:type", String)
|
|
105
114
|
], Task.prototype, "status", void 0);
|
|
106
115
|
__decorate([
|
|
@@ -133,15 +142,27 @@ __decorate([
|
|
|
133
142
|
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
134
143
|
__metadata("design:type", String)
|
|
135
144
|
], Task.prototype, "observation", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: true }),
|
|
147
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
148
|
+
], Task.prototype, "organization", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, swagger_1.ApiProperty)({ enum: action_schema_1.ACTION_BUSINESS_UNIT_VALUES, required: false }),
|
|
151
|
+
(0, mongoose_1.Prop)({ type: String, enum: action_schema_1.ACTION_BUSINESS_UNIT_VALUES, required: false }),
|
|
152
|
+
__metadata("design:type", String)
|
|
153
|
+
], Task.prototype, "businessUnit", void 0);
|
|
136
154
|
Task = __decorate([
|
|
137
155
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
138
156
|
], Task);
|
|
139
157
|
exports.Task = Task;
|
|
140
158
|
exports.TaskSchema = mongoose_1.SchemaFactory.createForClass(Task);
|
|
141
159
|
exports.TaskSchema.index({ deliverableId: 1 });
|
|
160
|
+
exports.TaskSchema.index({ deliverableId: 1, type: 1 }, { unique: true });
|
|
142
161
|
exports.TaskSchema.index({ recruitment: 1 });
|
|
143
162
|
exports.TaskSchema.index({ action: 1, type: 1, status: 1 });
|
|
144
163
|
exports.TaskSchema.index({ dueDate: 1 });
|
|
145
164
|
exports.TaskSchema.index({ client: 1, dueDate: 1 });
|
|
146
165
|
exports.TaskSchema.index({ influencer: 1, dueDate: 1 });
|
|
166
|
+
exports.TaskSchema.index({ organization: 1 });
|
|
167
|
+
exports.TaskSchema.index({ businessUnit: 1 });
|
|
147
168
|
exports.TaskModel = (0, mongoose_2.model)('Task', exports.TaskSchema);
|
package/package.json
CHANGED
|
@@ -54,6 +54,14 @@ class Note {
|
|
|
54
54
|
|
|
55
55
|
const NoteSchema = SchemaFactory.createForClass(Note);
|
|
56
56
|
|
|
57
|
+
export const ACTION_BUSINESS_UNIT_VALUES = [
|
|
58
|
+
'service',
|
|
59
|
+
'comercial',
|
|
60
|
+
'squad_a',
|
|
61
|
+
'squad_b',
|
|
62
|
+
] as const;
|
|
63
|
+
export type ActionBusinessUnit = (typeof ACTION_BUSINESS_UNIT_VALUES)[number];
|
|
64
|
+
|
|
57
65
|
export const ACTION_STATUS_VALUES = [
|
|
58
66
|
'config',
|
|
59
67
|
'script',
|
|
@@ -233,6 +241,10 @@ export class Action {
|
|
|
233
241
|
@Prop({ type: [String], required: false})
|
|
234
242
|
tags?: string[];
|
|
235
243
|
|
|
244
|
+
@ApiProperty({ enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
|
|
245
|
+
@Prop({ type: String, enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
|
|
246
|
+
businessUnit?: ActionBusinessUnit;
|
|
247
|
+
|
|
236
248
|
}
|
|
237
249
|
|
|
238
250
|
export const ActionSchema = SchemaFactory.createForClass(Action);
|
|
@@ -8,7 +8,11 @@ import {
|
|
|
8
8
|
model as MongooseModel,
|
|
9
9
|
} from 'mongoose';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Action,
|
|
13
|
+
ACTION_BUSINESS_UNIT_VALUES,
|
|
14
|
+
ActionBusinessUnit,
|
|
15
|
+
} from './action.schema';
|
|
12
16
|
import { Client } from './client.schema';
|
|
13
17
|
import { Content } from './content.schema';
|
|
14
18
|
import { Influencer } from './influencer.schema';
|
|
@@ -35,17 +39,30 @@ export const TASK_TYPE_VALUES = [
|
|
|
35
39
|
'production',
|
|
36
40
|
'posting',
|
|
37
41
|
'analytics',
|
|
42
|
+
'diagnosis',
|
|
38
43
|
] as const;
|
|
39
44
|
export type TaskType = (typeof TASK_TYPE_VALUES)[number];
|
|
40
45
|
|
|
41
46
|
export const TASK_STATUS_BY_TYPE: Record<TaskType, string[]> = {
|
|
42
|
-
briefing: ['awaiting', '
|
|
43
|
-
script: ['pending', 'approval', 'rework', '
|
|
44
|
-
production: ['pending', '
|
|
45
|
-
posting: ['
|
|
46
|
-
analytics: ['
|
|
47
|
+
briefing: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
48
|
+
script: ['awaiting', 'pending', 'late', 'done', 'approval', 'rework', 'cancelled'],
|
|
49
|
+
production: ['awaiting', 'pending', 'late', 'done', 'approval', 'rework', 'cancelled'],
|
|
50
|
+
posting: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
51
|
+
analytics: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
52
|
+
diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
47
53
|
};
|
|
48
54
|
|
|
55
|
+
export const TASK_STATUS_VALUES = [
|
|
56
|
+
'awaiting',
|
|
57
|
+
'pending',
|
|
58
|
+
'late',
|
|
59
|
+
'done',
|
|
60
|
+
'approval',
|
|
61
|
+
'rework',
|
|
62
|
+
'cancelled',
|
|
63
|
+
] as const;
|
|
64
|
+
export type TaskStatus = (typeof TASK_STATUS_VALUES)[number];
|
|
65
|
+
|
|
49
66
|
@Schema({ timestamps: true })
|
|
50
67
|
export class Task {
|
|
51
68
|
@ApiProperty({ example: '64bfc3a78d3f1e2a12345670' })
|
|
@@ -76,9 +93,15 @@ export class Task {
|
|
|
76
93
|
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
|
|
77
94
|
deliverableId: Types.ObjectId;
|
|
78
95
|
|
|
79
|
-
@ApiProperty({ enum: TASK_FORMAT_VALUES, example: 'reel' })
|
|
80
|
-
@Prop({
|
|
81
|
-
|
|
96
|
+
@ApiProperty({ enum: TASK_FORMAT_VALUES, example: 'reel', required: false })
|
|
97
|
+
@Prop({
|
|
98
|
+
type: String,
|
|
99
|
+
enum: TASK_FORMAT_VALUES,
|
|
100
|
+
required: function (this: Task) {
|
|
101
|
+
return this.type !== 'diagnosis';
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
|
+
format?: TaskFormat;
|
|
82
105
|
|
|
83
106
|
@ApiProperty({ example: 1 })
|
|
84
107
|
@Prop({ type: Number, required: true })
|
|
@@ -88,18 +111,9 @@ export class Task {
|
|
|
88
111
|
@Prop({ type: String, enum: TASK_TYPE_VALUES, required: true })
|
|
89
112
|
type: TaskType;
|
|
90
113
|
|
|
91
|
-
@ApiProperty({ example: 'awaiting' })
|
|
92
|
-
@Prop({
|
|
93
|
-
|
|
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',
|
|
100
|
-
},
|
|
101
|
-
})
|
|
102
|
-
status: string;
|
|
114
|
+
@ApiProperty({ enum: TASK_STATUS_VALUES, example: 'awaiting' })
|
|
115
|
+
@Prop({ type: String, enum: TASK_STATUS_VALUES, required: true })
|
|
116
|
+
status: TaskStatus;
|
|
103
117
|
|
|
104
118
|
@ApiProperty({ example: 'https://drive.google.com/...', required: false })
|
|
105
119
|
@Prop({ type: String, required: false })
|
|
@@ -124,15 +138,25 @@ export class Task {
|
|
|
124
138
|
@ApiProperty({ example: 'Confirmar com o cliente antes de publicar', required: false })
|
|
125
139
|
@Prop({ type: String, required: false })
|
|
126
140
|
observation?: string;
|
|
141
|
+
|
|
142
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
|
|
143
|
+
organization: Types.ObjectId;
|
|
144
|
+
|
|
145
|
+
@ApiProperty({ enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
|
|
146
|
+
@Prop({ type: String, enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
|
|
147
|
+
businessUnit?: ActionBusinessUnit;
|
|
127
148
|
}
|
|
128
149
|
|
|
129
150
|
export const TaskSchema = SchemaFactory.createForClass(Task);
|
|
130
151
|
|
|
131
152
|
TaskSchema.index({ deliverableId: 1 });
|
|
153
|
+
TaskSchema.index({ deliverableId: 1, type: 1 }, { unique: true });
|
|
132
154
|
TaskSchema.index({ recruitment: 1 });
|
|
133
155
|
TaskSchema.index({ action: 1, type: 1, status: 1 });
|
|
134
156
|
TaskSchema.index({ dueDate: 1 });
|
|
135
157
|
TaskSchema.index({ client: 1, dueDate: 1 });
|
|
136
158
|
TaskSchema.index({ influencer: 1, dueDate: 1 });
|
|
159
|
+
TaskSchema.index({ organization: 1 });
|
|
160
|
+
TaskSchema.index({ businessUnit: 1 });
|
|
137
161
|
|
|
138
162
|
export const TaskModel = MongooseModel('Task', TaskSchema);
|