@grapadigital/shared-schemas 1.0.66 → 1.0.67

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