@grapadigital/shared-schemas 1.0.75 → 1.0.77

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
@@ -5,7 +5,6 @@ export * from './schemas/influencer.schema';
5
5
  export * from './schemas/supplier.schema';
6
6
  export * from './schemas/campaign.schema';
7
7
  export * from './schemas/payment.schema';
8
- export * from './schemas/payment_new.schema';
9
8
  export * from './schemas/profile.schema';
10
9
  export * from './schemas/recruitment.schema';
11
10
  export * from './schemas/token.schema';
package/dist/index.js CHANGED
@@ -21,7 +21,6 @@ __exportStar(require("./schemas/influencer.schema"), exports);
21
21
  __exportStar(require("./schemas/supplier.schema"), exports);
22
22
  __exportStar(require("./schemas/campaign.schema"), exports);
23
23
  __exportStar(require("./schemas/payment.schema"), exports);
24
- __exportStar(require("./schemas/payment_new.schema"), exports);
25
24
  __exportStar(require("./schemas/profile.schema"), exports);
26
25
  __exportStar(require("./schemas/recruitment.schema"), exports);
27
26
  __exportStar(require("./schemas/token.schema"), exports);
@@ -27,9 +27,7 @@ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Sale } from './sale.schema';
28
28
  export type InvoiceDocument = HydratedDocument<Invoice>;
