@grapadigital/shared-schemas 1.0.175 → 1.0.176

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
@@ -22,3 +22,4 @@ export * from './schemas/organization.schema';
22
22
  export * from './schemas/user.schema';
23
23
  export * from './schemas/group.schema';
24
24
  export * from './schemas/trigger.schema';
25
+ export { Note, NoteSchema, NoteMention, NoteMentionSchema } from './schemas/note.schema';
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.NoteMentionSchema = exports.NoteMention = exports.NoteSchema = exports.Note = void 0;
17
18
  __exportStar(require("./schemas/action.schema"), exports);
18
19
  __exportStar(require("./schemas/client.schema"), exports);
19
20
  __exportStar(require("./schemas/content.schema"), exports);
@@ -38,3 +39,12 @@ __exportStar(require("./schemas/organization.schema"), exports);
38
39
  __exportStar(require("./schemas/user.schema"), exports);
39
40
  __exportStar(require("./schemas/group.schema"), exports);
40
41
  __exportStar(require("./schemas/trigger.schema"), exports);
42
+ // Exportação explícita: `influencer.schema.ts` já exporta seu próprio `Note`/`NoteSchema`
43
+ // (domínio de anotações do Influencer, sem `mentioneds`, não tocado por esta mudança). A
44
+ // exportação nomeada abaixo tem precedência sobre a ambiguidade do `export *` e faz o `Note`
45
+ // deste arquivo (usado por Sale/Invoice/Payment/Action) ser o resolvido na raiz do pacote.
46
+ var note_schema_1 = require("./schemas/note.schema");
47
+ Object.defineProperty(exports, "Note", { enumerable: true, get: function () { return note_schema_1.Note; } });
48
+ Object.defineProperty(exports, "NoteSchema", { enumerable: true, get: function () { return note_schema_1.NoteSchema; } });
49
+ Object.defineProperty(exports, "NoteMention", { enumerable: true, get: function () { return note_schema_1.NoteMention; } });
50
+ Object.defineProperty(exports, "NoteMentionSchema", { enumerable: true, get: function () { return note_schema_1.NoteMentionSchema; } });
@@ -29,6 +29,7 @@ import { Content } from './content.schema';
29
29
  import { Client } from './client.schema';
30
30
  import { Sale } from './sale.schema';
31
31
  import { Campaign } from './campaign.schema';
32
+ import { Note } from './note.schema';
32
33
  export type ActionDocument = HydratedDocument<Action>;
33
34
  export declare class Responsible {
34
35
  name: string;
@@ -57,11 +58,6 @@ export declare const ResponsiblesSchema: MongooseSchema<Responsibles, import("mo
57
58
  } & {
58
59
  __v: number;
59
60
  }>;
60
- declare class Note {
61
- text: string;
62
- owner: string;
63
- createdAt: Date;
64
- }
65
61
  export declare const ACTION_BUSINESS_UNIT_VALUES: readonly ["service", "comercial", "squad_a", "squad_b"];
66
62
  export type ActionBusinessUnit = (typeof ACTION_BUSINESS_UNIT_VALUES)[number];
67
63
  export declare const ACTION_STATUS_VALUES: readonly ["config", "script", "production", "posting", "analytics", "finished", "onHold", "cancelled", "inProgress", "archived"];
@@ -129,4 +125,3 @@ export declare const ActionModel: import("mongoose").Model<Action, {}, {}, {}, i
129
125
  }> & {
130
126
  __v: number;
131
127
  }>>;
132
- export {};
@@ -18,6 +18,7 @@ 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
20
  const campaign_schema_1 = require("./campaign.schema");
21
+ const note_schema_1 = require("./note.schema");
21
22
  let Responsible = class Responsible {
22
23
  };
