@grapadigital/shared-schemas 1.0.171 → 1.0.173

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 CHANGED
@@ -17,3 +17,4 @@ export * from './schemas/project.schema';
17
17
  export * from './schemas/commission.schema';
18
18
  export * from './schemas/contract.schema';
19
19
  export * from './schemas/benchmark.schema';
20
+ export * from './schemas/notifications.schema';
package/dist/index.js CHANGED
@@ -33,3 +33,4 @@ __exportStar(require("./schemas/project.schema"), exports);
33
33
  __exportStar(require("./schemas/commission.schema"), exports);
34
34
  __exportStar(require("./schemas/contract.schema"), exports);
35
35
  __exportStar(require("./schemas/benchmark.schema"), exports);
36
+ __exportStar(require("./schemas/notifications.schema"), exports);
@@ -28,6 +28,7 @@ import { Recruitment } from './recruitment.schema';
28
28
  import { Content } from './content.schema';
29
29
  import { Client } from './client.schema';
30
30
  import { Sale } from './sale.schema';
31
+ import { Campaign } from './campaign.schema';
31
32
  export type ActionDocument = HydratedDocument<Action>;
32
33
  export declare class Responsible {
33
34
  name: string;
@@ -104,6 +105,7 @@ export declare class Action {
104
105
  description?: string;
105
106
  tags?: string[];
106
107
  businessUnit?: ActionBusinessUnit;
108
+ campaign?: Types.ObjectId | Campaign;
107
109
  }
108
110
  export declare const ActionSchema: MongooseSchema<Action, import("mongoose").Model<Action, any, any, any, import("mongoose").Document<unknown, any, Action, any, {}> & Action & Required<{
109
111
  _id: Types.ObjectId;
@@ -17,6 +17,7 @@ const recruitment_schema_1 = require("./recruitment.schema");
17
17
  const content_schema_1 = require("./content.schema");
18
18
  const client_schema_1 = require("./client.schema");
19
19
  const sale_schema_1 = require("./sale.schema");
20
+ const campaign_schema_1 = require("./campaign.schema");
20
21
  let Responsible = class Responsible {
21
22
  };
22
23
  __decorate([
@@ -299,6 +300,11 @@ __decorate([
299
300
  (0, mongoose_1.Prop)({ type: String, enum: exports.ACTION_BUSINESS_UNIT_VALUES, required: false }),
300
301
  __metadata("design:type", String)
301
302
  ], Action.prototype, "businessUnit", void 0);
303
+ __decorate([
304
+ (0, swagger_1.ApiProperty)({ type: () => campaign_schema_1.Campaign, required: false }),
305
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Campaign', required: false }),
306
+ __metadata("design:type", Object)
307
+ ], Action.prototype, "campaign", void 0);
302
308
  Action = __decorate([
303
309
  (0, mongoose_1.Schema)({ timestamps: true })
304
310
  ], Action);
@@ -32,6 +32,9 @@ export declare class Campaign {
32
32
  client: Types.ObjectId | Client;
33
33
  createdAt?: Date;
34
34
  updatedAt?: Date;
35
+ description?: string;
36
+ startDate?: Date;
37
+ endDate?: Date;
35
38
  }
36
39
  export declare const CampaignSchema: MongooseSchema<Campaign, import("mongoose").Model<Campaign, any, any, any, import("mongoose").Document<unknown, any, Campaign, any, {}> & Campaign & Required<{
37
40
  _id: Types.ObjectId;
@@ -34,6 +34,18 @@ __decorate([
34
34
  (0, mongoose_1.Prop)({ default: Date.now, required: false }),
35
35
  __metadata("design:type", Date)
36
36
  ], Campaign.prototype, "updatedAt", void 0);
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ required: false }),
39
+ __metadata("design:type", String)
40
+ ], Campaign.prototype, "description", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)({ required: false }),
43
+ __metadata("design:type", Date)
44
+ ], Campaign.prototype, "startDate", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)({ required: false }),
47
+ __metadata("design:type", Date)
48
+ ], Campaign.prototype, "endDate", void 0);
37
49
  Campaign = __decorate([
38
50
  (0, mongoose_1.Schema)({ timestamps: true })
39
51
  ], Campaign);
