@grapadigital/shared-schemas 1.0.51 → 1.0.53

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
@@ -10,3 +10,5 @@ export * from './schemas/recruitment.schema';
10
10
  export * from './schemas/token.schema';
11
11
  export * from './schemas/webhook.schema';
12
12
  export * from './schemas/sale.schema';
13
+ export * from './schemas/invoice.schema';
14
+ export * from './schemas/log.schema';
package/dist/index.js CHANGED
@@ -26,3 +26,5 @@ __exportStar(require("./schemas/recruitment.schema"), exports);
26
26
  __exportStar(require("./schemas/token.schema"), exports);
27
27
  __exportStar(require("./schemas/webhook.schema"), exports);
28
28
  __exportStar(require("./schemas/sale.schema"), exports);
29
+ __exportStar(require("./schemas/invoice.schema"), exports);
30
+ __exportStar(require("./schemas/log.schema"), exports);
@@ -0,0 +1,78 @@
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/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
+ export type InvoiceDocument = HydratedDocument<Invoice>;
28
+ declare class Inbox {
29
+ acceptanceDocument: string;
30
+ invoiceDescription: string;
31
+ approvalDocument: string;
32
+ invoiceEmail: string;
33
+ emissionNotes: string;
34
+ }
35
+ declare class Review {
36
+ revisedIssueDate: Date;
37
+ revisedDueDate: Date;
38
+ }
39
+ declare class Awaiting {
40
+ infoType: string;
41
+ awaitingNotes: string;
42
+ }
43
+ declare class InvoiceData {
44
+ invoiceNumber: string;
45
+ invoiceIssueDate: Date;
46
+ invoiceDueDate: Date;
47
+ invoiceFile: string;
48
+ }
49
+ declare class Received {
50
+ receivedDate: Date;
51
+ }
52
+ declare class Canceled {
53
+ cancelReason: string;
54
+ cancelNotes: string;
55
+ }
56
+ export declare class Invoice {
57
+ _id?: Types.ObjectId;
58
+ title: string;
59
+ phase: 'screening' | 'proposal' | 'negotiation' | 'formalization' | 'closed' | 'lost';
60
+ inbox?: Inbox;
61
+ review?: Review;
62
+ awaiting?: Awaiting;
63
+ invoice?: InvoiceData;
64
+ received?: Received;
65
+ canceled?: Canceled;
66
+ createdAt?: Date;
67
+ updatedAt?: Date;
68
+ }
69
+ export declare const InvoiceSchema: MongooseSchema<Invoice, import("mongoose").Model<Invoice, any, any, any, import("mongoose").Document<unknown, any, Invoice> & Invoice & Required<{
70
+ _id: Types.ObjectId;
71
+ }> & {
72
+ __v: number;
73
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Invoice, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Invoice>> & import("mongoose").FlatRecord<Invoice> & Required<{
74
+ _id: Types.ObjectId;
75
+ }> & {
76
+ __v: number;
77
+ }>;
78
+ export {};
@@ -0,0 +1,170 @@
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.InvoiceSchema = exports.Invoice = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ let Inbox = class Inbox {
16
+ };
17
+ __decorate([
18
+ (0, mongoose_1.Prop)({ required: true }),
19
+ __metadata("design:type", String)
20
+ ], Inbox.prototype, "acceptanceDocument", void 0);
21
+ __decorate([
22
+ (0, mongoose_1.Prop)({ required: true }),
23
+ __metadata("design:type", String)
24
+ ], Inbox.prototype, "invoiceDescription", void 0);
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ required: true }),
27
+ __metadata("design:type", String)
28
+ ], Inbox.prototype, "approvalDocument", void 0);
29
+ __decorate([
30
+ (0, mongoose_1.Prop)({ required: true }),
31
+ __metadata("design:type", String)
32
+ ], Inbox.prototype, "invoiceEmail", void 0);
33
+ __decorate([
34
+ (0, mongoose_1.Prop)({ required: true }),
35
+ __metadata("design:type", String)
36
+ ], Inbox.prototype, "emissionNotes", void 0);
37
+ Inbox = __decorate([
38
+ (0, mongoose_1.Schema)({ _id: false })
39
+ ], Inbox);
40
+ let Review = class Review {
41
+ };
42
+ __decorate([
43
+ (0, mongoose_1.Prop)({ required: true }),
44
+ __metadata("design:type", Date)
45
+ ], Review.prototype, "revisedIssueDate", void 0);
46
+ __decorate([
47
+ (0, mongoose_1.Prop)({ required: true }),
48
+ __metadata("design:type", Date)
49
+ ], Review.prototype, "revisedDueDate", void 0);
50
+ Review = __decorate([
51
+ (0, mongoose_1.Schema)({ _id: false })
52
+ ], Review);
53
+ let Awaiting = class Awaiting {
54
+ };
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ required: true }),
57
+ __metadata("design:type", String)
58
+ ], Awaiting.prototype, "infoType", void 0);
59
+ __decorate([
60
+ (0, mongoose_1.Prop)({ required: true }),
61
+ __metadata("design:type", String)
62
+ ], Awaiting.prototype, "awaitingNotes", void 0);
63
+ Awaiting = __decorate([
64
+ (0, mongoose_1.Schema)({ _id: false })
65
+ ], Awaiting);
66
+ let InvoiceData = class InvoiceData {
67
+ };
68
+ __decorate([
69
+ (0, mongoose_1.Prop)({ required: true }),
70
+ __metadata("design:type", String)
71
+ ], InvoiceData.prototype, "invoiceNumber", void 0);
72
+ __decorate([
73
+ (0, mongoose_1.Prop)({ required: true }),
74
+ __metadata("design:type", Date)
75
+ ], InvoiceData.prototype, "invoiceIssueDate", void 0);
76
+ __decorate([
77
+ (0, mongoose_1.Prop)({ required: true }),
78
+ __metadata("design:type", Date)
79
+ ], InvoiceData.prototype, "invoiceDueDate", void 0);
80
+ __decorate([
81
+ (0, mongoose_1.Prop)({ required: true }),
82
+ __metadata("design:type", String)
83
+ ], InvoiceData.prototype, "invoiceFile", void 0);
84
+ InvoiceData = __decorate([
85
+ (0, mongoose_1.Schema)({ _id: false })
86
+ ], InvoiceData);
87
+ let Received = class Received {
88
+ };
89
+ __decorate([
90
+ (0, mongoose_1.Prop)({ required: true }),
91
+ __metadata("design:type", Date)
92
+ ], Received.prototype, "receivedDate", void 0);
93
+ Received = __decorate([
94
+ (0, mongoose_1.Schema)({ _id: false })
95
+ ], Received);
96
+ let Canceled = class Canceled {
97
+ };
98
+ __decorate([
99
+ (0, mongoose_1.Prop)({ required: true }),
100
+ __metadata("design:type", String)
101
+ ], Canceled.prototype, "cancelReason", void 0);
102
+ __decorate([
103
+ (0, mongoose_1.Prop)({ required: true }),
104
+ __metadata("design:type", String)
105
+ ], Canceled.prototype, "cancelNotes", void 0);
106
+ Canceled = __decorate([
107
+ (0, mongoose_1.Schema)({ _id: false })
108
+ ], Canceled);
109
+ let Invoice = class Invoice {
110
+ };
111
+ __decorate([
112
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
113
+ __metadata("design:type", mongoose_2.Types.ObjectId)
114
+ ], Invoice.prototype, "_id", void 0);
115
+ __decorate([
116
+ (0, mongoose_1.Prop)({ required: true }),
117
+ __metadata("design:type", String)
118
+ ], Invoice.prototype, "title", void 0);
119
+ __decorate([
120
+ (0, mongoose_1.Prop)({
121
+ required: true,
122
+ enum: [
123
+ 'inbox',
124
+ 'review',
125
+ 'awaiting',
126
+ 'invoice',
127
+ 'invoiced',
128
+ 'received',
129
+ 'canceled',
130
+ ],
131
+ }),
132
+ __metadata("design:type", String)
133
+ ], Invoice.prototype, "phase", void 0);
134
+ __decorate([
135
+ (0, mongoose_1.Prop)({ type: Inbox }),
136
+ __metadata("design:type", Inbox)
137
+ ], Invoice.prototype, "inbox", void 0);
138
+ __decorate([
139
+ (0, mongoose_1.Prop)({ type: Review }),
140
+ __metadata("design:type", Review)
141
+ ], Invoice.prototype, "review", void 0);
142
+ __decorate([
143
+ (0, mongoose_1.Prop)({ type: Awaiting }),
144
+ __metadata("design:type", Awaiting)
145
+ ], Invoice.prototype, "awaiting", void 0);
146
+ __decorate([
147
+ (0, mongoose_1.Prop)({ type: InvoiceData }),
148
+ __metadata("design:type", InvoiceData)
149
+ ], Invoice.prototype, "invoice", void 0);
150
+ __decorate([
151
+ (0, mongoose_1.Prop)({ type: Received }),
152
+ __metadata("design:type", Received)
153
+ ], Invoice.prototype, "received", void 0);
154
+ __decorate([
155
+ (0, mongoose_1.Prop)({ type: Canceled }),
156
+ __metadata("design:type", Canceled)
157
+ ], Invoice.prototype, "canceled", void 0);
158
+ __decorate([
159
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
160
+ __metadata("design:type", Date)
161
+ ], Invoice.prototype, "createdAt", void 0);
162
+ __decorate([
163
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
164
+ __metadata("design:type", Date)
165
+ ], Invoice.prototype, "updatedAt", void 0);
166
+ Invoice = __decorate([
167
+ (0, mongoose_1.Schema)({ timestamps: true })
168
+ ], Invoice);
169
+ exports.Invoice = Invoice;
170
+ exports.InvoiceSchema = mongoose_1.SchemaFactory.createForClass(Invoice);
@@ -0,0 +1,15 @@
1
+ declare class UpdatedBy {
2
+ team: string;
3
+ name: string;
4
+ email: string;
5
+ }
6
+ export declare class Log {
7
+ referenceId: string;
8
+ changes: Record<string, {
9
+ before: any;
10
+ after: any;
11
+ }>;
12
+ updatedAt: Date;
13
+ updatedBy?: UpdatedBy;
14
+ }
15
+ export {};
@@ -0,0 +1,56 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Log = void 0;
16
+ const mongoose_1 = require("@nestjs/mongoose");
17
+ const mongoose_2 = __importDefault(require("mongoose"));
18
+ let UpdatedBy = class UpdatedBy {
19
+ };
20
+ __decorate([
21
+ (0, mongoose_1.Prop)({ required: true }),
22
+ __metadata("design:type", String)
23
+ ], UpdatedBy.prototype, "team", void 0);
24
+ __decorate([
25
+ (0, mongoose_1.Prop)({ required: true }),
26
+ __metadata("design:type", String)
27
+ ], UpdatedBy.prototype, "name", void 0);
28
+ __decorate([
29
+ (0, mongoose_1.Prop)({ required: true }),
30
+ __metadata("design:type", String)
31
+ ], UpdatedBy.prototype, "email", void 0);
32
+ UpdatedBy = __decorate([
33
+ (0, mongoose_1.Schema)({ _id: false })
34
+ ], UpdatedBy);
35
+ let Log = class Log {
36
+ };
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ type: mongoose_2.default.Schema.Types.ObjectId }),
39
+ __metadata("design:type", String)
40
+ ], Log.prototype, "referenceId", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)({ type: Object }),
43
+ __metadata("design:type", Object)
44
+ ], Log.prototype, "changes", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)(),
47
+ __metadata("design:type", Date)
48
+ ], Log.prototype, "updatedAt", void 0);
49
+ __decorate([
50
+ (0, mongoose_1.Prop)({ type: UpdatedBy }),
51
+ __metadata("design:type", UpdatedBy)
52
+ ], Log.prototype, "updatedBy", void 0);
53
+ Log = __decorate([
54
+ (0, mongoose_1.Schema)()
55
+ ], Log);
56
+ exports.Log = Log;
@@ -26,6 +26,9 @@
26
26
  import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Profile } from './profile.schema';