23
24
  __decorate([
@@ -57,24 +58,6 @@ Responsibles = __decorate([
57
58
  ], Responsibles);
58
59
  exports.Responsibles = Responsibles;
59
60
  exports.ResponsiblesSchema = mongoose_1.SchemaFactory.createForClass(Responsibles);
60
- let Note = class Note {
61
- };
62
- __decorate([
63
- (0, mongoose_1.Prop)({ required: true }),
64
- __metadata("design:type", String)
65
- ], Note.prototype, "text", void 0);
66
- __decorate([
67
- (0, mongoose_1.Prop)({ required: true }),
68
- __metadata("design:type", String)
69
- ], Note.prototype, "owner", void 0);
70
- __decorate([
71
- (0, mongoose_1.Prop)({ required: true }),
72
- __metadata("design:type", Date)
73
- ], Note.prototype, "createdAt", void 0);
74
- Note = __decorate([
75
- (0, mongoose_1.Schema)({ _id: false })
76
- ], Note);
77
- const NoteSchema = mongoose_1.SchemaFactory.createForClass(Note);
78
61
  exports.ACTION_BUSINESS_UNIT_VALUES = [
79
62
  'service',
80
63
  'comercial',
@@ -252,8 +235,8 @@ __decorate([
252
235
  __metadata("design:type", Date)
253
236
  ], Action.prototype, "updatedAt", void 0);
254
237
  __decorate([
255
- (0, swagger_1.ApiProperty)({ type: () => [Note], required: false }),
256
- (0, mongoose_1.Prop)({ type: [NoteSchema], required: false }),
238
+ (0, swagger_1.ApiProperty)({ type: () => [note_schema_1.Note], required: false }),
239
+ (0, mongoose_1.Prop)({ type: [note_schema_1.NoteSchema], required: false }),
257
240
  __metadata("design:type", Array)
258
241
  ], Action.prototype, "notes", void 0);
259
242
  __decorate([
@@ -25,6 +25,7 @@
25
25
  /// <reference types="mongoose/types/inferrawdoctype" />
26
26
  import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Sale } from './sale.schema';
28
+ import { Note } from './note.schema';
28
29
  export type InvoiceDocument = HydratedDocument<Invoice>;
29
30
  declare class Recipient {
30
31
  legalName: string;
@@ -61,11 +62,6 @@ declare class Canceled {
61
62
  reason: string;
62
63
  details: string;
63
64
  }
64
- declare class Note {
65
- text: string;
66
- owner: string;
67
- createdAt: Date;
68
- }
69
65
  export declare class Invoice {
70
66
  _id?: Types.ObjectId;
71
67
  title: string;
@@ -13,6 +13,7 @@ exports.InvoiceModel = exports.InvoiceSchema = exports.Invoice = 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 note_schema_1 = require("./note.schema");
16
17
  let Recipient = class Recipient {
17
18
  };
18
19
  __decorate([
@@ -158,26 +159,6 @@ __decorate([
158
159
  Canceled = __decorate([
159
160
  (0, mongoose_1.Schema)({ _id: false })
160
161
  ], Canceled);
161
- let Note = class Note {
162
- };
163
- __decorate([
164
- (0, swagger_1.ApiProperty)({ example: 'Emitir NF até dia 10' }),
165
- (0, mongoose_1.Prop)({ required: true }),
166
- __metadata("design:type", String)
167
- ], Note.prototype, "text", void 0);
168
- __decorate([
169
- (0, swagger_1.ApiProperty)({ example: 'João Silva' }),
170
- (0, mongoose_1.Prop)({ required: true }),
171
- __metadata("design:type", String)
172
- ], Note.prototype, "owner", void 0);
173
- __decorate([
174
- (0, swagger_1.ApiProperty)({ example: '2025-08-28T15:00:00.000Z' }),
175
- (0, mongoose_1.Prop)({ required: true }),
176
- __metadata("design:type", Date)
177
- ], Note.prototype, "createdAt", void 0);
178
- Note = __decorate([
179
- (0, mongoose_1.Schema)({ _id: false })
180
- ], Note);
181
162
  let Invoice = class Invoice {
182
163
  };
183
164
  __decorate([
@@ -238,8 +219,8 @@ __decorate([
238
219
  __metadata("design:type", Canceled)
239
220
  ], Invoice.prototype, "canceled", void 0);
240
221
  __decorate([
241
- (0, swagger_1.ApiProperty)({ type: [Note], example: [{ text: 'Emitir NF', owner: 'maria.joaquina', createdAt: '2025-08-28T15:00:00.000Z' }] }),
242
- (0, mongoose_1.Prop)({ type: [Note], default: [] }),
222
+ (0, swagger_1.ApiProperty)({ type: [note_schema_1.Note], example: [{ text: 'Emitir NF', owner: 'maria.joaquina', createdAt: '2025-08-28T15:00:00.000Z' }] }),
223
+ (0, mongoose_1.Prop)({ type: [note_schema_1.Note], default: [] }),
243
224
  __metadata("design:type", Array)
244
225
  ], Invoice.prototype, "notes", void 0);
245
226
  __decorate([
@@ -0,0 +1,54 @@
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 { Types } from 'mongoose';
27
+ export declare class NoteMention {
28
+ userId: Types.ObjectId;
29
+ username: string;
30
+ }
31
+ export declare const NoteMentionSchema: import("mongoose").Schema<NoteMention, import("mongoose").Model<NoteMention, any, any, any, import("mongoose").Document<unknown, any, NoteMention, any, {}> & NoteMention & {
32
+ _id: Types.ObjectId;
33
+ } & {
34
+ __v: number;
35
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, NoteMention, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<NoteMention>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<NoteMention> & {
36
+ _id: Types.ObjectId;
37
+ } & {
38
+ __v: number;
39
+ }>;
40
+ export declare class Note {
41
+ text: string;
42
+ owner: string;
43
+ createdAt: Date;
44
+ mentioneds?: NoteMention[];
45
+ }
46
+ export declare const NoteSchema: import("mongoose").Schema<Note, import("mongoose").Model<Note, any, any, any, import("mongoose").Document<unknown, any, Note, any, {}> & Note & {
47
+ _id: Types.ObjectId;
48
+ } & {
49
+ __v: number;
50
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Note, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Note>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Note> & {
51
+ _id: Types.ObjectId;
52
+ } & {
53
+ __v: number;
54
+ }>;
@@ -0,0 +1,59 @@
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.NoteSchema = exports.Note = exports.NoteMentionSchema = exports.NoteMention = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const mongoose_2 = require("mongoose");
16
+ let NoteMention = class NoteMention {
17
+ };
18
+ __decorate([
19
+ (0, swagger_1.ApiProperty)({ example: '65f1a2b3c4d5e6f7a8b9c0d2' }),
20
+ (0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, required: true }),
21
+ __metadata("design:type", mongoose_2.Types.ObjectId)
22
+ ], NoteMention.prototype, "userId", void 0);
23
+ __decorate([
24
+ (0, swagger_1.ApiProperty)({ example: 'jose.junior' }),
25
+ (0, mongoose_1.Prop)({ required: true, trim: true }),
26
+ __metadata("design:type", String)
27
+ ], NoteMention.prototype, "username", void 0);
28
+ NoteMention = __decorate([
29
+ (0, mongoose_1.Schema)({ _id: false })
30
+ ], NoteMention);
31
+ exports.NoteMention = NoteMention;
32
+ exports.NoteMentionSchema = mongoose_1.SchemaFactory.createForClass(NoteMention);
33
+ let Note = class Note {
34
+ };
35
+ __decorate([
36
+ (0, swagger_1.ApiProperty)({ example: 'Emitir NF até dia 10' }),
37
+ (0, mongoose_1.Prop)({ required: true }),
38
+ __metadata("design:type", String)
39
+ ], Note.prototype, "text", void 0);
40
+ __decorate([
41
+ (0, swagger_1.ApiProperty)({ example: 'João Silva' }),
42
+ (0, mongoose_1.Prop)({ required: true }),
43
+ __metadata("design:type", String)
44
+ ], Note.prototype, "owner", void 0);
45
+ __decorate([
46
+ (0, swagger_1.ApiProperty)({ example: '2025-08-28T15:00:00.000Z' }),
47
+ (0, mongoose_1.Prop)({ required: true }),
48
+ __metadata("design:type", Date)
49
+ ], Note.prototype, "createdAt", void 0);
50
+ __decorate([
51
+ (0, swagger_1.ApiProperty)({ type: [NoteMention], required: false }),
52
+ (0, mongoose_1.Prop)({ type: [exports.NoteMentionSchema], default: [] }),
53
+ __metadata("design:type", Array)
54
+ ], Note.prototype, "mentioneds", void 0);
55
+ Note = __decorate([
56
+ (0, mongoose_1.Schema)({ _id: false })
57
+ ], Note);
58
+ exports.Note = Note;
59
+ exports.NoteSchema = mongoose_1.SchemaFactory.createForClass(Note);
@@ -29,6 +29,7 @@ import { Supplier } from './supplier.schema';
29
29
  import { Action } from './action.schema';
30
30
  import { Recruitment } from './recruitment.schema';
31
31
  import { Sale } from './sale.schema';
32
+ import { Note } from './note.schema';
32
33
  export type PaymentDocument = HydratedDocument<Payment>;
33
34
  declare class Requester {
34
35
  name: string;
@@ -143,11 +144,6 @@ export declare const CanceledSchema: MongooseSchema<Canceled, import("mongoose")
143
144
  } & {
144
145
  __v: number;
145
146
  }>;
146
- declare class Note {
147
- text: string;
148
- owner: string;
149
- createdAt: Date;
150
- }
151
147
  export declare class Attachment {
152
148
  name: string;
153
149
  url: string;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PaymentModel = exports.PaymentSchema = exports.Payment = exports.AttachmentSchema = exports.Attachment = exports.CanceledSchema = exports.Canceled = exports.PaidSchema = exports.Paid = exports.QueuedSchema = exports.Queued = exports.ReceivedSchema = exports.Received = exports.RequestedSchema = exports.Requested = exports.PendingSchema = exports.Pending = exports.ReviewSchema = exports.Review = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
+ const note_schema_1 = require("./note.schema");
15
16
  let Requester = class Requester {
16
17
  };
17
18
  __decorate([
@@ -242,23 +243,6 @@ Canceled = __decorate([
242
243
  ], Canceled);
243
244
  exports.Canceled = Canceled;
244
245
  exports.CanceledSchema = mongoose_1.SchemaFactory.createForClass(Canceled);
245
- let Note = class Note {
246
- };
247
- __decorate([
248
- (0, mongoose_1.Prop)(),
249
- __metadata("design:type", String)
250
- ], Note.prototype, "text", void 0);
251
- __decorate([
252
- (0, mongoose_1.Prop)(),
253
- __metadata("design:type", String)
254
- ], Note.prototype, "owner", void 0);
255
- __decorate([
256
- (0, mongoose_1.Prop)(),
257
- __metadata("design:type", Date)
258
- ], Note.prototype, "createdAt", void 0);
259
- Note = __decorate([
260
- (0, mongoose_1.Schema)({ _id: false })
261
- ], Note);
262
246
  let Attachment = class Attachment {
263
247
  };
264
248
  __decorate([
@@ -332,7 +316,7 @@ __decorate([
332
316
  __metadata("design:type", Canceled)
333
317
  ], Payment.prototype, "canceled", void 0);
334
318
  __decorate([
335
- (0, mongoose_1.Prop)({ type: [Note], required: false, default: [] }),
319
+ (0, mongoose_1.Prop)({ type: [note_schema_1.Note], required: false, default: [] }),
336
320
  __metadata("design:type", Array)
337
321
  ], Payment.prototype, "notes", void 0);
338
322
  __decorate([
@@ -27,6 +27,7 @@ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Profile } from './profile.schema';
28
28
  import { Client } from './client.schema';
29
29
  import { Influencer } from './influencer.schema';
30
+ import { Note } from './note.schema';
30
31
  export type SaleDocument = HydratedDocument<Sale>;
31
32
  export declare class Proposal {
32
33
  businessUnit: 'service' | 'comercial';
@@ -82,11 +83,6 @@ export declare class Lost {
82
83
  reason: 'declined' | 'other' | 'spam' | 'no_response' | 'no_budget' | 'no_profile_fit' | 'invite_exchange';
83
84
  details?: string;
84
85
  }
85
- declare class Note {
86
- text: string;
87
- owner: string;
88
- createdAt: Date;
89
- }
90
86
  export declare class Activity {
91
87
  type: 'email' | 'whatsapp' | 'meeting' | 'call' | 'linkedin' | 'instagram_dm';
92
88
  description?: string;
@@ -165,4 +161,3 @@ export declare const SaleModel: import("mongoose").Model<Sale, {}, {}, {}, impor
165
161
  }> & {
166
162
  __v: number;
167
163
  }>>;
168
- export {};
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SaleModel = exports.SaleSchema = exports.Sale = exports.Inbox = exports.CommissionInfo = exports.CommissionParticipant = exports.TimelineEntry = exports.Activity = exports.Lost = exports.Formalization = exports.Negotiation = exports.Proposal = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
+ const note_schema_1 = require("./note.schema");
15
16
  let Proposal = class Proposal {
16
17
  };
17
18
  __decorate([
@@ -224,23 +225,6 @@ Lost = __decorate([
224
225
  (0, mongoose_1.Schema)({ _id: false })
225
226
  ], Lost);
226
227
  exports.Lost = Lost;
227
- let Note = class Note {
228
- };
229
- __decorate([
230
- (0, mongoose_1.Prop)({ required: true }),
231
- __metadata("design:type", String)
232
- ], Note.prototype, "text", void 0);
233
- __decorate([
234
- (0, mongoose_1.Prop)({ required: true }),
235
- __metadata("design:type", String)
236
- ], Note.prototype, "owner", void 0);
237
- __decorate([
238
- (0, mongoose_1.Prop)({ required: true }),
239
- __metadata("design:type", Date)
240
- ], Note.prototype, "createdAt", void 0);
241
- Note = __decorate([
242
- (0, mongoose_1.Schema)({ _id: false })
243
- ], Note);
244
228
  let Activity = class Activity {
245
229
  };
246
230
  __decorate([
@@ -432,7 +416,7 @@ __decorate([
432
416
  __metadata("design:type", Lost)
433
417
  ], Sale.prototype, "lost", void 0);
434
418
  __decorate([
435
- (0, mongoose_1.Prop)([{ type: Note, required: false }]),
419
+ (0, mongoose_1.Prop)([{ type: note_schema_1.Note, required: false }]),
436
420
  __metadata("design:type", Array)
437
421
  ], Sale.prototype, "notes", void 0);
438
422
  __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.175",
3
+ "version": "1.0.176",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -22,3 +22,8 @@ export * from './schemas/organization.schema';
22
22
  export * from './schemas/user.schema';
23
23
  export * from './schemas/group.schema';
24
24
  export * from './schemas/trigger.schema';
25
+ // Exportação explícita: `influencer.schema.ts` já exporta seu próprio `Note`/`NoteSchema`
26
+ // (domínio de anotações do Influencer, sem `mentioneds`, não tocado por esta mudança). A
27
+ // exportação nomeada abaixo tem precedência sobre a ambiguidade do `export *` e faz o `Note`
28
+ // deste arquivo (usado por Sale/Invoice/Payment/Action) ser o resolvido na raiz do pacote.
29
+ export { Note, NoteSchema, NoteMention, NoteMentionSchema } from './schemas/note.schema';
@@ -13,6 +13,7 @@ import { Content } from './content.schema';
13
13
  import { Client } from './client.schema';
14
14
  import { Sale } from './sale.schema';
15
15
  import { Campaign } from './campaign.schema';
16
+ import { Note, NoteSchema } from './note.schema';
16
17
 
17
18
  export type ActionDocument = HydratedDocument<Action>;
18
19
 
@@ -46,15 +47,6 @@ export class Responsibles {
46
47
 
47
48
  export const ResponsiblesSchema = SchemaFactory.createForClass(Responsibles);
48
49
 
49
- @Schema({ _id: false })
50
- class Note {
51
- @Prop({ required: true }) text: string;
52
- @Prop({ required: true }) owner: string;
53
- @Prop({ required: true }) createdAt: Date;
54
- }
55
-
56
- const NoteSchema = SchemaFactory.createForClass(Note);
57
-
58
50
  export const ACTION_BUSINESS_UNIT_VALUES = [
59
51
  'service',
60
52
  'comercial',
@@ -8,6 +8,7 @@ import {
8
8
  model as MongooseModel
9
9
  } from 'mongoose';
10
10
  import { Sale } from './sale.schema';
11
+ import { Note } from './note.schema';
11
12
 
12
13
  export type InvoiceDocument = HydratedDocument<Invoice>;
13
14
 
@@ -98,18 +99,6 @@ class Canceled {
98
99
  @Prop({ required: true }) details: string;
99
100
  }
100
101
 
101
- @Schema({ _id: false })
102
- class Note {
103
- @ApiProperty({ example: 'Emitir NF até dia 10' })
104
- @Prop({ required: true }) text: string;
105
-
106
- @ApiProperty({ example: 'João Silva' })
107
- @Prop({ required: true }) owner: string;
108
-
109
- @ApiProperty({ example: '2025-08-28T15:00:00.000Z' })
110
- @Prop({ required: true }) createdAt: Date;
111
- }
112
-
113
102
  @Schema({ timestamps: true })
114
103
  export class Invoice {
115
104
  @ApiProperty({ example: '64f1a5c8c7e4d5a6b2e9f123' })
@@ -0,0 +1,34 @@
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+ import { Types } from 'mongoose';
4
+
5
+ @Schema({ _id: false })
6
+ export class NoteMention {
7
+ @ApiProperty({ example: '65f1a2b3c4d5e6f7a8b9c0d2' })
8
+ @Prop({ type: Types.ObjectId, required: true })
9
+ userId: Types.ObjectId;
10
+
11
+ @ApiProperty({ example: 'jose.junior' })
12
+ @Prop({ required: true, trim: true })
13
+ username: string;
14
+ }
15
+
16
+ export const NoteMentionSchema = SchemaFactory.createForClass(NoteMention);
17
+
18
+ @Schema({ _id: false })
19
+ export class Note {
20
+ @ApiProperty({ example: 'Emitir NF até dia 10' })
21
+ @Prop({ required: true }) text: string;
22
+
23
+ @ApiProperty({ example: 'João Silva' })
24
+ @Prop({ required: true }) owner: string;
25
+
26
+ @ApiProperty({ example: '2025-08-28T15:00:00.000Z' })
27
+ @Prop({ required: true }) createdAt: Date;
28
+
29
+ @ApiProperty({ type: [NoteMention], required: false })
30
+ @Prop({ type: [NoteMentionSchema], default: [] })
31
+ mentioneds?: NoteMention[];
32
+ }
33
+
34
+ export const NoteSchema = SchemaFactory.createForClass(Note);
@@ -12,6 +12,7 @@ import { Supplier } from './supplier.schema';
12
12
  import { Action } from './action.schema';
13
13
  import { Recruitment } from './recruitment.schema';
14
14
  import { Sale } from './sale.schema';
15
+ import { Note } from './note.schema';
15
16
 
16
17
  export type PaymentDocument = HydratedDocument<Payment>;
17
18
 
@@ -189,15 +190,6 @@ export class Canceled {
189
190
  }
190
191
  export const CanceledSchema = SchemaFactory.createForClass(Canceled);
191
192
 
192
- @Schema({ _id: false })
193
- class Note {
194
- @Prop() text: string;
195
-
196
- @Prop() owner: string;
197
-
198
- @Prop() createdAt: Date;
199
- }
200
-
201
193
  @Schema({ _id: false })
202
194
  export class Attachment {
203
195
  @Prop() name: string;
@@ -8,6 +8,7 @@ import {
8
8
  import { Profile } from './profile.schema';
9
9
  import { Client } from './client.schema';
10
10
  import { Influencer } from './influencer.schema';
11
+ import { Note } from './note.schema';
11
12
 
12
13
  export type SaleDocument = HydratedDocument<Sale>;
13
14
 
@@ -121,13 +122,6 @@ export class Lost {
121
122
  @Prop() details?: string;
122
123
  }
123
124
 
124
- @Schema({ _id: false })
125
- class Note {
126
- @Prop({ required: true }) text: string;
127
- @Prop({ required: true }) owner: string;
128
- @Prop({ required: true }) createdAt: Date;
129
- }
130
-
131
125
  @Schema({ _id: false })
132
126
  export class Activity {
133
127
  @Prop({ required: true }) type: 'email' | 'whatsapp' | 'meeting' | 'call' | 'linkedin' | 'instagram_dm';