@@ -0,0 +1,69 @@
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 } from 'mongoose';
27
+ export type NotificationDocument = HydratedDocument<Notification>;
28
+ export declare class NotificationRecipient {
29
+ name?: string;
30
+ username?: string;
31
+ email?: string;
32
+ }
33
+ export declare class NotificationEntity {
34
+ name?: string;
35
+ title?: string;
36
+ _id?: string;
37
+ }
38
+ export declare class Notification {
39
+ recipient: NotificationRecipient;
40
+ event: string;
41
+ channels: string[];
42
+ title?: string;
43
+ body?: string;
44
+ entity?: NotificationEntity;
45
+ read: boolean;
46
+ createdAt: Date;
47
+ }
48
+ export declare const NotificationSchema: import("mongoose").Schema<Notification, import("mongoose").Model<Notification, any, any, any, import("mongoose").Document<unknown, any, Notification, any, {}> & Notification & {
49
+ _id: import("mongoose").Types.ObjectId;
50
+ } & {
51
+ __v: number;
52
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Notification, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Notification>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Notification> & {
53
+ _id: import("mongoose").Types.ObjectId;
54
+ } & {
55
+ __v: number;
56
+ }>;
57
+ export declare const NotificationModel: import("mongoose").Model<Notification, {}, {}, {}, import("mongoose").Document<unknown, {}, Notification, {}, import("mongoose").DefaultSchemaOptions> & Notification & {
58
+ _id: import("mongoose").Types.ObjectId;
59
+ } & {
60
+ __v: number;
61
+ }, import("mongoose").Schema<Notification, import("mongoose").Model<Notification, any, any, any, import("mongoose").Document<unknown, any, Notification, any, {}> & Notification & {
62
+ _id: import("mongoose").Types.ObjectId;
63
+ } & {
64
+ __v: number;
65
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Notification, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Notification>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Notification> & {
66
+ _id: import("mongoose").Types.ObjectId;
67
+ } & {
68
+ __v: number;
69
+ }>>;
@@ -0,0 +1,90 @@
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.NotificationModel = exports.NotificationSchema = exports.Notification = exports.NotificationEntity = exports.NotificationRecipient = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ let NotificationRecipient = class NotificationRecipient {
16
+ };
17
+ __decorate([
18
+ (0, mongoose_1.Prop)({ type: String }),
19
+ __metadata("design:type", String)
20
+ ], NotificationRecipient.prototype, "name", void 0);
21
+ __decorate([
22
+ (0, mongoose_1.Prop)({ type: String }),
23
+ __metadata("design:type", String)
24
+ ], NotificationRecipient.prototype, "username", void 0);
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: String }),
27
+ __metadata("design:type", String)
28
+ ], NotificationRecipient.prototype, "email", void 0);
29
+ NotificationRecipient = __decorate([
30
+ (0, mongoose_1.Schema)({ _id: false })
31
+ ], NotificationRecipient);
32
+ exports.NotificationRecipient = NotificationRecipient;
33
+ let NotificationEntity = class NotificationEntity {
34
+ };
35
+ __decorate([
36
+ (0, mongoose_1.Prop)({ type: String }),
37
+ __metadata("design:type", String)
38
+ ], NotificationEntity.prototype, "name", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ type: String }),
41
+ __metadata("design:type", String)
42
+ ], NotificationEntity.prototype, "title", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ type: String }),
45
+ __metadata("design:type", String)
46
+ ], NotificationEntity.prototype, "_id", void 0);
47
+ NotificationEntity = __decorate([
48
+ (0, mongoose_1.Schema)({ _id: false })
49
+ ], NotificationEntity);
50
+ exports.NotificationEntity = NotificationEntity;
51
+ let Notification = class Notification {
52
+ };
53
+ __decorate([
54
+ (0, mongoose_1.Prop)({ type: NotificationRecipient, required: true }),
55
+ __metadata("design:type", NotificationRecipient)
56
+ ], Notification.prototype, "recipient", void 0);
57
+ __decorate([
58
+ (0, mongoose_1.Prop)({ required: true, type: String }),
59
+ __metadata("design:type", String)
60
+ ], Notification.prototype, "event", void 0);
61
+ __decorate([
62
+ (0, mongoose_1.Prop)({ type: [String], default: [] }),
63
+ __metadata("design:type", Array)
64
+ ], Notification.prototype, "channels", void 0);
65
+ __decorate([
66
+ (0, mongoose_1.Prop)({ type: String }),
67
+ __metadata("design:type", String)
68
+ ], Notification.prototype, "title", void 0);
69
+ __decorate([
70
+ (0, mongoose_1.Prop)({ type: String }),
71
+ __metadata("design:type", String)
72
+ ], Notification.prototype, "body", void 0);
73
+ __decorate([
74
+ (0, mongoose_1.Prop)({ type: NotificationEntity }),
75
+ __metadata("design:type", NotificationEntity)
76
+ ], Notification.prototype, "entity", void 0);
77
+ __decorate([
78
+ (0, mongoose_1.Prop)({ type: Boolean, default: false }),
79
+ __metadata("design:type", Boolean)
80
+ ], Notification.prototype, "read", void 0);
81
+ __decorate([
82
+ (0, mongoose_1.Prop)({ type: Date, default: Date.now }),
83
+ __metadata("design:type", Date)
84
+ ], Notification.prototype, "createdAt", void 0);
85
+ Notification = __decorate([
86
+ (0, mongoose_1.Schema)({ timestamps: true, collection: 'notifications' })
87
+ ], Notification);
88
+ exports.Notification = Notification;
89
+ exports.NotificationSchema = mongoose_1.SchemaFactory.createForClass(Notification);
90
+ exports.NotificationModel = (0, mongoose_2.model)('Notification', exports.NotificationSchema);
@@ -36,6 +36,7 @@ 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 type TaskStatus = 'awaiting' | 'pending' | 'late' | 'done' | 'cancelled' | 'approval' | 'rework';
39
40
  export declare class Task {
40
41
  _id?: Types.ObjectId;
41
42
  recruitment: Types.ObjectId | Recruitment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.171",
3
+ "version": "1.0.173",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -17,3 +17,4 @@ export * from './schemas/project.schema';
17
17
  export * from './schemas/commission.schema';
18
18
  export * from './schemas/contract.schema';
19
19
  export * from './schemas/benchmark.schema';
20
+ export * from './schemas/notifications.schema';
@@ -12,6 +12,7 @@ import { Recruitment } from './recruitment.schema';
12
12
  import { Content } from './content.schema';
13
13
  import { Client } from './client.schema';
14
14
  import { Sale } from './sale.schema';
15
+ import { Campaign } from './campaign.schema';
15
16
 
16
17
  export type ActionDocument = HydratedDocument<Action>;
17
18
 
@@ -245,6 +246,9 @@ export class Action {
245
246
  @Prop({ type: String, enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
246
247
  businessUnit?: ActionBusinessUnit;
247
248
 
249
+ @ApiProperty({ type: () => Campaign, required: false })
250
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Campaign', required: false })
251
+ campaign?: Types.ObjectId | Campaign;
248
252
  }
249
253
 
250
254
  export const ActionSchema = SchemaFactory.createForClass(Action);
@@ -21,7 +21,14 @@ export class Campaign {
21
21
  @Prop({ default: Date.now, required: false })
22
22
  updatedAt?: Date;
23
23
 
24
-
24
+ @Prop({ required: false })
25
+ description?: string;
26
+
27
+ @Prop({ required: false })
28
+ startDate?: Date;
29
+
30
+ @Prop({ required: false })
31
+ endDate?: Date;
25
32
  }
26
33
 
27
34
  export const CampaignSchema = SchemaFactory.createForClass(Campaign);
@@ -0,0 +1,61 @@
1
+
2
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
3
+ import { HydratedDocument, model as MongooseModel } from 'mongoose';
4
+
5
+
6
+
7
+ export type NotificationDocument = HydratedDocument<Notification>;
8
+
9
+ @Schema({ _id: false })
10
+ export class NotificationRecipient {
11
+ @Prop({ type: String })
12
+ name?: string;
13
+
14
+ @Prop({ type: String })
15
+ username?: string;
16
+
17
+ @Prop({ type: String })
18
+ email?: string;
19
+ }
20
+
21
+ @Schema({ _id: false })
22
+ export class NotificationEntity {
23
+ @Prop({ type: String })
24
+ name?: string;
25
+
26
+ @Prop({ type: String })
27
+ title?: string;
28
+
29
+ @Prop({ type: String })
30
+ _id?: string;
31
+ }
32
+
33
+ @Schema({ timestamps: true, collection: 'notifications' })
34
+ export class Notification {
35
+ @Prop({ type: NotificationRecipient, required: true })
36
+ recipient: NotificationRecipient;
37
+
38
+ @Prop({ required: true, type: String })
39
+ event: string;
40
+
41
+ @Prop({ type: [String], default: [] })
42
+ channels: string[];
43
+
44
+ @Prop({ type: String })
45
+ title?: string;
46
+
47
+ @Prop({ type: String })
48
+ body?: string;
49
+
50
+ @Prop({ type: NotificationEntity })
51
+ entity?: NotificationEntity;
52
+
53
+ @Prop({ type: Boolean, default: false })
54
+ read: boolean;
55
+
56
+ @Prop({ type: Date, default: Date.now })
57
+ createdAt: Date;
58
+ }
59
+
60
+ export const NotificationSchema = SchemaFactory.createForClass(Notification);
61
+ export const NotificationModel = MongooseModel('Notification', NotificationSchema);
@@ -52,6 +52,8 @@ export const TASK_STATUS_BY_TYPE: Record<TaskType, string[]> = {
52
52
  diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
53
53
  };
54
54
 
55
+ export type TaskStatus = 'awaiting' | 'pending' | 'late' | 'done' | 'cancelled' | 'approval' | 'rework';
56
+
55
57
  @Schema({ timestamps: true })
56
58
  export class Task {
57
59
  @ApiProperty({ example: '64bfc3a78d3f1e2a12345670' })