28
28
  import { Client } from './client.schema';
29
+ import { Action } from './action.schema';
30
+ import { Payment } from './payment.schema';
31
+ import { Invoice } from './invoice.schema';
29
32
  export type SaleDocument = HydratedDocument<Sale>;
30
33
  export declare class Screening {
31
34
  emailTitle: string;
@@ -99,6 +102,9 @@ export declare class Sale {
99
102
  formalization?: Formalization;
100
103
  lost?: Lost;
101
104
  profile?: Types.ObjectId | Profile;
105
+ invoices?: Types.ObjectId | Invoice;
106
+ actions?: Types.ObjectId | Action;
107
+ payments?: Types.ObjectId | Payment;
102
108
  createdAt?: Date;
103
109
  updatedAt?: Date;
104
110
  }
@@ -54,6 +54,7 @@ __decorate([
54
54
  ], Proposal.prototype, "initialScope", void 0);
55
55
  __decorate([
56
56
  (0, mongoose_1.Prop)({
57
+ _id: false,
57
58
  required: true,
58
59
  type: {
59
60
  team: String,
@@ -250,7 +251,17 @@ __decorate([
250
251
  __metadata("design:type", String)
251
252
  ], Sale.prototype, "title", void 0);
252
253
  __decorate([
253
- (0, mongoose_1.Prop)({ required: true }),
254
+ (0, mongoose_1.Prop)({
255
+ required: true,
256
+ enum: [
257
+ 'screening',
258
+ 'proposal',
259
+ 'negotiation',
260
+ 'formalization',
261
+ 'closed',
262
+ 'lost'
263
+ ],
264
+ }),
254
265
  __metadata("design:type", String)
255
266
  ], Sale.prototype, "phase", void 0);
256
267
  __decorate([
@@ -277,6 +288,18 @@ __decorate([
277
288
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: false }),
278
289
  __metadata("design:type", Object)
279
290
  ], Sale.prototype, "profile", void 0);
291
+ __decorate([
292
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Invoice', required: false }),
293
+ __metadata("design:type", Object)
294
+ ], Sale.prototype, "invoices", void 0);
295
+ __decorate([
296
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: false }),
297
+ __metadata("design:type", Object)
298
+ ], Sale.prototype, "actions", void 0);
299
+ __decorate([
300
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Payment', required: false }),
301
+ __metadata("design:type", Object)
302
+ ], Sale.prototype, "payments", void 0);
280
303
  __decorate([
281
304
  (0, mongoose_1.Prop)({ default: Date.now, required: false }),
282
305
  __metadata("design:type", Date)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -10,3 +10,5 @@ export * from './schemas/recruitment.schema';
10
10
  export * from './schemas/token.schema';
11
11
  export * from './schemas/webhook.schema';
12
12
  export * from './schemas/sale.schema';
13
+ export * from './schemas/invoice.schema';
14
+ export * from './schemas/log.schema';
@@ -0,0 +1,96 @@
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
3
+
4
+ export type InvoiceDocument = HydratedDocument<Invoice>;
5
+
6
+ @Schema({ _id: false })
7
+ class Inbox {
8
+ @Prop({ required: true }) acceptanceDocument: string;
9
+
10
+ @Prop({ required: true }) invoiceDescription: string;
11
+
12
+ @Prop({ required: true }) approvalDocument: string;
13
+
14
+ @Prop({ required: true }) invoiceEmail: string;
15
+
16
+ @Prop({ required: true }) emissionNotes: string;
17
+ }
18
+
19
+ @Schema({ _id: false })
20
+ class Review {
21
+ @Prop({ required: true }) revisedIssueDate: Date;
22
+
23
+ @Prop({ required: true }) revisedDueDate: Date;
24
+ }
25
+
26
+ @Schema({ _id: false })
27
+ class Awaiting {
28
+ @Prop({ required: true }) infoType: string;
29
+
30
+ @Prop({ required: true }) awaitingNotes: string;
31
+ }
32
+
33
+ @Schema({ _id: false })
34
+ class InvoiceData {
35
+ @Prop({ required: true }) invoiceNumber: string;
36
+
37
+ @Prop({ required: true }) invoiceIssueDate: Date;
38
+
39
+ @Prop({ required: true }) invoiceDueDate: Date;
40
+
41
+ @Prop({ required: true }) invoiceFile: string;
42
+ }
43
+
44
+ @Schema({ _id: false })
45
+ class Received {
46
+ @Prop({ required: true }) receivedDate: Date;
47
+ }
48
+
49
+ @Schema({ _id: false })
50
+ class Canceled {
51
+ @Prop({ required: true }) cancelReason: string;
52
+
53
+ @Prop({ required: true }) cancelNotes: string;
54
+ }
55
+
56
+ @Schema({ timestamps: true })
57
+ export class Invoice {
58
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
59
+ _id?: Types.ObjectId;
60
+
61
+ @Prop({ required: true }) title: string;
62
+
63
+ @Prop({
64
+ required: true,
65
+ enum: [
66
+ 'inbox',
67
+ 'review',
68
+ 'awaiting',
69
+ 'invoice',
70
+ 'invoiced',
71
+ 'received',
72
+ 'canceled',
73
+ ],
74
+ })
75
+ phase: 'screening' | 'proposal' | 'negotiation' | 'formalization' | 'closed' | 'lost';
76
+
77
+ @Prop({ type: Inbox }) inbox?: Inbox;
78
+
79
+ @Prop({ type: Review }) review?: Review;
80
+
81
+ @Prop({ type: Awaiting }) awaiting?: Awaiting;
82
+
83
+ @Prop({ type: InvoiceData }) invoice?: InvoiceData;
84
+
85
+ @Prop({ type: Received }) received?: Received;
86
+
87
+ @Prop({ type: Canceled }) canceled?: Canceled;
88
+
89
+ @Prop({ default: Date.now, required: false })
90
+ createdAt?: Date;
91
+
92
+ @Prop({ default: Date.now, required: false })
93
+ updatedAt?: Date;
94
+ }
95
+
96
+ export const InvoiceSchema = SchemaFactory.createForClass(Invoice);
@@ -0,0 +1,24 @@
1
+ import { Prop, Schema } from "@nestjs/mongoose";
2
+ import mongoose from "mongoose";
3
+
4
+ @Schema({ _id: false })
5
+ class UpdatedBy {
6
+ @Prop({ required: true }) team: string;
7
+ @Prop({ required: true }) name: string;
8
+ @Prop({ required: true }) email: string;
9
+ }
10
+
11
+ @Schema()
12
+ export class Log {
13
+ @Prop({ type: mongoose.Schema.Types.ObjectId })
14
+ referenceId: string;
15
+
16
+ @Prop({ type: Object })
17
+ changes: Record<string, { before: any; after: any }>;
18
+
19
+ @Prop()
20
+ updatedAt: Date;
21
+
22
+ @Prop({ type: UpdatedBy })
23
+ updatedBy?: UpdatedBy;
24
+ }
@@ -2,6 +2,9 @@ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
2
  import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
3
3
  import { Profile } from './profile.schema';
4
4
  import { Client } from './client.schema';
5
+ import { Action } from './action.schema';
6
+ import { Payment } from './payment.schema';
7
+ import { Invoice } from './invoice.schema';
5
8
 
6
9
  export type SaleDocument = HydratedDocument<Sale>;
7
10
 
@@ -20,6 +23,7 @@ export class Proposal {
20
23
  @Prop({ required: true }) contact: string;
21
24
  @Prop({ required: true }) initialScope: string;
22
25
  @Prop({
26
+ _id: false,
23
27
  required: true,
24
28
  type: {
25
29
  team: String,
@@ -100,7 +104,17 @@ export class Sale {
100
104
 
101
105
  @Prop({ required: true }) title: string;
102
106
 
103
- @Prop({ required: true })
107
+ @Prop({
108
+ required: true,
109
+ enum: [
110
+ 'screening',
111
+ 'proposal',
112
+ 'negotiation',
113
+ 'formalization',
114
+ 'closed',
115
+ 'lost'
116
+ ],
117
+ })
104
118
  phase: 'screening' | 'proposal' | 'negotiation' | 'formalization' | 'closed' | 'lost';
105
119
 
106
120
  @Prop({ type: Screening }) screening?: Screening;
@@ -112,6 +126,15 @@ export class Sale {
112
126
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: false })
113
127
  profile?: Types.ObjectId | Profile;
114
128
 
129
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Invoice', required: false })
130
+ invoices?: Types.ObjectId | Invoice;
131
+
132
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: false })
133
+ actions?: Types.ObjectId | Action;
134
+
135
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Payment', required: false })
136
+ payments?: Types.ObjectId | Payment;
137
+
115
138
  @Prop({ default: Date.now, required: false })
116
139
  createdAt?: Date;
117
140