@grapadigital/shared-schemas 1.0.171 → 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.
|
@@ -36,6 +36,8 @@ export type TaskFormat = (typeof TASK_FORMAT_VALUES)[number];
|
|
|
36
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;
|
|
@@ -47,7 +49,7 @@ export declare class Task {
|
|
|
47
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;
|
|
@@ -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.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");
|
|
@@ -40,6 +40,15 @@ exports.TASK_STATUS_BY_TYPE = {
|
|
|
40
40
|
analytics: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
41
41
|
diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
42
42
|
};
|
|
43
|
+
exports.TASK_STATUS_VALUES = [
|
|
44
|
+
'awaiting',
|
|
45
|
+
'pending',
|
|
46
|
+
'late',
|
|
47
|
+
'done',
|
|
48
|
+
'approval',
|
|
49
|
+
'rework',
|
|
50
|
+
'cancelled',
|
|
51
|
+
];
|
|
43
52
|
let Task = class Task {
|
|
44
53
|
};
|
|
45
54
|
__decorate([
|
|
@@ -99,17 +108,8 @@ __decorate([
|
|
|
99
108
|
__metadata("design:type", String)
|
|
100
109
|
], Task.prototype, "type", void 0);
|
|
101
110
|
__decorate([
|
|
102
|
-
(0, swagger_1.ApiProperty)({ example: 'awaiting' }),
|
|
103
|
-
(0, mongoose_1.Prop)({
|
|
104
|
-
type: String,
|
|
105
|
-
required: true,
|
|
106
|
-
validate: {
|
|
107
|
-
validator: function (value) {
|
|
108
|
-
return exports.TASK_STATUS_BY_TYPE[this.type]?.includes(value) ?? false;
|
|
109
|
-
},
|
|
110
|
-
message: 'status inválido para o type da task',
|
|
111
|
-
},
|
|
112
|
-
}),
|
|
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 }),
|
|
113
113
|
__metadata("design:type", String)
|
|
114
114
|
], Task.prototype, "status", void 0);
|
|
115
115
|
__decorate([
|
package/package.json
CHANGED
|
@@ -52,6 +52,17 @@ export const TASK_STATUS_BY_TYPE: Record<TaskType, string[]> = {
|
|
|
52
52
|
diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
53
53
|
};
|
|
54
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
|
+
|
|
55
66
|
@Schema({ timestamps: true })
|
|
56
67
|
export class Task {
|
|
57
68
|
@ApiProperty({ example: '64bfc3a78d3f1e2a12345670' })
|
|
@@ -100,18 +111,9 @@ export class Task {
|
|
|
100
111
|
@Prop({ type: String, enum: TASK_TYPE_VALUES, required: true })
|
|
101
112
|
type: TaskType;
|
|
102
113
|
|
|
103
|
-
@ApiProperty({ example: 'awaiting' })
|
|
104
|
-
@Prop({
|
|
105
|
-
|
|
106
|
-
required: true,
|
|
107
|
-
validate: {
|
|
108
|
-
validator: function (this: Task, value: string) {
|
|
109
|
-
return TASK_STATUS_BY_TYPE[this.type]?.includes(value) ?? false;
|
|
110
|
-
},
|
|
111
|
-
message: 'status inválido para o type da task',
|
|
112
|
-
},
|
|
113
|
-
})
|
|
114
|
-
status: string;
|
|
114
|
+
@ApiProperty({ enum: TASK_STATUS_VALUES, example: 'awaiting' })
|
|
115
|
+
@Prop({ type: String, enum: TASK_STATUS_VALUES, required: true })
|
|
116
|
+
status: TaskStatus;
|
|
115
117
|
|
|
116
118
|
@ApiProperty({ example: 'https://drive.google.com/...', required: false })
|
|
117
119
|
@Prop({ type: String, required: false })
|