@grapadigital/shared-schemas 1.0.57 → 1.0.59

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.
@@ -24,6 +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 { Sale } from './sale.schema';
27
28
  export type InvoiceDocument = HydratedDocument<Invoice>;
28
29
  declare class Inbox {
29
30
  acceptanceDocument: string;
@@ -56,7 +57,8 @@ declare class Canceled {
56
57
  export declare class Invoice {
57
58
  _id?: Types.ObjectId;
58
59
  title: string;
59
- phase: 'screening' | 'proposal' | 'negotiation' | 'formalization' | 'closed' | 'lost';
60
+ phase: 'inbox' | 'review' | 'awaiting' | 'invoiced' | 'received' | 'canceled';
61
+ sale: Types.ObjectId | Sale;
60
62
  inbox?: Inbox;
61
63
  review?: Review;
62
64
  awaiting?: Awaiting;
@@ -123,7 +123,6 @@ __decorate([
123
123
  'inbox',
124
124
  'review',
125
125
  'awaiting',
126
- 'invoice',
127
126
  'invoiced',
128
127
  'received',
129
128
  'canceled',
@@ -131,6 +130,10 @@ __decorate([
131
130
  }),
132
131
  __metadata("design:type", String)
133
132
  ], Invoice.prototype, "phase", void 0);
133
+ __decorate([
134
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Sale', required: true }),
135
+ __metadata("design:type", Object)
136
+ ], Invoice.prototype, "sale", void 0);
134
137
  __decorate([
135
138
  (0, mongoose_1.Prop)({ type: Inbox }),
136
139
  __metadata("design:type", Inbox)
@@ -85,7 +85,7 @@ export declare class Formalization {
85
85
  handlingInvoices: string;
86
86
  finalScope: string;
87
87
  client: Types.ObjectId | Client;
88
- brand: Types.ObjectId | Client;
88
+ brand?: Types.ObjectId | Client;
89
89
  installment: FormalizationInstallment[];
90
90
  }
91
91
  export declare class Lost {
@@ -101,10 +101,10 @@ export declare class Sale {
101
101
  negotiation?: Negotiation;
102
102
  formalization?: Formalization;
103
103
  lost?: Lost;
104
- profile?: Types.ObjectId | Profile;
105
- invoices?: Types.ObjectId | Invoice;
106
- actions?: Types.ObjectId | Action;
107
- payments?: Types.ObjectId | Payment;
104
+ profiles?: Types.ObjectId[] | Profile[];
105
+ invoices?: Types.ObjectId[] | Invoice[];
106
+ actions?: Types.ObjectId[] | Action[];
107
+ payments?: Types.ObjectId[] | Payment[];
108
108
  createdAt?: Date;
109
109
  updatedAt?: Date;
110
110
  }
@@ -215,7 +215,7 @@ __decorate([
215
215
  __metadata("design:type", Object)
216
216
  ], Formalization.prototype, "client", void 0);
217
217
  __decorate([
218
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Client' }),
218
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Client', required: false }),
219
219
  __metadata("design:type", Object)
220
220
  ], Formalization.prototype, "brand", void 0);
221
221
  __decorate([
@@ -285,20 +285,44 @@ __decorate([
285
285
  __metadata("design:type", Lost)
286
286
  ], Sale.prototype, "lost", void 0);
287
287
  __decorate([
288
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: false }),
289
- __metadata("design:type", Object)
290
- ], Sale.prototype, "profile", void 0);
288
+ (0, mongoose_1.Prop)([
289
+ {
290
+ type: mongoose_2.Schema.Types.ObjectId,
291
+ ref: 'Profile',
292
+ required: false,
293
+ },
294
+ ]),
295
+ __metadata("design:type", Array)
296
+ ], Sale.prototype, "profiles", void 0);
291
297
  __decorate([
292
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Invoice', required: false }),
293
- __metadata("design:type", Object)
298
+ (0, mongoose_1.Prop)([
299
+ {
300
+ type: mongoose_2.Schema.Types.ObjectId,
301
+ ref: 'Invoice',
302
+ required: false,
303
+ },
304
+ ]),
305
+ __metadata("design:type", Array)
294
306
  ], Sale.prototype, "invoices", void 0);
295
307
  __decorate([
296
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: false }),
297
- __metadata("design:type", Object)
308
+ (0, mongoose_1.Prop)([
309
+ {
310
+ type: mongoose_2.Schema.Types.ObjectId,
311
+ ref: 'Action',
312
+ required: false,
313
+ },
314
+ ]),
315
+ __metadata("design:type", Array)
298
316
  ], Sale.prototype, "actions", void 0);
299
317
  __decorate([
300
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Payment', required: false }),
301
- __metadata("design:type", Object)
318
+ (0, mongoose_1.Prop)([
319
+ {
320
+ type: mongoose_2.Schema.Types.ObjectId,
321
+ ref: 'Payment',
322
+ required: false,
323
+ },
324
+ ]),
325
+ __metadata("design:type", Array)
302
326
  ], Sale.prototype, "payments", void 0);
303
327
  __decorate([
304
328
  (0, mongoose_1.Prop)({ default: Date.now, required: false }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,6 @@
1
1
  import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
2
  import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
3
+ import { Sale } from './sale.schema';
3
4
 
4
5
  export type InvoiceDocument = HydratedDocument<Invoice>;
5
6
 
@@ -66,13 +67,15 @@ export class Invoice {
66
67
  'inbox',
67
68
  'review',
68
69
  'awaiting',
69
- 'invoice',
70
70
  'invoiced',
71
71
  'received',
72
72
  'canceled',
73
73
  ],
74
74
  })
75
- phase: 'screening' | 'proposal' | 'negotiation' | 'formalization' | 'closed' | 'lost';
75
+ phase: 'inbox' | 'review' | 'awaiting' | 'invoiced' | 'received' | 'canceled';
76
+
77
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Sale', required: true })
78
+ sale: Types.ObjectId | Sale;
76
79
 
77
80
  @Prop({ type: Inbox }) inbox?: Inbox;
78
81
 
@@ -84,8 +84,8 @@ export class Formalization {
84
84
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Client' })
85
85
  client: Types.ObjectId | Client;
86
86
 
87
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Client' })
88
- brand: Types.ObjectId | Client;
87
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Client', required: false })
88
+ brand?: Types.ObjectId | Client;
89
89
 
90
90
  @Prop({ type: [FormalizationInstallment], required: true })
91
91
  installment: FormalizationInstallment[];
@@ -123,17 +123,41 @@ export class Sale {
123
123
  @Prop({ type: Formalization }) formalization?: Formalization;
124
124
  @Prop({ type: Lost }) lost?: Lost;
125
125
 
126
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: false })
127
- profile?: Types.ObjectId | Profile;
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;
126
+ @Prop([
127
+ {
128
+ type: MongooseSchema.Types.ObjectId,
129
+ ref: 'Profile',
130
+ required: false,
131
+ },
132
+ ])
133
+ profiles?: Types.ObjectId[] | Profile[];
134
+
135
+ @Prop([
136
+ {
137
+ type: MongooseSchema.Types.ObjectId,
138
+ ref: 'Invoice',
139
+ required: false,
140
+ },
141
+ ])
142
+ invoices?: Types.ObjectId[] | Invoice[];
143
+
144
+ @Prop([
145
+ {
146
+ type: MongooseSchema.Types.ObjectId,
147
+ ref: 'Action',
148
+ required: false,
149
+ },
150
+ ])
151
+ actions?: Types.ObjectId[] | Action[];
152
+
153
+ @Prop([
154
+ {
155
+ type: MongooseSchema.Types.ObjectId,
156
+ ref: 'Payment',
157
+ required: false,
158
+ },
159
+ ])
160
+ payments?: Types.ObjectId[] | Payment[];
137
161
 
138
162
  @Prop({ default: Date.now, required: false })
139
163
  createdAt?: Date;