29
29
  declare class Inbox {
30
- acceptanceDocument: string;
31
30
  invoiceDescription: string;
32
- approvalDocument: string;
33
31
  invoiceEmail: string;
34
32
  emissionNotes: string;
35
33
  estimatedInvoiceIssueDate: Date;
@@ -14,18 +14,10 @@ const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
15
  let Inbox = class Inbox {
16
16
  };
17
- __decorate([
18
- (0, mongoose_1.Prop)({ required: true }),
19
- __metadata("design:type", String)
20
- ], Inbox.prototype, "acceptanceDocument", void 0);
21
17
  __decorate([
22
18
  (0, mongoose_1.Prop)({ required: true }),
23
19
  __metadata("design:type", String)
24
20
  ], 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
21
  __decorate([
30
22
  (0, mongoose_1.Prop)({ required: true }),
31
23
  __metadata("design:type", String)
@@ -25,70 +25,141 @@
25
25
  /// <reference types="mongoose/types/inferrawdoctype" />
26
26
  import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Influencer } from './influencer.schema';
28
+ import { Supplier } from './supplier.schema';
28
29
  import { Action } from './action.schema';
29
30
  import { Recruitment } from './recruitment.schema';
31
+ import { Sale } from './sale.schema';
30
32
  export type PaymentDocument = HydratedDocument<Payment>;
31
- export declare class Requester {
33
+ declare class Requester {
32
34
  name: string;
33
35
  email: string;
34
36
  team: string;
35
37
  }
36
- export declare const RequesterSchema: MongooseSchema<Requester, import("mongoose").Model<Requester, any, any, any, import("mongoose").Document<unknown, any, Requester> & Requester & {
38
+ export declare class Review {
39
+ emissionNotes: string;
40
+ revisedDueDate: Date;
41
+ revisedIssueDate: Date;
42
+ }
43
+ export declare const ReviewSchema: MongooseSchema<Review, import("mongoose").Model<Review, any, any, any, import("mongoose").Document<unknown, any, Review> & Review & {
37
44
  _id: Types.ObjectId;
38
45
  } & {
39
46
  __v: number;
40
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Requester, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Requester>> & import("mongoose").FlatRecord<Requester> & {
47
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Review, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Review>> & import("mongoose").FlatRecord<Review> & {
41
48
  _id: Types.ObjectId;
42
49
  } & {
43
50
  __v: number;
44
51
  }>;
45
- export declare class PipefyCard {
46
- id: string;
47
- title: string;
52
+ export declare class Pending {
53
+ requester: Requester;
54
+ type: 'influencer' | 'advisor' | 'supplier' | 'employee' | 'refund';
55
+ influencer?: Types.ObjectId | Influencer;
56
+ supplier?: Types.ObjectId | Supplier;
57
+ recruitment?: Types.ObjectId | Recruitment;
58
+ value: number;
59
+ description: string;
60
+ installmentNumber: number;
61
+ sale: Types.ObjectId | Sale;
62
+ action: Types.ObjectId | Action;
48
63
  }
49
- export declare const PipefyCardSchema: MongooseSchema<PipefyCard, import("mongoose").Model<PipefyCard, any, any, any, import("mongoose").Document<unknown, any, PipefyCard> & PipefyCard & {
64
+ export declare const PendingSchema: MongooseSchema<Pending, import("mongoose").Model<Pending, any, any, any, import("mongoose").Document<unknown, any, Pending> & Pending & {
50
65
  _id: Types.ObjectId;
51
66
  } & {
52
67
  __v: number;
53
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, PipefyCard, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<PipefyCard>> & import("mongoose").FlatRecord<PipefyCard> & {
68
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Pending, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Pending>> & import("mongoose").FlatRecord<Pending> & {
54
69
  _id: Types.ObjectId;
55
70
  } & {
56
71
  __v: number;
57
72
  }>;
58
- export declare class PendingChanges {
73
+ export declare class Approval {
74
+ name: string;
75
+ approvedAt: Date;
76
+ }
77
+ export declare const ApprovalSchema: MongooseSchema<Approval, import("mongoose").Model<Approval, any, any, any, import("mongoose").Document<unknown, any, Approval> & Approval & {
78
+ _id: Types.ObjectId;
79
+ } & {
80
+ __v: number;
81
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Approval, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Approval>> & import("mongoose").FlatRecord<Approval> & {
82
+ _id: Types.ObjectId;
83
+ } & {
84
+ __v: number;
85
+ }>;
86
+ export declare class Requested {
87
+ date: Date;
88
+ }
89
+ export declare const RequestedSchema: MongooseSchema<Requested, import("mongoose").Model<Requested, any, any, any, import("mongoose").Document<unknown, any, Requested> & Requested & {
90
+ _id: Types.ObjectId;
91
+ } & {
92
+ __v: number;
93
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Requested, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Requested>> & import("mongoose").FlatRecord<Requested> & {
94
+ _id: Types.ObjectId;
95
+ } & {
96
+ __v: number;
97
+ }>;
98
+ export declare class Queued {
99
+ issueDate: Date;
59
100
  dueDate: Date;
60
- status: 'pending' | 'approved' | 'denied';
101
+ code: string;
102
+ }
103
+ export declare const QueuedSchema: MongooseSchema<Queued, import("mongoose").Model<Queued, any, any, any, import("mongoose").Document<unknown, any, Queued> & Queued & {
104
+ _id: Types.ObjectId;
105
+ } & {
106
+ __v: number;
107
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Queued, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Queued>> & import("mongoose").FlatRecord<Queued> & {
108
+ _id: Types.ObjectId;
109
+ } & {
110
+ __v: number;
111
+ }>;
112
+ export declare class Paid {
113
+ date: Date;
114
+ }
115
+ export declare const PaidSchema: MongooseSchema<Paid, import("mongoose").Model<Paid, any, any, any, import("mongoose").Document<unknown, any, Paid> & Paid & {
116
+ _id: Types.ObjectId;
117
+ } & {
118
+ __v: number;
119
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Paid, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Paid>> & import("mongoose").FlatRecord<Paid> & {
120
+ _id: Types.ObjectId;
121
+ } & {
122
+ __v: number;
123
+ }>;
124
+ export declare class Canceled {
61
125
  reason: string;
126
+ notes: string;
62
127
  }
63
- export declare const PendingChangesSchema: MongooseSchema<PendingChanges, import("mongoose").Model<PendingChanges, any, any, any, import("mongoose").Document<unknown, any, PendingChanges> & PendingChanges & {
128
+ export declare const CanceledSchema: MongooseSchema<Canceled, import("mongoose").Model<Canceled, any, any, any, import("mongoose").Document<unknown, any, Canceled> & Canceled & {
64
129
  _id: Types.ObjectId;
65
130
  } & {
66
131
  __v: number;
67
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, PendingChanges, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<PendingChanges>> & import("mongoose").FlatRecord<PendingChanges> & {
132
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Canceled, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Canceled>> & import("mongoose").FlatRecord<Canceled> & {
133
+ _id: Types.ObjectId;
134
+ } & {
135
+ __v: number;
136
+ }>;
137
+ export declare class Note {
138
+ text: string;
139
+ owner: string;
140
+ createdAt: Date;
141
+ }
142
+ export declare const NoteSchema: MongooseSchema<Note, import("mongoose").Model<Note, any, any, any, import("mongoose").Document<unknown, any, Note> & Note & {
143
+ _id: Types.ObjectId;
144
+ } & {
145
+ __v: number;
146
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Note, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Note>> & import("mongoose").FlatRecord<Note> & {
68
147
  _id: Types.ObjectId;
69
148
  } & {
70
149
  __v: number;
71
150
  }>;
72
151
  export declare class Payment {
73
152
  _id?: Types.ObjectId;
74
- requester?: Requester;
75
- value: number;
76
- installmentNumber: number;
77
- dueDate?: Date | null;
78
- invoiceIssueDate?: Date | null;
79
- invoiceDueDate?: Date | null;
80
- paymentDate?: Date | null;
81
- financialCard?: PipefyCard;
82
- pendingChanges?: PendingChanges;
83
- additionalComments?: string;
84
- googleSheetRow?: string;
85
- status: 'pending' | 'review' | 'processing' | 'failed' | 'completed';
86
- type: 'influencer' | 'advisor' | 'provider';
87
- influencer: Types.ObjectId | Influencer;
88
- action: Types.ObjectId | Action;
89
- recruitment: Types.ObjectId | Recruitment;
90
- createdAt?: Date;
91
- updatedAt?: Date;
153
+ title: string;
154
+ phase: 'pending' | 'review' | 'approval' | 'awaiting' | 'requested' | 'queued' | 'paid' | 'client' | 'canceled';
155
+ pending?: Pending;
156
+ review?: Review;
157
+ approval?: Approval;
158
+ requested?: Requested;
159
+ queued?: Queued;
160
+ paid?: Paid;
161
+ canceled?: Canceled;
162
+ notes?: Note[];
92
163
  }
93
164
  export declare const PaymentSchema: MongooseSchema<Payment, import("mongoose").Model<Payment, any, any, any, import("mongoose").Document<unknown, any, Payment> & Payment & Required<{
94
165
  _id: Types.ObjectId;
@@ -112,3 +183,4 @@ export declare const PaymentModel: import("mongoose").Model<Payment, {}, {}, {},
112
183
  }> & {
113
184
  __v: number;
114
185
  }>>;
186
+ export {};
@@ -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.PaymentModel = exports.PaymentSchema = exports.Payment = exports.PendingChangesSchema = exports.PendingChanges = exports.PipefyCardSchema = exports.PipefyCard = exports.RequesterSchema = exports.Requester = void 0;
12
+ exports.PaymentModel = exports.PaymentSchema = exports.Payment = exports.NoteSchema = exports.Note = exports.CanceledSchema = exports.Canceled = exports.PaidSchema = exports.Paid = exports.QueuedSchema = exports.Queued = exports.RequestedSchema = exports.Requested = exports.ApprovalSchema = exports.Approval = 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
15
  let Requester = class Requester {
@@ -29,123 +29,212 @@ __decorate([
29
29
  Requester = __decorate([
30
30
  (0, mongoose_1.Schema)({ _id: false })
31
31
  ], Requester);
32
- exports.Requester = Requester;
33
- exports.RequesterSchema = mongoose_1.SchemaFactory.createForClass(Requester);
34
- let PipefyCard = class PipefyCard {
32
+ const RequesterSchema = mongoose_1.SchemaFactory.createForClass(Requester);
33
+ let Review = class Review {
35
34
  };
36
35
  __decorate([
37
36
  (0, mongoose_1.Prop)(),
38
37
  __metadata("design:type", String)
39
- ], PipefyCard.prototype, "id", void 0);
38
+ ], Review.prototype, "emissionNotes", void 0);
40
39
  __decorate([
41
40
  (0, mongoose_1.Prop)(),
42
- __metadata("design:type", String)
43
- ], PipefyCard.prototype, "title", void 0);
44
- PipefyCard = __decorate([
45
- (0, mongoose_1.Schema)({ _id: false })
46
- ], PipefyCard);
47
- exports.PipefyCard = PipefyCard;
48
- exports.PipefyCardSchema = mongoose_1.SchemaFactory.createForClass(PipefyCard);
49
- let PendingChanges = class PendingChanges {
50
- };
41
+ __metadata("design:type", Date)
42
+ ], Review.prototype, "revisedDueDate", void 0);
51
43
  __decorate([
52
44
  (0, mongoose_1.Prop)(),
53
45
  __metadata("design:type", Date)
54
- ], PendingChanges.prototype, "dueDate", void 0);
46
+ ], Review.prototype, "revisedIssueDate", void 0);
47
+ Review = __decorate([
48
+ (0, mongoose_1.Schema)({ _id: false })
49
+ ], Review);
50
+ exports.Review = Review;
51
+ exports.ReviewSchema = mongoose_1.SchemaFactory.createForClass(Review);
52
+ let Pending = class Pending {
53
+ };
55
54
  __decorate([
56
- (0, mongoose_1.Prop)({ type: String, enum: ['pending', 'approved', 'denied'] }),
57
- __metadata("design:type", String)
58
- ], PendingChanges.prototype, "status", void 0);
55
+ (0, mongoose_1.Prop)({ type: RequesterSchema, required: true }),
56
+ __metadata("design:type", Requester)
57
+ ], Pending.prototype, "requester", void 0);
59
58
  __decorate([
60
- (0, mongoose_1.Prop)(),
59
+ (0, mongoose_1.Prop)({ type: String, enum: ['influencer', 'advisor', 'supplier', 'employee', 'refund'] }),
61
60
  __metadata("design:type", String)
62
- ], PendingChanges.prototype, "reason", void 0);
63
- PendingChanges = __decorate([
64
- (0, mongoose_1.Schema)({ _id: false })
65
- ], PendingChanges);
66
- exports.PendingChanges = PendingChanges;
67
- exports.PendingChangesSchema = mongoose_1.SchemaFactory.createForClass(PendingChanges);
68
- let Payment = class Payment {
69
- };
61
+ ], Pending.prototype, "type", void 0);
70
62
  __decorate([
71
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
72
- __metadata("design:type", mongoose_2.Types.ObjectId)
73
- ], Payment.prototype, "_id", void 0);
63
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Influencer' }),
64
+ __metadata("design:type", Object)
65
+ ], Pending.prototype, "influencer", void 0);
74
66
  __decorate([
75
- (0, mongoose_1.Prop)({ type: exports.RequesterSchema, required: false }),
76
- __metadata("design:type", Requester)
77
- ], Payment.prototype, "requester", void 0);
67
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Supplier' }),
68
+ __metadata("design:type", Object)
69
+ ], Pending.prototype, "supplier", void 0);
70
+ __decorate([
71
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Recruitment' }),
72
+ __metadata("design:type", Object)
73
+ ], Pending.prototype, "recruitment", void 0);
78
74
  __decorate([
79
75
  (0, mongoose_1.Prop)(),
80
76
  __metadata("design:type", Number)
81
- ], Payment.prototype, "value", void 0);
77
+ ], Pending.prototype, "value", void 0);
78
+ __decorate([
79
+ (0, mongoose_1.Prop)(),
80
+ __metadata("design:type", String)
81
+ ], Pending.prototype, "description", void 0);
82
82
  __decorate([
83
83
  (0, mongoose_1.Prop)(),
84
84
  __metadata("design:type", Number)
85
- ], Payment.prototype, "installmentNumber", void 0);
85
+ ], Pending.prototype, "installmentNumber", void 0);
86
86
  __decorate([
87
- (0, mongoose_1.Prop)({ type: Date, default: null, required: false }),
87
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Sale' }),
88
88
  __metadata("design:type", Object)
89
- ], Payment.prototype, "dueDate", void 0);
89
+ ], Pending.prototype, "sale", void 0);
90
90
  __decorate([
91
- (0, mongoose_1.Prop)({ type: Date, default: null, required: false }),
91
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action' }),
92
92
  __metadata("design:type", Object)
93
- ], Payment.prototype, "invoiceIssueDate", void 0);
93
+ ], Pending.prototype, "action", void 0);
94
+ Pending = __decorate([
95
+ (0, mongoose_1.Schema)({ _id: false })
96
+ ], Pending);
97
+ exports.Pending = Pending;
98
+ exports.PendingSchema = mongoose_1.SchemaFactory.createForClass(Pending);
99
+ let Approval = class Approval {
100
+ };
94
101
  __decorate([
95
- (0, mongoose_1.Prop)({ type: Date, default: null, required: false }),
96
- __metadata("design:type", Object)
97
- ], Payment.prototype, "invoiceDueDate", void 0);
102
+ (0, mongoose_1.Prop)(),
103
+ __metadata("design:type", String)
104
+ ], Approval.prototype, "name", void 0);
98
105
  __decorate([
99
- (0, mongoose_1.Prop)({ type: Date, default: null, required: false }),
100
- __metadata("design:type", Object)
101
- ], Payment.prototype, "paymentDate", void 0);
106
+ (0, mongoose_1.Prop)(),
107
+ __metadata("design:type", Date)
108
+ ], Approval.prototype, "approvedAt", void 0);
109
+ Approval = __decorate([
110
+ (0, mongoose_1.Schema)({ _id: false })
111
+ ], Approval);
112
+ exports.Approval = Approval;
113
+ exports.ApprovalSchema = mongoose_1.SchemaFactory.createForClass(Approval);
114
+ let Requested = class Requested {
115
+ };
102
116
  __decorate([
103
- (0, mongoose_1.Prop)({ type: exports.PipefyCardSchema, required: false }),
104
- __metadata("design:type", PipefyCard)
105
- ], Payment.prototype, "financialCard", void 0);
117
+ (0, mongoose_1.Prop)(),
118
+ __metadata("design:type", Date)
119
+ ], Requested.prototype, "date", void 0);
120
+ Requested = __decorate([
121
+ (0, mongoose_1.Schema)({ _id: false })
122
+ ], Requested);
123
+ exports.Requested = Requested;
124
+ exports.RequestedSchema = mongoose_1.SchemaFactory.createForClass(Requested);
125
+ let Queued = class Queued {
126
+ };
106
127
  __decorate([
107
- (0, mongoose_1.Prop)({ type: exports.PendingChangesSchema, required: false }),
108
- __metadata("design:type", PendingChanges)
109
- ], Payment.prototype, "pendingChanges", void 0);
128
+ (0, mongoose_1.Prop)(),
129
+ __metadata("design:type", Date)
130
+ ], Queued.prototype, "issueDate", void 0);
131
+ __decorate([
132
+ (0, mongoose_1.Prop)(),
133
+ __metadata("design:type", Date)
134
+ ], Queued.prototype, "dueDate", void 0);
110
135
  __decorate([
111
- (0, mongoose_1.Prop)({ required: false }),
136
+ (0, mongoose_1.Prop)(),
137
+ __metadata("design:type", String)
138
+ ], Queued.prototype, "code", void 0);
139
+ Queued = __decorate([
140
+ (0, mongoose_1.Schema)({ _id: false })
141
+ ], Queued);
142
+ exports.Queued = Queued;
143
+ exports.QueuedSchema = mongoose_1.SchemaFactory.createForClass(Queued);
144
+ let Paid = class Paid {
145
+ };
146
+ __decorate([
147
+ (0, mongoose_1.Prop)(),
148
+ __metadata("design:type", Date)
149
+ ], Paid.prototype, "date", void 0);
150
+ Paid = __decorate([
151
+ (0, mongoose_1.Schema)({ _id: false })
152
+ ], Paid);
153
+ exports.Paid = Paid;
154
+ exports.PaidSchema = mongoose_1.SchemaFactory.createForClass(Paid);
155
+ let Canceled = class Canceled {
156
+ };
157
+ __decorate([
158
+ (0, mongoose_1.Prop)(),
112
159
  __metadata("design:type", String)
113
- ], Payment.prototype, "additionalComments", void 0);
160
+ ], Canceled.prototype, "reason", void 0);
114
161
  __decorate([
115
- (0, mongoose_1.Prop)({ required: false }),
162
+ (0, mongoose_1.Prop)(),
163
+ __metadata("design:type", String)
164
+ ], Canceled.prototype, "notes", void 0);
165
+ Canceled = __decorate([
166
+ (0, mongoose_1.Schema)({ _id: false })
167
+ ], Canceled);
168
+ exports.Canceled = Canceled;
169
+ exports.CanceledSchema = mongoose_1.SchemaFactory.createForClass(Canceled);
170
+ let Note = class Note {
171
+ };
172
+ __decorate([
173
+ (0, mongoose_1.Prop)(),
116
174
  __metadata("design:type", String)
117
- ], Payment.prototype, "googleSheetRow", void 0);
175
+ ], Note.prototype, "text", void 0);
176
+ __decorate([
177
+ (0, mongoose_1.Prop)(),
178
+ __metadata("design:type", String)
179
+ ], Note.prototype, "owner", void 0);
180
+ __decorate([
181
+ (0, mongoose_1.Prop)(),
182
+ __metadata("design:type", Date)
183
+ ], Note.prototype, "createdAt", void 0);
184
+ Note = __decorate([
185
+ (0, mongoose_1.Schema)({ _id: false })
186
+ ], Note);
187
+ exports.Note = Note;
188
+ exports.NoteSchema = mongoose_1.SchemaFactory.createForClass(Note);
189
+ let Payment = class Payment {
190
+ };
191
+ __decorate([
192
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true }),
193
+ __metadata("design:type", mongoose_2.Types.ObjectId)
194
+ ], Payment.prototype, "_id", void 0);
195
+ __decorate([
196
+ (0, mongoose_1.Prop)(),
197
+ __metadata("design:type", String)
198
+ ], Payment.prototype, "title", void 0);
118
199
  __decorate([
119
200
  (0, mongoose_1.Prop)({
120
201
  type: String,
121
- enum: ['pending', 'review', 'processing', 'failed', 'completed'],
202
+ enum: ['pending', 'review', 'approval', 'awaiting', 'requested', 'queued', 'paid', 'client', 'canceled'],
122
203
  }),
123
204
  __metadata("design:type", String)
124
- ], Payment.prototype, "status", void 0);
205
+ ], Payment.prototype, "phase", void 0);
125
206
  __decorate([
126
- (0, mongoose_1.Prop)({ type: String, enum: ['influencer', 'advisor', 'provider'] }),
127
- __metadata("design:type", String)
128
- ], Payment.prototype, "type", void 0);
207
+ (0, mongoose_1.Prop)({ type: exports.PendingSchema, required: false }),
208
+ __metadata("design:type", Pending)
209
+ ], Payment.prototype, "pending", void 0);
129
210
  __decorate([
130
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Influencer' }),
131
- __metadata("design:type", Object)
132
- ], Payment.prototype, "influencer", void 0);
211
+ (0, mongoose_1.Prop)({ type: exports.ReviewSchema, required: false }),
212
+ __metadata("design:type", Review)
213
+ ], Payment.prototype, "review", void 0);
133
214
  __decorate([
134
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action' }),
135
- __metadata("design:type", Object)
136
- ], Payment.prototype, "action", void 0);
215
+ (0, mongoose_1.Prop)({ type: exports.ApprovalSchema, required: false }),
216
+ __metadata("design:type", Approval)
217
+ ], Payment.prototype, "approval", void 0);
137
218
  __decorate([
138
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Recruitment' }),
139
- __metadata("design:type", Object)
140
- ], Payment.prototype, "recruitment", void 0);
219
+ (0, mongoose_1.Prop)({ type: exports.RequestedSchema, required: false }),
220
+ __metadata("design:type", Requested)
221
+ ], Payment.prototype, "requested", void 0);
141
222
  __decorate([
142
- (0, mongoose_1.Prop)({ default: Date.now, required: false }),
143
- __metadata("design:type", Date)
144
- ], Payment.prototype, "createdAt", void 0);
223
+ (0, mongoose_1.Prop)({ type: exports.QueuedSchema, required: false }),
224
+ __metadata("design:type", Queued)
225
+ ], Payment.prototype, "queued", void 0);
145
226
  __decorate([
146
- (0, mongoose_1.Prop)({ default: Date.now, required: false }),
147
- __metadata("design:type", Date)
148
- ], Payment.prototype, "updatedAt", void 0);
227
+ (0, mongoose_1.Prop)({ type: exports.PaidSchema, required: false }),
228
+ __metadata("design:type", Paid)
229
+ ], Payment.prototype, "paid", void 0);
230
+ __decorate([
231
+ (0, mongoose_1.Prop)({ type: exports.CanceledSchema, required: false }),
232
+ __metadata("design:type", Canceled)
233
+ ], Payment.prototype, "canceled", void 0);
234
+ __decorate([
235
+ (0, mongoose_1.Prop)({ type: [exports.NoteSchema], default: [] }),
236
+ __metadata("design:type", Array)
237
+ ], Payment.prototype, "notes", void 0);
149
238
  Payment = __decorate([
150
239
  (0, mongoose_1.Schema)({ timestamps: true })
151
240
  ], Payment);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -5,7 +5,6 @@ export * from './schemas/influencer.schema';
