@grapadigital/shared-schemas 1.0.123 → 1.0.125

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
@@ -14,3 +14,4 @@ export * from './schemas/invoice.schema';
14
14
  export * from './schemas/log.schema';
15
15
  export * from './schemas/project.schema';
16
16
  export * from './schemas/commission.schema';
17
+ export * from './schemas/contract.schema';
package/dist/index.js CHANGED
@@ -30,3 +30,4 @@ __exportStar(require("./schemas/invoice.schema"), exports);
30
30
  __exportStar(require("./schemas/log.schema"), exports);
31
31
  __exportStar(require("./schemas/project.schema"), exports);
32
32
  __exportStar(require("./schemas/commission.schema"), exports);
33
+ __exportStar(require("./schemas/contract.schema"), exports);
@@ -26,26 +26,12 @@
26
26
  import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Sale } from './sale.schema';
28
28
  export type CommissionDocument = HydratedDocument<Commission>;
29
- export declare class CommissionRecipient {
30
- name: string;
31
- email: string;
32
- team: string;
33
- }
34
- export declare const CommissionRecipientSchema: MongooseSchema<CommissionRecipient, import("mongoose").Model<CommissionRecipient, any, any, any, import("mongoose").Document<unknown, any, CommissionRecipient, any, {}> & CommissionRecipient & {
35
- _id: Types.ObjectId;
36
- } & {
37
- __v: number;
38
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CommissionRecipient, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<CommissionRecipient>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<CommissionRecipient> & {
39
- _id: Types.ObjectId;
40
- } & {
41
- __v: number;
42
- }>;
43
29
  export declare class Commission {
44
30
  _id?: Types.ObjectId;
45
- recipient: CommissionRecipient;
31
+ email: string;
32
+ role: 'origination' | 'commercial' | 'planning' | 'curation';
46
33
  value: number;
47
34
  percentage: number;
48
- role: 'origination' | 'commercial' | 'planning' | 'curation';
49
35
  status: 'pending' | 'approved' | 'ready' | 'paid' | 'cancelled' | 'disputed';
50
36
  type: 'collaborator' | 'agency';
51
37
  sale: Types.ObjectId | Sale;
@@ -9,29 +9,9 @@ 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.CommissionModel = exports.CommissionSchema = exports.Commission = exports.CommissionRecipientSchema = exports.CommissionRecipient = void 0;
12
+ exports.CommissionModel = exports.CommissionSchema = exports.Commission = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
- const swagger_1 = require("@nestjs/swagger");
15
14
  const mongoose_2 = require("mongoose");
16
- let CommissionRecipient = class CommissionRecipient {
17
- };
18
- __decorate([
19
- (0, mongoose_1.Prop)({ type: String, required: true }),
20
- __metadata("design:type", String)
21
- ], CommissionRecipient.prototype, "name", void 0);
22
- __decorate([
23
- (0, mongoose_1.Prop)({ type: String, required: true }),
24
- __metadata("design:type", String)
25
- ], CommissionRecipient.prototype, "email", void 0);
26
- __decorate([
27
- (0, mongoose_1.Prop)({ type: String, required: true }),
28
- __metadata("design:type", String)
29
- ], CommissionRecipient.prototype, "team", void 0);
30
- CommissionRecipient = __decorate([
31
- (0, mongoose_1.Schema)({ _id: false })
32
- ], CommissionRecipient);
33
- exports.CommissionRecipient = CommissionRecipient;
34
- exports.CommissionRecipientSchema = mongoose_1.SchemaFactory.createForClass(CommissionRecipient);
35
15
  let Commission = class Commission {
36
16
  };
37
17
  __decorate([
@@ -39,17 +19,9 @@ __decorate([
39
19
  __metadata("design:type", mongoose_2.Types.ObjectId)
40
20
  ], Commission.prototype, "_id", void 0);
41
21
  __decorate([
42
- (0, mongoose_1.Prop)({ type: exports.CommissionRecipientSchema, required: true }),
43
- __metadata("design:type", CommissionRecipient)
44
- ], Commission.prototype, "recipient", void 0);
45
- __decorate([
46
- (0, mongoose_1.Prop)({ type: Number, required: true }),
47
- __metadata("design:type", Number)
48
- ], Commission.prototype, "value", void 0);
49
- __decorate([
50
- (0, mongoose_1.Prop)({ type: Number, required: true, min: 0, max: 100 }),
51
- __metadata("design:type", Number)
52
- ], Commission.prototype, "percentage", void 0);
22
+ (0, mongoose_1.Prop)({ type: String, required: true }),
23
+ __metadata("design:type", String)
24
+ ], Commission.prototype, "email", void 0);
53
25
  __decorate([
54
26
  (0, mongoose_1.Prop)({
55
27
  type: String,
@@ -59,6 +31,14 @@ __decorate([
59
31
  }),
60
32
  __metadata("design:type", String)
61
33
  ], Commission.prototype, "role", void 0);
34
+ __decorate([
35
+ (0, mongoose_1.Prop)({ type: Number, required: true }),
36
+ __metadata("design:type", Number)
37
+ ], Commission.prototype, "value", void 0);
38
+ __decorate([
39
+ (0, mongoose_1.Prop)({ type: Number, required: true, min: 0, max: 100 }),
40
+ __metadata("design:type", Number)
41
+ ], Commission.prototype, "percentage", void 0);
62
42
  __decorate([
63
43
  (0, mongoose_1.Prop)({
64
44
  type: String,
@@ -69,10 +49,6 @@ __decorate([
69
49
  __metadata("design:type", String)
70
50
  ], Commission.prototype, "status", void 0);
71
51
  __decorate([
72
- (0, swagger_1.ApiProperty)({
73
- enum: ['sale', 'recruitment', 'content', 'bonus'],
74
- example: 'sale'
75
- }),
76
52
  (0, mongoose_1.Prop)({
77
53
  type: String,
78
54
  enum: ['collaborator', 'agency'],
@@ -0,0 +1,63 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
+ import { Recruitment } from './recruitment.schema';
28
+ export type ContractDocument = HydratedDocument<Contract>;
29
+ export declare class Contract {
30
+ _id?: Types.ObjectId;
31
+ variables: MongooseSchema.Types.Mixed;
32
+ status: 'none' | 'signed';
33
+ ip: string;
34
+ userAgent: string;
35
+ signedAt: Date;
36
+ contractText: string;
37
+ contractHash: string;
38
+ recruitment: Types.ObjectId | Recruitment;
39
+ createdAt?: Date;
40
+ updatedAt?: Date;
41
+ }
42
+ export declare const ContractSchema: MongooseSchema<Contract, import("mongoose").Model<Contract, any, any, any, import("mongoose").Document<unknown, any, Contract, any, {}> & Contract & Required<{
43
+ _id: Types.ObjectId;
44
+ }> & {
45
+ __v: number;
46
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Contract, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Contract>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Contract> & Required<{
47
+ _id: Types.ObjectId;
48
+ }> & {
49
+ __v: number;
50
+ }>;
51
+ export declare const ContractModel: import("mongoose").Model<Contract, {}, {}, {}, import("mongoose").Document<unknown, {}, Contract, {}, import("mongoose").DefaultSchemaOptions> & Contract & Required<{
52
+ _id: Types.ObjectId;
53
+ }> & {
54
+ __v: number;
55
+ }, MongooseSchema<Contract, import("mongoose").Model<Contract, any, any, any, import("mongoose").Document<unknown, any, Contract, any, {}> & Contract & Required<{
56
+ _id: Types.ObjectId;
57
+ }> & {
58
+ __v: number;
59
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Contract, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Contract>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Contract> & Required<{
60
+ _id: Types.ObjectId;
61
+ }> & {
62
+ __v: number;
63
+ }>>;
@@ -0,0 +1,66 @@
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.ContractModel = exports.ContractSchema = exports.Contract = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ let Contract = class Contract {
16
+ };
17
+ __decorate([
18
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
19
+ __metadata("design:type", mongoose_2.Types.ObjectId)
20
+ ], Contract.prototype, "_id", void 0);
21
+ __decorate([
22
+ (0, mongoose_1.Prop)(),
23
+ __metadata("design:type", mongoose_2.Schema.Types.Mixed)
24
+ ], Contract.prototype, "variables", void 0);
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: String, default: 'none', enum: ['none', 'signed'] }),
27
+ __metadata("design:type", String)
28
+ ], Contract.prototype, "status", void 0);
29
+ __decorate([
30
+ (0, mongoose_1.Prop)(),
31
+ __metadata("design:type", String)
32
+ ], Contract.prototype, "ip", void 0);
33
+ __decorate([
34
+ (0, mongoose_1.Prop)(),
35
+ __metadata("design:type", String)
36
+ ], Contract.prototype, "userAgent", void 0);
37
+ __decorate([
38
+ (0, mongoose_1.Prop)(),
39
+ __metadata("design:type", Date)
40
+ ], Contract.prototype, "signedAt", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)(),
43
+ __metadata("design:type", String)
44
+ ], Contract.prototype, "contractText", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)(),
47
+ __metadata("design:type", String)
48
+ ], Contract.prototype, "contractHash", void 0);
49
+ __decorate([
50
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Recruitment' }),
51
+ __metadata("design:type", Object)
52
+ ], Contract.prototype, "recruitment", void 0);
53
+ __decorate([
54
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
55
+ __metadata("design:type", Date)
56
+ ], Contract.prototype, "createdAt", void 0);
57
+ __decorate([
58
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
59
+ __metadata("design:type", Date)
60
+ ], Contract.prototype, "updatedAt", void 0);
61
+ Contract = __decorate([
62
+ (0, mongoose_1.Schema)({ timestamps: true })
63
+ ], Contract);
64
+ exports.Contract = Contract;
65
+ exports.ContractSchema = mongoose_1.SchemaFactory.createForClass(Contract);
66
+ exports.ContractModel = (0, mongoose_2.model)('Contract', exports.ContractSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.123",
3
+ "version": "1.0.125",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -14,3 +14,4 @@ export * from './schemas/invoice.schema';
14
14
  export * from './schemas/log.schema';
15
15
  export * from './schemas/project.schema';
16
16
  export * from './schemas/commission.schema';
17
+ export * from './schemas/contract.schema';
@@ -1,5 +1,4 @@
1
1
  import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { ApiProperty } from '@nestjs/swagger';
3
2
 
4
3
  import {
5
4
  HydratedDocument,
@@ -12,33 +11,13 @@ import { Sale } from './sale.schema';
12
11
 
13
12
  export type CommissionDocument = HydratedDocument<Commission>;
14
13
 
15
- @Schema({ _id: false })
16
- export class CommissionRecipient {
17
- @Prop({ type: String, required: true })
18
- name: string;
19
-
20
- @Prop({ type: String, required: true })
21
- email: string;
22
-
23
- @Prop({ type: String, required: true })
24
- team: string;
25
- }
26
-
27
- export const CommissionRecipientSchema = SchemaFactory.createForClass(CommissionRecipient);
28
-
29
14
  @Schema({ timestamps: true })
30
15
  export class Commission {
31
16
  @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
32
17
  _id?: Types.ObjectId;
33
18
 
34
- @Prop({ type: CommissionRecipientSchema, required: true })
35
- recipient: CommissionRecipient;
36
-
37
- @Prop({ type: Number, required: true })
38
- value: number;
39
-
40
- @Prop({ type: Number, required: true, min: 0, max: 100 })
41
- percentage: number;
19
+ @Prop({ type: String, required: true })
20
+ email: string;
42
21
 
43
22
  @Prop({
44
23
  type: String,
@@ -48,6 +27,12 @@ export class Commission {
48
27
  })
49
28
  role: 'origination' | 'commercial' | 'planning' | 'curation';
50
29
 
30
+ @Prop({ type: Number, required: true })
31
+ value: number;
32
+
33
+ @Prop({ type: Number, required: true, min: 0, max: 100 })
34
+ percentage: number;
35
+
51
36
  @Prop({
52
37
  type: String,
53
38
  enum: ['pending', 'approved', 'ready', 'paid', 'cancelled', 'disputed'],
@@ -56,10 +41,6 @@ export class Commission {
56
41
  })
57
42
  status: 'pending' | 'approved' | 'ready' | 'paid' | 'cancelled' | 'disputed';
58
43
 
59
- @ApiProperty({
60
- enum: ['sale', 'recruitment', 'content', 'bonus'],
61
- example: 'sale'
62
- })
63
44
  @Prop({
64
45
  type: String,
65
46
  enum: ['collaborator', 'agency'],
@@ -0,0 +1,44 @@
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
3
+ import { Recruitment } from './recruitment.schema';
4
+
5
+ export type ContractDocument = HydratedDocument<Contract>;
6
+
7
+ @Schema({ timestamps: true })
8
+ export class Contract {
9
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
10
+ _id?: Types.ObjectId;
11
+
12
+ @Prop()
13
+ variables: MongooseSchema.Types.Mixed;
14
+
15
+ @Prop({ type: String, default: 'none', enum: ['none', 'signed'] })
16
+ status: 'none' | 'signed';
17
+
18
+ @Prop()
19
+ ip: string;
20
+
21
+ @Prop()
22
+ userAgent: string;
23
+
24
+ @Prop()
25
+ signedAt: Date;
26
+
27
+ @Prop()
28
+ contractText: string;
29
+
30
+ @Prop()
31
+ contractHash: string;
32
+
33
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment' })
34
+ recruitment: Types.ObjectId | Recruitment;
35
+
36
+ @Prop({ default: Date.now, required: false })
37
+ createdAt?: Date;
38
+
39
+ @Prop({ default: Date.now, required: false })
40
+ updatedAt?: Date;
41
+ }
42
+
43
+ export const ContractSchema = SchemaFactory.createForClass(Contract);
44
+ export const ContractModel = MongooseModel('Contract', ContractSchema);