5
5
  export * from './schemas/supplier.schema';
6
6
  export * from './schemas/campaign.schema';
7
7
  export * from './schemas/payment.schema';
8
- export * from './schemas/payment_new.schema';
9
8
  export * from './schemas/profile.schema';
10
9
  export * from './schemas/recruitment.schema';
11
10
  export * from './schemas/token.schema';
@@ -6,12 +6,8 @@ export type InvoiceDocument = HydratedDocument<Invoice>;
6
6
 
7
7
  @Schema({ _id: false })
8
8
  class Inbox {
9
- @Prop({ required: true }) acceptanceDocument: string;
10
-
11
9
  @Prop({ required: true }) invoiceDescription: string;
12
10
 
13
- @Prop({ required: true }) approvalDocument: string;
14
-
15
11
  @Prop({ required: true }) invoiceEmail: string;
16
12
 
17
13
  @Prop({ required: true }) emissionNotes: string;
@@ -1,113 +1,134 @@
1
1
  import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
2
  import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
3
3
  import { Influencer } from './influencer.schema';
4
+ import { Supplier } from './supplier.schema';
4
5
  import { Action } from './action.schema';
5
6
  import { Recruitment } from './recruitment.schema';
7
+ import { Sale } from './sale.schema';
6
8
 
7
9
  export type PaymentDocument = HydratedDocument<Payment>;
8
- @Schema({ _id: false })
9
- export class Requester {
10
- @Prop()
11
- name: string;
12
-
13
- @Prop()
14
- email: string;
15
10
 
16
- @Prop()
17
- team: string;
11
+ @Schema({ _id: false })
12
+ class Requester {
13
+ @Prop() name: string;
14
+ @Prop() email: string;
15
+ @Prop() team: string;
18
16
  }
19
-
20
- export const RequesterSchema = SchemaFactory.createForClass(Requester);
17
+ const RequesterSchema = SchemaFactory.createForClass(Requester);
21
18
 
22
19
  @Schema({ _id: false })
23
- export class PipefyCard {
24
- @Prop()
25
- id: string;
26
-
27
- @Prop()
28
- title: string;
20
+ export class Review {
21
+ @Prop() emissionNotes: string;
22
+ @Prop() revisedDueDate: Date;
23
+ @Prop() revisedIssueDate: Date;
29
24
  }
30
-
31
- export const PipefyCardSchema = SchemaFactory.createForClass(PipefyCard);
25
+ export const ReviewSchema = SchemaFactory.createForClass(Review);
32
26
 
33
27
  @Schema({ _id: false })
34
- export class PendingChanges {
35
- @Prop()
36
- dueDate: Date;
28
+ export class Pending {
29
+ @Prop({ type: RequesterSchema, required: true })
30
+ requester: Requester;
37
31
 
38
- @Prop({ type: String, enum: ['pending', 'approved', 'denied'] })
39
- status: 'pending' | 'approved' | 'denied';
32
+ @Prop({ type: String, enum: ['influencer', 'advisor', 'supplier', 'employee', 'refund'] })
33
+ type: 'influencer' | 'advisor' | 'supplier' | 'employee' | 'refund';
40
34
 
41
- @Prop()
42
- reason: string;
43
- }
35
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Influencer'})
36
+ influencer?: Types.ObjectId | Influencer;
44
37
 
45
- export const PendingChangesSchema =
46
- SchemaFactory.createForClass(PendingChanges);
38
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Supplier'})
39
+ supplier?: Types.ObjectId | Supplier;
47
40
 
48
- @Schema({ timestamps: true })
49
- export class Payment {
50
- @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
51
- _id?: Types.ObjectId;
41
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment' })
42
+ recruitment?: Types.ObjectId | Recruitment;
52
43
 
53
- @Prop({ type: RequesterSchema, required: false })
54
- requester?: Requester;
44
+ @Prop() value: number;
45
+ @Prop() description: string;
55
46
 
56
- @Prop()
57
- value: number;
47
+ @Prop() installmentNumber: number;
58
48
 
59
- @Prop()
60
- installmentNumber: number;
49
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Sale' })
50
+ sale: Types.ObjectId | Sale;
51
+
52
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action' })
53
+ action: Types.ObjectId | Action;
54
+ }
55
+ export const PendingSchema = SchemaFactory.createForClass(Pending);
61
56
 
62
- @Prop({ type: Date, default: null, required: false })
63
- dueDate?: Date | null;
57
+ @Schema({ _id: false })
58
+ export class Approval {
59
+ @Prop() name: string;
60
+ @Prop() approvedAt: Date;
61
+ }
62
+ export const ApprovalSchema = SchemaFactory.createForClass(Approval);
64
63
 
65
- @Prop({ type: Date, default: null, required: false })
66
- invoiceIssueDate?: Date | null;
64
+ @Schema({ _id: false })
65
+ export class Requested { @Prop() date: Date; }
66
+ export const RequestedSchema = SchemaFactory.createForClass(Requested);
67
67
 
68
- @Prop({ type: Date, default: null, required: false })
69
- invoiceDueDate?: Date | null;
68
+ @Schema({ _id: false })
69
+ export class Queued {
70
+ @Prop() issueDate: Date;
71
+ @Prop() dueDate: Date;
72
+ @Prop() code: string;
73
+ }
74
+ export const QueuedSchema = SchemaFactory.createForClass(Queued);
70
75
 
71
- @Prop({ type: Date, default: null, required: false })
72
- paymentDate?: Date | null;
76
+ @Schema({ _id: false })
77
+ export class Paid { @Prop() date: Date; }
78
+ export const PaidSchema = SchemaFactory.createForClass(Paid);
73
79
 
74
- @Prop({ type: PipefyCardSchema, required: false })
75
- financialCard?: PipefyCard;
80
+ @Schema({ _id: false })
81
+ export class Canceled {
82
+ @Prop() reason: string;
83
+ @Prop() notes: string;
84
+ }
85
+ export const CanceledSchema = SchemaFactory.createForClass(Canceled);
76
86
 
77
- @Prop({ type: PendingChangesSchema, required: false })
78
- pendingChanges?: PendingChanges;
87
+ @Schema({ _id: false })
88
+ export class Note {
89
+ @Prop() text: string;
90
+ @Prop() owner: string;
91
+ @Prop() createdAt: Date;
92
+ }
93
+ export const NoteSchema = SchemaFactory.createForClass(Note);
79
94
 
80
- @Prop({ required: false })
81
- additionalComments?: string;
95
+ @Schema({ timestamps: true })
96
+ export class Payment {
97
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true })
98
+ _id?: Types.ObjectId;
82
99
 
83
- @Prop({ required: false })
84
- googleSheetRow?: string;
100
+ @Prop() title: string;
85
101
 
86
102
  @Prop({
87
103
  type: String,
88
- enum: ['pending', 'review', 'processing', 'failed', 'completed'],
104
+ enum: [ 'pending', 'review', 'approval', 'awaiting', 'requested', 'queued', 'paid', 'client', 'canceled'],
89
105
  })
90
- status: 'pending' | 'review' | 'processing' | 'failed' | 'completed';
106
+ phase: 'pending' | 'review' | 'approval' | 'awaiting' | 'requested' | 'queued' | 'paid' | 'client' | 'canceled';
91
107
 
92
- @Prop({ type: String, enum: ['influencer', 'advisor', 'provider'] })
93
- type: 'influencer' | 'advisor' | 'provider';
108
+ @Prop({ type: PendingSchema, required: false })
109
+ pending?: Pending;
94
110
 
95
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Influencer' })
96
- influencer: Types.ObjectId | Influencer;
111
+ @Prop({ type: ReviewSchema, required: false })
112
+ review?: Review;
97
113
 
98
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action' })
99
- action: Types.ObjectId | Action;
114
+ @Prop({ type: ApprovalSchema, required: false })
115
+ approval?: Approval;
100
116
 
101
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment' })
102
- recruitment: Types.ObjectId | Recruitment;
117
+ @Prop({ type: RequestedSchema, required: false })
118
+ requested?: Requested;
119
+
120
+ @Prop({ type: QueuedSchema, required: false })
121
+ queued?: Queued;
103
122
 
104
- @Prop({ default: Date.now, required: false })
105
- createdAt?: Date;
123
+ @Prop({ type: PaidSchema, required: false })
124
+ paid?: Paid;
106
125
 
107
- @Prop({ default: Date.now, required: false })
108
- updatedAt?: Date;
126
+ @Prop({ type: CanceledSchema, required: false })
127
+ canceled?: Canceled;
128
+
129
+ @Prop({ type: [NoteSchema], default: [] })
130
+ notes?: Note[];
109
131
  }
110
132
 
111
133
  export const PaymentSchema = SchemaFactory.createForClass(Payment);
112
134
  export const PaymentModel = MongooseModel('Payment', PaymentSchema);
113
-
@@ -1,134 +0,0 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
3
- import { Influencer } from './influencer.schema';
4
- import { Supplier } from './supplier.schema';
5
- import { Action } from './action.schema';
6
- import { Recruitment } from './recruitment.schema';
7
- import { Sale } from './sale.schema';
8
-
9
- export type PaymentNewDocument = HydratedDocument<PaymentNew>;
10
-
11
- @Schema({ _id: false })
12
- class Requester {
13
- @Prop() name: string;
14
- @Prop() email: string;
15
- @Prop() team: string;
16
- }
17
- const RequesterSchema = SchemaFactory.createForClass(Requester);
18
-
19
- @Schema({ _id: false })
20
- export class Processing {
21
- @Prop() emissionNotes: string;
22
- @Prop() revisedDueDate: Date;
23
- @Prop() revisedIssueDate: Date;
24
- }
25
- export const ProcessingSchema = SchemaFactory.createForClass(Processing);
26
-
27
- @Schema({ _id: false })
28
- export class Pending {
29
- @Prop({ type: RequesterSchema, required: true })
30
- requester: Requester;
31
-
32
- @Prop({ type: String, enum: ['influencer', 'advisor', 'supplier', 'employee', 'refund'] })
33
- type: 'influencer' | 'advisor' | 'supplier' | 'employee' | 'refund';
34
-
35
- @Prop({ type: MongooseSchema.Types.ObjectId })
36
- influencer?: Types.ObjectId | Influencer;
37
-
38
- @Prop({ type: MongooseSchema.Types.ObjectId })
39
- supplier?: Types.ObjectId | Supplier;
40
-
41
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment' })
42
- recruitment?: Types.ObjectId | Recruitment;
43
-
44
- @Prop() value: number;
45
- @Prop() description: string;
46
-
47
- @Prop() installmentNumber: number;
48
-
49
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Sale' })
50
- sale: Types.ObjectId | Sale;
51
-
52
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action' })
53
- action: Types.ObjectId | Action;
54
- }
55
- export const PendingSchema = SchemaFactory.createForClass(Pending);
56
-
57
- @Schema({ _id: false })
58
- export class Approval {
59
- @Prop() name: string;
60
- @Prop() approvedAt: Date;
61
- }
62
- export const ApprovalSchema = SchemaFactory.createForClass(Approval);
63
-
64
- @Schema({ _id: false })
65
- export class Requested { @Prop() date: Date; }
66
- export const RequestedSchema = SchemaFactory.createForClass(Requested);
67
-
68
- @Schema({ _id: false })
69
- export class Queued {
70
- @Prop() issueDate: Date;
71
- @Prop() dueDate: Date;
72
- @Prop() code: string;
73
- }
74
- export const QueuedSchema = SchemaFactory.createForClass(Queued);
75
-
76
- @Schema({ _id: false })
77
- export class Paid { @Prop() date: Date; }
78
- export const PaidSchema = SchemaFactory.createForClass(Paid);
79
-
80
- @Schema({ _id: false })
81
- export class Canceled {
82
- @Prop() reason: string;
83
- @Prop() notes: string;
84
- }
85
- export const CanceledSchema = SchemaFactory.createForClass(Canceled);
86
-
87
- @Schema({ _id: false })
88
- export class Note {
89
- @Prop() text: string;
90
- @Prop() owner: string;
91
- @Prop() createdAt: Date;
92
- }
93
- export const NoteSchema = SchemaFactory.createForClass(Note);
94
-
95
- @Schema({ timestamps: true })
96
- export class PaymentNew {
97
- @Prop({ type: MongooseSchema.Types.ObjectId, auto: true })
98
- _id?: Types.ObjectId;
99
-
100
- @Prop() title: string;
101
-
102
- @Prop({
103
- type: String,
104
- enum: [ 'pending', 'review', 'approval', 'awaiting', 'requested', 'queued', 'paid', 'client', 'canceled'],
105
- })
106
- phase: 'pending' | 'review' | 'approval' | 'awaiting' | 'requested' | 'queued' | 'paid' | 'client' | 'canceled';
107
-
108
- @Prop({ type: PendingSchema, required: false })
109
- pending?: Pending;
110
-
111
- @Prop({ type: ProcessingSchema, required: false })
112
- processing?: Processing;
113
-
114
- @Prop({ type: ApprovalSchema, required: false })
115
- approval?: Approval;
116
-
117
- @Prop({ type: RequestedSchema, required: false })
118
- requested?: Requested;
119
-
120
- @Prop({ type: QueuedSchema, required: false })
121
- queued?: Queued;
122
-
123
- @Prop({ type: PaidSchema, required: false })
124
- paid?: Paid;
125
-
126
- @Prop({ type: CanceledSchema, required: false })
127
- canceled?: Canceled;
128
-
129
- @Prop({ type: [NoteSchema], default: [] })
130
- notes?: Note[];
131
- }
132
-
133
- export const PaymentNewSchema = SchemaFactory.createForClass(PaymentNew);
134
- export const PaymentNewModel = MongooseModel('PaymentNew', PaymentNewSchema);