@grapadigital/shared-schemas 1.0.173 → 1.0.174
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 +3 -0
- package/dist/index.js +3 -0
- package/dist/schemas/client.schema.d.ts +2 -2
- package/dist/schemas/client.schema.js +2 -2
- package/dist/schemas/group.schema.d.ts +43 -0
- package/dist/schemas/group.schema.js +34 -0
- package/dist/schemas/influencer.schema.d.ts +2 -2
- package/dist/schemas/influencer.schema.js +2 -2
- package/dist/schemas/organization.schema.d.ts +45 -0
- package/dist/schemas/organization.schema.js +41 -0
- package/dist/schemas/party.schema.d.ts +116 -0
- package/dist/schemas/party.schema.js +175 -0
- package/dist/schemas/supplier.schema.d.ts +2 -2
- package/dist/schemas/supplier.schema.js +2 -2
- package/dist/schemas/user.schema.d.ts +23 -78
- package/dist/schemas/user.schema.js +38 -143
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/schemas/client.schema.ts +2 -2
- package/src/schemas/group.schema.ts +23 -0
- package/src/schemas/influencer.schema.ts +2 -2
- package/src/schemas/organization.schema.ts +29 -0
- package/src/schemas/party.schema.ts +65 -0
- package/src/schemas/supplier.schema.ts +2 -2
- package/src/schemas/user.schema.ts +31 -107
package/dist/index.d.ts
CHANGED
|
@@ -18,3 +18,6 @@ export * from './schemas/commission.schema';
|
|
|
18
18
|
export * from './schemas/contract.schema';
|
|
19
19
|
export * from './schemas/benchmark.schema';
|
|
20
20
|
export * from './schemas/notifications.schema';
|
|
21
|
+
export * from './schemas/organization.schema';
|
|
22
|
+
export * from './schemas/user.schema';
|
|
23
|
+
export * from './schemas/group.schema';
|
package/dist/index.js
CHANGED
|
@@ -34,3 +34,6 @@ __exportStar(require("./schemas/commission.schema"), exports);
|
|
|
34
34
|
__exportStar(require("./schemas/contract.schema"), exports);
|
|
35
35
|
__exportStar(require("./schemas/benchmark.schema"), exports);
|
|
36
36
|
__exportStar(require("./schemas/notifications.schema"), exports);
|
|
37
|
+
__exportStar(require("./schemas/organization.schema"), exports);
|
|
38
|
+
__exportStar(require("./schemas/user.schema"), exports);
|
|
39
|
+
__exportStar(require("./schemas/group.schema"), exports);
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
import { HydratedDocument } from 'mongoose';
|
|
27
|
-
import {
|
|
27
|
+
import { Party } from './party.schema';
|
|
28
28
|
export type ClientDocument = HydratedDocument<Client>;
|
|
29
29
|
export declare class Cluster {
|
|
30
30
|
key: string;
|
|
@@ -94,7 +94,7 @@ export declare const NicheItemSchema: import("mongoose").Schema<NicheItem, impor
|
|
|
94
94
|
} & {
|
|
95
95
|
__v: number;
|
|
96
96
|
}>;
|
|
97
|
-
export declare class Client extends
|
|
97
|
+
export declare class Client extends Party {
|
|
98
98
|
clusters: Cluster[];
|
|
99
99
|
companies: Company[];
|
|
100
100
|
type: string;
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ClientModel = exports.ClientSchema = exports.Client = exports.NicheItemSchema = exports.NicheItem = exports.AgencyCommissionPeriodSchema = exports.AgencyCommissionPeriod = exports.CommissionRangeSchema = exports.CommissionRange = exports.CompanySchema = exports.Company = exports.ClusterSchema = exports.Cluster = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
|
-
const
|
|
15
|
+
const party_schema_1 = require("./party.schema");
|
|
16
16
|
let Cluster = class Cluster {
|
|
17
17
|
};
|
|
18
18
|
__decorate([
|
|
@@ -100,7 +100,7 @@ NicheItem = __decorate([
|
|
|
100
100
|
], NicheItem);
|
|
101
101
|
exports.NicheItem = NicheItem;
|
|
102
102
|
exports.NicheItemSchema = mongoose_1.SchemaFactory.createForClass(NicheItem);
|
|
103
|
-
let Client = class Client extends
|
|
103
|
+
let Client = class Client extends party_schema_1.Party {
|
|
104
104
|
};
|
|
105
105
|
__decorate([
|
|
106
106
|
(0, mongoose_1.Prop)({ type: [exports.ClusterSchema], default: [] }),
|
|
@@ -0,0 +1,43 @@
|
|
|
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, Types } from 'mongoose';
|
|
27
|
+
export type GroupDocument = HydratedDocument<Group>;
|
|
28
|
+
export declare class Group {
|
|
29
|
+
organization: Types.ObjectId;
|
|
30
|
+
name: string;
|
|
31
|
+
memberIds: Types.ObjectId[];
|
|
32
|
+
createdAt?: Date;
|
|
33
|
+
updatedAt?: Date;
|
|
34
|
+
}
|
|
35
|
+
export declare const GroupSchema: import("mongoose").Schema<Group, import("mongoose").Model<Group, any, any, any, import("mongoose").Document<unknown, any, Group, any, {}> & Group & {
|
|
36
|
+
_id: Types.ObjectId;
|
|
37
|
+
} & {
|
|
38
|
+
__v: number;
|
|
39
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Group, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Group>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Group> & {
|
|
40
|
+
_id: Types.ObjectId;
|
|
41
|
+
} & {
|
|
42
|
+
__v: number;
|
|
43
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
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.GroupSchema = exports.Group = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
let Group = class Group {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: 'Organization', required: true, index: true }),
|
|
19
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
20
|
+
], Group.prototype, "organization", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)({ required: true, trim: true }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], Group.prototype, "name", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)({ type: [mongoose_2.Types.ObjectId], ref: 'User', default: [] }),
|
|
27
|
+
__metadata("design:type", Array)
|
|
28
|
+
], Group.prototype, "memberIds", void 0);
|
|
29
|
+
Group = __decorate([
|
|
30
|
+
(0, mongoose_1.Schema)({ timestamps: true, collection: 'group' })
|
|
31
|
+
], Group);
|
|
32
|
+
exports.Group = Group;
|
|
33
|
+
exports.GroupSchema = mongoose_1.SchemaFactory.createForClass(Group);
|
|
34
|
+
exports.GroupSchema.index({ organization: 1, name: 1 }, { unique: true });
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
27
|
import { Profile } from './profile.schema';
|
|
28
|
-
import {
|
|
28
|
+
import { Party } from './party.schema';
|
|
29
29
|
export type InfluencerDocument = HydratedDocument<Influencer>;
|
|
30
30
|
export declare class Advisor {
|
|
31
31
|
email: string;
|
|
@@ -56,7 +56,7 @@ export declare const NoteSchema: MongooseSchema<Note, import("mongoose").Model<N
|
|
|
56
56
|
} & {
|
|
57
57
|
__v: number;
|
|
58
58
|
}>;
|
|
59
|
-
export declare class Influencer extends
|
|
59
|
+
export declare class Influencer extends Party {
|
|
60
60
|
financialManagementSheet?: string;
|
|
61
61
|
isExclusive: boolean;
|
|
62
62
|
advisor?: Advisor;
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.InfluencerModel = exports.InfluencerSchema = exports.Influencer = exports.NoteSchema = exports.Note = exports.AdvisorSchema = exports.Advisor = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
|
-
const
|
|
15
|
+
const party_schema_1 = require("./party.schema");
|
|
16
16
|
let Advisor = class Advisor {
|
|
17
17
|
};
|
|
18
18
|
__decorate([
|
|
@@ -55,7 +55,7 @@ Note = __decorate([
|
|
|
55
55
|
], Note);
|
|
56
56
|
exports.Note = Note;
|
|
57
57
|
exports.NoteSchema = mongoose_1.SchemaFactory.createForClass(Note);
|
|
58
|
-
let Influencer = class Influencer extends
|
|
58
|
+
let Influencer = class Influencer extends party_schema_1.Party {
|
|
59
59
|
};
|
|
60
60
|
__decorate([
|
|
61
61
|
(0, mongoose_1.Prop)({ required: false }),
|
|
@@ -0,0 +1,45 @@
|
|
|
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 } from 'mongoose';
|
|
27
|
+
export type OrganizationDocument = HydratedDocument<Organization>;
|
|
28
|
+
export declare class Organization {
|
|
29
|
+
corporateName: string;
|
|
30
|
+
fantasyName: string;
|
|
31
|
+
cnpj: string;
|
|
32
|
+
logo?: string;
|
|
33
|
+
logoSmall?: string;
|
|
34
|
+
createdAt?: Date;
|
|
35
|
+
updatedAt?: Date;
|
|
36
|
+
}
|
|
37
|
+
export declare const OrganizationSchema: import("mongoose").Schema<Organization, import("mongoose").Model<Organization, any, any, any, import("mongoose").Document<unknown, any, Organization, any, {}> & Organization & {
|
|
38
|
+
_id: import("mongoose").Types.ObjectId;
|
|
39
|
+
} & {
|
|
40
|
+
__v: number;
|
|
41
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Organization, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Organization>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Organization> & {
|
|
42
|
+
_id: import("mongoose").Types.ObjectId;
|
|
43
|
+
} & {
|
|
44
|
+
__v: number;
|
|
45
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
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.OrganizationSchema = exports.Organization = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
let Organization = class Organization {
|
|
15
|
+
};
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, mongoose_1.Prop)({ required: true, trim: true }),
|
|
18
|
+
__metadata("design:type", String)
|
|
19
|
+
], Organization.prototype, "corporateName", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, mongoose_1.Prop)({ required: true, trim: true }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], Organization.prototype, "fantasyName", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, mongoose_1.Prop)({ required: true, unique: true, index: true }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], Organization.prototype, "cnpj", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, mongoose_1.Prop)(),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], Organization.prototype, "logo", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, mongoose_1.Prop)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Organization.prototype, "logoSmall", void 0);
|
|
36
|
+
Organization = __decorate([
|
|
37
|
+
(0, mongoose_1.Schema)({ timestamps: true, collection: 'organizations', strict: true })
|
|
38
|
+
], Organization);
|
|
39
|
+
exports.Organization = Organization;
|
|
40
|
+
exports.OrganizationSchema = mongoose_1.SchemaFactory.createForClass(Organization);
|
|
41
|
+
exports.OrganizationSchema.index({ fantasyName: 'text', corporateName: 'text' });
|
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
export type PartyDocument = HydratedDocument<Party>;
|
|
28
|
+
export declare class Address {
|
|
29
|
+
zipcode: string;
|
|
30
|
+
city: string;
|
|
31
|
+
state: string;
|
|
32
|
+
street: string;
|
|
33
|
+
number: string;
|
|
34
|
+
complement: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const AddressSchema: MongooseSchema<Address, import("mongoose").Model<Address, any, any, any, import("mongoose").Document<unknown, any, Address, any, {}> & Address & {
|
|
37
|
+
_id: Types.ObjectId;
|
|
38
|
+
} & {
|
|
39
|
+
__v: number;
|
|
40
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Address, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Address>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Address> & {
|
|
41
|
+
_id: Types.ObjectId;
|
|
42
|
+
} & {
|
|
43
|
+
__v: number;
|
|
44
|
+
}>;
|
|
45
|
+
export declare class Company {
|
|
46
|
+
legalName: string;
|
|
47
|
+
document: string;
|
|
48
|
+
bank: string;
|
|
49
|
+
agency: string;
|
|
50
|
+
account: string;
|
|
51
|
+
digit: string;
|
|
52
|
+
pix: string;
|
|
53
|
+
email: string;
|
|
54
|
+
omieGrapaId?: string;
|
|
55
|
+
omieOmaId?: string;
|
|
56
|
+
}
|
|
57
|
+
export declare const CompanySchema: MongooseSchema<Company, import("mongoose").Model<Company, any, any, any, import("mongoose").Document<unknown, any, Company, any, {}> & Company & {
|
|
58
|
+
_id: Types.ObjectId;
|
|
59
|
+
} & {
|
|
60
|
+
__v: number;
|
|
61
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Company, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Company>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Company> & {
|
|
62
|
+
_id: Types.ObjectId;
|
|
63
|
+
} & {
|
|
64
|
+
__v: number;
|
|
65
|
+
}>;
|
|
66
|
+
export declare class Individual {
|
|
67
|
+
rg: string;
|
|
68
|
+
cpf: string;
|
|
69
|
+
birthday: Date;
|
|
70
|
+
maritalStatus: string;
|
|
71
|
+
nationality: string;
|
|
72
|
+
profession: string;
|
|
73
|
+
}
|
|
74
|
+
export declare const IndividualSchema: MongooseSchema<Individual, import("mongoose").Model<Individual, any, any, any, import("mongoose").Document<unknown, any, Individual, any, {}> & Individual & {
|
|
75
|
+
_id: Types.ObjectId;
|
|
76
|
+
} & {
|
|
77
|
+
__v: number;
|
|
78
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Individual, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Individual>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Individual> & {
|
|
79
|
+
_id: Types.ObjectId;
|
|
80
|
+
} & {
|
|
81
|
+
__v: number;
|
|
82
|
+
}>;
|
|
83
|
+
export declare class Party {
|
|
84
|
+
_id?: Types.ObjectId;
|
|
85
|
+
name: string;
|
|
86
|
+
email?: string;
|
|
87
|
+
phone?: string;
|
|
88
|
+
picture?: string;
|
|
89
|
+
address?: Address;
|
|
90
|
+
company?: Company;
|
|
91
|
+
individual?: Individual;
|
|
92
|
+
createdAt?: Date;
|
|
93
|
+
updatedAt?: Date;
|
|
94
|
+
}
|
|
95
|
+
export declare const PartySchema: MongooseSchema<Party, import("mongoose").Model<Party, any, any, any, import("mongoose").Document<unknown, any, Party, any, {}> & Party & Required<{
|
|
96
|
+
_id: Types.ObjectId;
|
|
97
|
+
}> & {
|
|
98
|
+
__v: number;
|
|
99
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Party, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Party>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Party> & Required<{
|
|
100
|
+
_id: Types.ObjectId;
|
|
101
|
+
}> & {
|
|
102
|
+
__v: number;
|
|
103
|
+
}>;
|
|
104
|
+
export declare const PartyModel: import("mongoose").Model<Party, {}, {}, {}, import("mongoose").Document<unknown, {}, Party, {}, import("mongoose").DefaultSchemaOptions> & Party & Required<{
|
|
105
|
+
_id: Types.ObjectId;
|
|
106
|
+
}> & {
|
|
107
|
+
__v: number;
|
|
108
|
+
}, MongooseSchema<Party, import("mongoose").Model<Party, any, any, any, import("mongoose").Document<unknown, any, Party, any, {}> & Party & Required<{
|
|
109
|
+
_id: Types.ObjectId;
|
|
110
|
+
}> & {
|
|
111
|
+
__v: number;
|
|
112
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Party, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Party>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Party> & Required<{
|
|
113
|
+
_id: Types.ObjectId;
|
|
114
|
+
}> & {
|
|
115
|
+
__v: number;
|
|
116
|
+
}>>;
|
|
@@ -0,0 +1,175 @@
|
|
|
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.PartyModel = exports.PartySchema = exports.Party = exports.IndividualSchema = exports.Individual = exports.CompanySchema = exports.Company = exports.AddressSchema = exports.Address = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
let Address = class Address {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, mongoose_1.Prop)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], Address.prototype, "zipcode", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], Address.prototype, "city", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Address.prototype, "state", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], Address.prototype, "street", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, mongoose_1.Prop)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], Address.prototype, "number", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], Address.prototype, "complement", void 0);
|
|
41
|
+
Address = __decorate([
|
|
42
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
43
|
+
], Address);
|
|
44
|
+
exports.Address = Address;
|
|
45
|
+
exports.AddressSchema = mongoose_1.SchemaFactory.createForClass(Address);
|
|
46
|
+
let Company = class Company {
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, mongoose_1.Prop)(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], Company.prototype, "legalName", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, mongoose_1.Prop)(),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], Company.prototype, "document", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, mongoose_1.Prop)(),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], Company.prototype, "bank", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, mongoose_1.Prop)(),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], Company.prototype, "agency", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, mongoose_1.Prop)(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], Company.prototype, "account", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, mongoose_1.Prop)(),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], Company.prototype, "digit", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, mongoose_1.Prop)(),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], Company.prototype, "pix", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, mongoose_1.Prop)(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], Company.prototype, "email", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], Company.prototype, "omieGrapaId", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], Company.prototype, "omieOmaId", void 0);
|
|
88
|
+
Company = __decorate([
|
|
89
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
90
|
+
], Company);
|
|
91
|
+
exports.Company = Company;
|
|
92
|
+
exports.CompanySchema = mongoose_1.SchemaFactory.createForClass(Company);
|
|
93
|
+
let Individual = class Individual {
|
|
94
|
+
};
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, mongoose_1.Prop)(),
|
|
97
|
+
__metadata("design:type", String)
|
|
98
|
+
], Individual.prototype, "rg", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, mongoose_1.Prop)(),
|
|
101
|
+
__metadata("design:type", String)
|
|
102
|
+
], Individual.prototype, "cpf", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, mongoose_1.Prop)(),
|
|
105
|
+
__metadata("design:type", Date)
|
|
106
|
+
], Individual.prototype, "birthday", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, mongoose_1.Prop)(),
|
|
109
|
+
__metadata("design:type", String)
|
|
110
|
+
], Individual.prototype, "maritalStatus", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, mongoose_1.Prop)(),
|
|
113
|
+
__metadata("design:type", String)
|
|
114
|
+
], Individual.prototype, "nationality", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, mongoose_1.Prop)(),
|
|
117
|
+
__metadata("design:type", String)
|
|
118
|
+
], Individual.prototype, "profession", void 0);
|
|
119
|
+
Individual = __decorate([
|
|
120
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
121
|
+
], Individual);
|
|
122
|
+
exports.Individual = Individual;
|
|
123
|
+
exports.IndividualSchema = mongoose_1.SchemaFactory.createForClass(Individual);
|
|
124
|
+
let Party = class Party {
|
|
125
|
+
};
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
128
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
129
|
+
], Party.prototype, "_id", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, mongoose_1.Prop)(),
|
|
132
|
+
__metadata("design:type", String)
|
|
133
|
+
], Party.prototype, "name", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], Party.prototype, "email", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
140
|
+
__metadata("design:type", String)
|
|
141
|
+
], Party.prototype, "phone", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
144
|
+
__metadata("design:type", String)
|
|
145
|
+
], Party.prototype, "picture", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, mongoose_1.Prop)({ type: exports.AddressSchema, required: false }),
|
|
148
|
+
__metadata("design:type", Address)
|
|
149
|
+
], Party.prototype, "address", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, mongoose_1.Prop)({ type: exports.CompanySchema, required: false }),
|
|
152
|
+
__metadata("design:type", Company)
|
|
153
|
+
], Party.prototype, "company", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, mongoose_1.Prop)({ type: exports.IndividualSchema, required: false }),
|
|
156
|
+
__metadata("design:type", Individual)
|
|
157
|
+
], Party.prototype, "individual", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, mongoose_1.Prop)({ default: Date.now, required: false }),
|
|
160
|
+
__metadata("design:type", Date)
|
|
161
|
+
], Party.prototype, "createdAt", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, mongoose_1.Prop)({ default: Date.now, required: false }),
|
|
164
|
+
__metadata("design:type", Date)
|
|
165
|
+
], Party.prototype, "updatedAt", void 0);
|
|
166
|
+
Party = __decorate([
|
|
167
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
168
|
+
], Party);
|
|
169
|
+
exports.Party = Party;
|
|
170
|
+
exports.PartySchema = mongoose_1.SchemaFactory.createForClass(Party);
|
|
171
|
+
exports.PartySchema.index({ name: 1 });
|
|
172
|
+
exports.PartySchema.index({ 'company.document': 1 });
|
|
173
|
+
exports.PartySchema.index({ 'company.legalName': 1 });
|
|
174
|
+
exports.PartySchema.index({ createdAt: -1 });
|
|
175
|
+
exports.PartyModel = (0, mongoose_2.model)('Party', exports.PartySchema);
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
import { HydratedDocument } from 'mongoose';
|
|
27
|
-
import {
|
|
27
|
+
import { Party } from './party.schema';
|
|
28
28
|
export type SupplierDocument = HydratedDocument<Supplier>;
|
|
29
|
-
export declare class Supplier extends
|
|
29
|
+
export declare class Supplier extends Party {
|
|
30
30
|
}
|
|
31
31
|
export declare const SupplierSchema: import("mongoose").Schema<Supplier, import("mongoose").Model<Supplier, any, any, any, import("mongoose").Document<unknown, any, Supplier, any, {}> & Supplier & Required<{
|
|
32
32
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.SupplierModel = exports.SupplierSchema = exports.Supplier = void 0;
|
|
10
10
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
11
|
const mongoose_2 = require("mongoose");
|
|
12
|
-
const
|
|
13
|
-
let Supplier = class Supplier extends
|
|
12
|
+
const party_schema_1 = require("./party.schema");
|
|
13
|
+
let Supplier = class Supplier extends party_schema_1.Party {
|
|
14
14
|
};
|
|
15
15
|
Supplier = __decorate([
|
|
16
16
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
@@ -23,94 +23,39 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/schematypes" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
-
import { HydratedDocument,
|
|
26
|
+
import { HydratedDocument, Types } from 'mongoose';
|
|
27
27
|
export type UserDocument = HydratedDocument<User>;
|
|
28
|
-
export declare
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
complement: string;
|
|
28
|
+
export declare enum OrganizationTeam {
|
|
29
|
+
SERVICE = "service",
|
|
30
|
+
ADMIN = "admin",
|
|
31
|
+
ARTISTIC = "artistic",
|
|
32
|
+
FINANCIAL = "financial",
|
|
33
|
+
COMERCIAL = "comercial"
|
|
35
34
|
}
|
|
36
|
-
export declare
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_id: Types.ObjectId;
|
|
42
|
-
} & {
|
|
43
|
-
__v: number;
|
|
44
|
-
}>;
|
|
45
|
-
export declare class Company {
|
|
46
|
-
legalName: string;
|
|
47
|
-
document: string;
|
|
48
|
-
bank: string;
|
|
49
|
-
agency: string;
|
|
50
|
-
account: string;
|
|
51
|
-
digit: string;
|
|
52
|
-
pix: string;
|
|
53
|
-
email: string;
|
|
54
|
-
omieGrapaId?: string;
|
|
55
|
-
omieOmaId?: string;
|
|
56
|
-
}
|
|
57
|
-
export declare const CompanySchema: MongooseSchema<Company, import("mongoose").Model<Company, any, any, any, import("mongoose").Document<unknown, any, Company, any, {}> & Company & {
|
|
58
|
-
_id: Types.ObjectId;
|
|
59
|
-
} & {
|
|
60
|
-
__v: number;
|
|
61
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Company, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Company>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Company> & {
|
|
62
|
-
_id: Types.ObjectId;
|
|
63
|
-
} & {
|
|
64
|
-
__v: number;
|
|
65
|
-
}>;
|
|
66
|
-
export declare class Individual {
|
|
67
|
-
rg: string;
|
|
68
|
-
cpf: string;
|
|
69
|
-
birthday: Date;
|
|
70
|
-
maritalStatus: string;
|
|
71
|
-
nationality: string;
|
|
72
|
-
profession: string;
|
|
35
|
+
export declare enum UserRole {
|
|
36
|
+
ADMIN = "admin",
|
|
37
|
+
USER = "user",
|
|
38
|
+
CLIENT = "client",
|
|
39
|
+
INFLUENCER = "influencer"
|
|
73
40
|
}
|
|
74
|
-
export declare const IndividualSchema: MongooseSchema<Individual, import("mongoose").Model<Individual, any, any, any, import("mongoose").Document<unknown, any, Individual, any, {}> & Individual & {
|
|
75
|
-
_id: Types.ObjectId;
|
|
76
|
-
} & {
|
|
77
|
-
__v: number;
|
|
78
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Individual, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Individual>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Individual> & {
|
|
79
|
-
_id: Types.ObjectId;
|
|
80
|
-
} & {
|
|
81
|
-
__v: number;
|
|
82
|
-
}>;
|
|
83
41
|
export declare class User {
|
|
84
|
-
|
|
42
|
+
organization: Types.ObjectId;
|
|
43
|
+
email: string;
|
|
85
44
|
name: string;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
individual?: Individual;
|
|
45
|
+
username: string;
|
|
46
|
+
team?: OrganizationTeam;
|
|
47
|
+
role?: UserRole;
|
|
48
|
+
firebaseUid?: string;
|
|
49
|
+
disabled?: boolean;
|
|
92
50
|
createdAt?: Date;
|
|
93
51
|
updatedAt?: Date;
|
|
94
52
|
}
|
|
95
|
-
export declare const UserSchema:
|
|
53
|
+
export declare const UserSchema: import("mongoose").Schema<User, import("mongoose").Model<User, any, any, any, import("mongoose").Document<unknown, any, User, any, {}> & User & {
|
|
96
54
|
_id: Types.ObjectId;
|
|
97
|
-
}
|
|
55
|
+
} & {
|
|
98
56
|
__v: number;
|
|
99
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<User>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<User> &
|
|
57
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<User>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<User> & {
|
|
100
58
|
_id: Types.ObjectId;
|
|
101
|
-
}
|
|
59
|
+
} & {
|
|
102
60
|
__v: number;
|
|
103
61
|
}>;
|
|
104
|
-
export declare const UserModel: import("mongoose").Model<User, {}, {}, {}, import("mongoose").Document<unknown, {}, User, {}, import("mongoose").DefaultSchemaOptions> & User & Required<{
|
|
105
|
-
_id: Types.ObjectId;
|
|
106
|
-
}> & {
|
|
107
|
-
__v: number;
|
|
108
|
-
}, MongooseSchema<User, import("mongoose").Model<User, any, any, any, import("mongoose").Document<unknown, any, User, any, {}> & User & Required<{
|
|
109
|
-
_id: Types.ObjectId;
|
|
110
|
-
}> & {
|
|
111
|
-
__v: number;
|
|
112
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<User>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<User> & Required<{
|
|
113
|
-
_id: Types.ObjectId;
|
|
114
|
-
}> & {
|
|
115
|
-
__v: number;
|
|
116
|
-
}>>;
|
|
@@ -9,167 +9,62 @@ 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.
|
|
12
|
+
exports.UserSchema = exports.User = exports.UserRole = exports.OrganizationTeam = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
(0, mongoose_1.Prop)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], Address.prototype, "street", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, mongoose_1.Prop)(),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], Address.prototype, "number", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, mongoose_1.Prop)(),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], Address.prototype, "complement", void 0);
|
|
41
|
-
Address = __decorate([
|
|
42
|
-
(0, mongoose_1.Schema)({ _id: false })
|
|
43
|
-
], Address);
|
|
44
|
-
exports.Address = Address;
|
|
45
|
-
exports.AddressSchema = mongoose_1.SchemaFactory.createForClass(Address);
|
|
46
|
-
let Company = class Company {
|
|
47
|
-
};
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, mongoose_1.Prop)(),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], Company.prototype, "legalName", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, mongoose_1.Prop)(),
|
|
54
|
-
__metadata("design:type", String)
|
|
55
|
-
], Company.prototype, "document", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, mongoose_1.Prop)(),
|
|
58
|
-
__metadata("design:type", String)
|
|
59
|
-
], Company.prototype, "bank", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, mongoose_1.Prop)(),
|
|
62
|
-
__metadata("design:type", String)
|
|
63
|
-
], Company.prototype, "agency", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, mongoose_1.Prop)(),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], Company.prototype, "account", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, mongoose_1.Prop)(),
|
|
70
|
-
__metadata("design:type", String)
|
|
71
|
-
], Company.prototype, "digit", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, mongoose_1.Prop)(),
|
|
74
|
-
__metadata("design:type", String)
|
|
75
|
-
], Company.prototype, "pix", void 0);
|
|
76
|
-
__decorate([
|
|
77
|
-
(0, mongoose_1.Prop)(),
|
|
78
|
-
__metadata("design:type", String)
|
|
79
|
-
], Company.prototype, "email", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
(0, mongoose_1.Prop)({ required: false }),
|
|
82
|
-
__metadata("design:type", String)
|
|
83
|
-
], Company.prototype, "omieGrapaId", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, mongoose_1.Prop)({ required: false }),
|
|
86
|
-
__metadata("design:type", String)
|
|
87
|
-
], Company.prototype, "omieOmaId", void 0);
|
|
88
|
-
Company = __decorate([
|
|
89
|
-
(0, mongoose_1.Schema)({ _id: false })
|
|
90
|
-
], Company);
|
|
91
|
-
exports.Company = Company;
|
|
92
|
-
exports.CompanySchema = mongoose_1.SchemaFactory.createForClass(Company);
|
|
93
|
-
let Individual = class Individual {
|
|
94
|
-
};
|
|
95
|
-
__decorate([
|
|
96
|
-
(0, mongoose_1.Prop)(),
|
|
97
|
-
__metadata("design:type", String)
|
|
98
|
-
], Individual.prototype, "rg", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
(0, mongoose_1.Prop)(),
|
|
101
|
-
__metadata("design:type", String)
|
|
102
|
-
], Individual.prototype, "cpf", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
(0, mongoose_1.Prop)(),
|
|
105
|
-
__metadata("design:type", Date)
|
|
106
|
-
], Individual.prototype, "birthday", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
(0, mongoose_1.Prop)(),
|
|
109
|
-
__metadata("design:type", String)
|
|
110
|
-
], Individual.prototype, "maritalStatus", void 0);
|
|
111
|
-
__decorate([
|
|
112
|
-
(0, mongoose_1.Prop)(),
|
|
113
|
-
__metadata("design:type", String)
|
|
114
|
-
], Individual.prototype, "nationality", void 0);
|
|
115
|
-
__decorate([
|
|
116
|
-
(0, mongoose_1.Prop)(),
|
|
117
|
-
__metadata("design:type", String)
|
|
118
|
-
], Individual.prototype, "profession", void 0);
|
|
119
|
-
Individual = __decorate([
|
|
120
|
-
(0, mongoose_1.Schema)({ _id: false })
|
|
121
|
-
], Individual);
|
|
122
|
-
exports.Individual = Individual;
|
|
123
|
-
exports.IndividualSchema = mongoose_1.SchemaFactory.createForClass(Individual);
|
|
15
|
+
var OrganizationTeam;
|
|
16
|
+
(function (OrganizationTeam) {
|
|
17
|
+
OrganizationTeam["SERVICE"] = "service";
|
|
18
|
+
OrganizationTeam["ADMIN"] = "admin";
|
|
19
|
+
OrganizationTeam["ARTISTIC"] = "artistic";
|
|
20
|
+
OrganizationTeam["FINANCIAL"] = "financial";
|
|
21
|
+
OrganizationTeam["COMERCIAL"] = "comercial";
|
|
22
|
+
})(OrganizationTeam = exports.OrganizationTeam || (exports.OrganizationTeam = {}));
|
|
23
|
+
var UserRole;
|
|
24
|
+
(function (UserRole) {
|
|
25
|
+
UserRole["ADMIN"] = "admin";
|
|
26
|
+
UserRole["USER"] = "user";
|
|
27
|
+
UserRole["CLIENT"] = "client";
|
|
28
|
+
UserRole["INFLUENCER"] = "influencer";
|
|
29
|
+
})(UserRole = exports.UserRole || (exports.UserRole = {}));
|
|
124
30
|
let User = class User {
|
|
125
31
|
};
|
|
126
32
|
__decorate([
|
|
127
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.
|
|
33
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: 'Organization', required: true, index: true }),
|
|
128
34
|
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
129
|
-
], User.prototype, "
|
|
35
|
+
], User.prototype, "organization", void 0);
|
|
130
36
|
__decorate([
|
|
131
|
-
(0, mongoose_1.Prop)(),
|
|
132
|
-
__metadata("design:type", String)
|
|
133
|
-
], User.prototype, "name", void 0);
|
|
134
|
-
__decorate([
|
|
135
|
-
(0, mongoose_1.Prop)({ required: false }),
|
|
37
|
+
(0, mongoose_1.Prop)({ required: true, trim: true, lowercase: true, index: true }),
|
|
136
38
|
__metadata("design:type", String)
|
|
137
39
|
], User.prototype, "email", void 0);
|
|
138
40
|
__decorate([
|
|
139
|
-
(0, mongoose_1.Prop)({ required:
|
|
41
|
+
(0, mongoose_1.Prop)({ required: true, trim: true }),
|
|
140
42
|
__metadata("design:type", String)
|
|
141
|
-
], User.prototype, "
|
|
43
|
+
], User.prototype, "name", void 0);
|
|
142
44
|
__decorate([
|
|
143
|
-
(0, mongoose_1.Prop)({ required:
|
|
45
|
+
(0, mongoose_1.Prop)({ required: true, trim: true }),
|
|
144
46
|
__metadata("design:type", String)
|
|
145
|
-
], User.prototype, "
|
|
146
|
-
__decorate([
|
|
147
|
-
(0, mongoose_1.Prop)({ type: exports.AddressSchema, required: false }),
|
|
148
|
-
__metadata("design:type", Address)
|
|
149
|
-
], User.prototype, "address", void 0);
|
|
47
|
+
], User.prototype, "username", void 0);
|
|
150
48
|
__decorate([
|
|
151
|
-
(0, mongoose_1.Prop)({
|
|
152
|
-
__metadata("design:type",
|
|
153
|
-
], User.prototype, "
|
|
49
|
+
(0, mongoose_1.Prop)({ enum: OrganizationTeam }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], User.prototype, "team", void 0);
|
|
154
52
|
__decorate([
|
|
155
|
-
(0, mongoose_1.Prop)({
|
|
156
|
-
__metadata("design:type",
|
|
157
|
-
], User.prototype, "
|
|
53
|
+
(0, mongoose_1.Prop)({ enum: UserRole }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], User.prototype, "role", void 0);
|
|
158
56
|
__decorate([
|
|
159
|
-
(0, mongoose_1.Prop)({
|
|
160
|
-
__metadata("design:type",
|
|
161
|
-
], User.prototype, "
|
|
57
|
+
(0, mongoose_1.Prop)({ trim: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], User.prototype, "firebaseUid", void 0);
|
|
162
60
|
__decorate([
|
|
163
|
-
(0, mongoose_1.Prop)({ default:
|
|
164
|
-
__metadata("design:type",
|
|
165
|
-
], User.prototype, "
|
|
61
|
+
(0, mongoose_1.Prop)({ default: false }),
|
|
62
|
+
__metadata("design:type", Boolean)
|
|
63
|
+
], User.prototype, "disabled", void 0);
|
|
166
64
|
User = __decorate([
|
|
167
|
-
(0, mongoose_1.Schema)({ timestamps: true })
|
|
65
|
+
(0, mongoose_1.Schema)({ timestamps: true, collection: 'user' })
|
|
168
66
|
], User);
|
|
169
67
|
exports.User = User;
|
|
170
68
|
exports.UserSchema = mongoose_1.SchemaFactory.createForClass(User);
|
|
171
|
-
exports.UserSchema.index({
|
|
172
|
-
exports.UserSchema.index({
|
|
173
|
-
exports.UserSchema.index({ 'company.legalName': 1 });
|
|
174
|
-
exports.UserSchema.index({ createdAt: -1 });
|
|
175
|
-
exports.UserModel = (0, mongoose_2.model)('User', exports.UserSchema);
|
|
69
|
+
exports.UserSchema.index({ organization: 1, email: 1 }, { unique: true });
|
|
70
|
+
exports.UserSchema.index({ organization: 1, username: 1 }, { unique: true });
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -18,3 +18,6 @@ export * from './schemas/commission.schema';
|
|
|
18
18
|
export * from './schemas/contract.schema';
|
|
19
19
|
export * from './schemas/benchmark.schema';
|
|
20
20
|
export * from './schemas/notifications.schema';
|
|
21
|
+
export * from './schemas/organization.schema';
|
|
22
|
+
export * from './schemas/user.schema';
|
|
23
|
+
export * from './schemas/group.schema';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
2
|
import { HydratedDocument, model as MongooseModel } from 'mongoose';
|
|
3
|
-
import {
|
|
3
|
+
import { Party } from './party.schema';
|
|
4
4
|
|
|
5
5
|
export type ClientDocument = HydratedDocument<Client>;
|
|
6
6
|
|
|
@@ -69,7 +69,7 @@ export class NicheItem {
|
|
|
69
69
|
export const NicheItemSchema = SchemaFactory.createForClass(NicheItem);
|
|
70
70
|
|
|
71
71
|
@Schema({ timestamps: true })
|
|
72
|
-
export class Client extends
|
|
72
|
+
export class Client extends Party {
|
|
73
73
|
@Prop({ type: [ClusterSchema], default: [] })
|
|
74
74
|
clusters: Cluster[];
|
|
75
75
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import { HydratedDocument, Types } from 'mongoose';
|
|
3
|
+
|
|
4
|
+
export type GroupDocument = HydratedDocument<Group>;
|
|
5
|
+
|
|
6
|
+
@Schema({ timestamps: true, collection: 'group' })
|
|
7
|
+
export class Group {
|
|
8
|
+
@Prop({ type: Types.ObjectId, ref: 'Organization', required: true, index: true })
|
|
9
|
+
organization: Types.ObjectId;
|
|
10
|
+
|
|
11
|
+
@Prop({ required: true, trim: true })
|
|
12
|
+
name: string;
|
|
13
|
+
|
|
14
|
+
@Prop({ type: [Types.ObjectId], ref: 'User', default: [] })
|
|
15
|
+
memberIds: Types.ObjectId[];
|
|
16
|
+
|
|
17
|
+
createdAt?: Date;
|
|
18
|
+
updatedAt?: Date;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const GroupSchema = SchemaFactory.createForClass(Group);
|
|
22
|
+
|
|
23
|
+
GroupSchema.index({ organization: 1, name: 1 }, { unique: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { Profile } from './profile.schema';
|
|
4
|
-
import {
|
|
4
|
+
import { Party } from './party.schema';
|
|
5
5
|
|
|
6
6
|
export type InfluencerDocument = HydratedDocument<Influencer>;
|
|
7
7
|
@Schema({ _id: false })
|
|
@@ -34,7 +34,7 @@ export class Note {
|
|
|
34
34
|
export const NoteSchema = SchemaFactory.createForClass(Note);
|
|
35
35
|
|
|
36
36
|
@Schema({ timestamps: true })
|
|
37
|
-
export class Influencer extends
|
|
37
|
+
export class Influencer extends Party {
|
|
38
38
|
@Prop({ required: false })
|
|
39
39
|
financialManagementSheet?: string;
|
|
40
40
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import { HydratedDocument } from 'mongoose';
|
|
3
|
+
|
|
4
|
+
export type OrganizationDocument = HydratedDocument<Organization>;
|
|
5
|
+
|
|
6
|
+
@Schema({ timestamps: true, collection: 'organizations', strict: true })
|
|
7
|
+
export class Organization {
|
|
8
|
+
@Prop({ required: true, trim: true })
|
|
9
|
+
corporateName: string;
|
|
10
|
+
|
|
11
|
+
@Prop({ required: true, trim: true })
|
|
12
|
+
fantasyName: string;
|
|
13
|
+
|
|
14
|
+
@Prop({ required: true, unique: true, index: true })
|
|
15
|
+
cnpj: string;
|
|
16
|
+
|
|
17
|
+
@Prop()
|
|
18
|
+
logo?: string;
|
|
19
|
+
|
|
20
|
+
@Prop()
|
|
21
|
+
logoSmall?: string;
|
|
22
|
+
|
|
23
|
+
createdAt?: Date;
|
|
24
|
+
updatedAt?: Date;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const OrganizationSchema = SchemaFactory.createForClass(Organization);
|
|
28
|
+
|
|
29
|
+
OrganizationSchema.index({ fantasyName: 'text', corporateName: 'text' });
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
|
|
3
|
+
|
|
4
|
+
export type PartyDocument = HydratedDocument<Party>;
|
|
5
|
+
|
|
6
|
+
@Schema({ _id: false })
|
|
7
|
+
export class Address {
|
|
8
|
+
@Prop() zipcode: string;
|
|
9
|
+
@Prop() city: string;
|
|
10
|
+
@Prop() state: string;
|
|
11
|
+
@Prop() street: string;
|
|
12
|
+
@Prop() number: string;
|
|
13
|
+
@Prop() complement: string;
|
|
14
|
+
}
|
|
15
|
+
export const AddressSchema = SchemaFactory.createForClass(Address);
|
|
16
|
+
|
|
17
|
+
@Schema({ _id: false })
|
|
18
|
+
export class Company {
|
|
19
|
+
@Prop() legalName: string;
|
|
20
|
+
@Prop() document: string;
|
|
21
|
+
@Prop() bank: string;
|
|
22
|
+
@Prop() agency: string;
|
|
23
|
+
@Prop() account: string;
|
|
24
|
+
@Prop() digit: string;
|
|
25
|
+
@Prop() pix: string;
|
|
26
|
+
@Prop() email: string;
|
|
27
|
+
@Prop({ required: false }) omieGrapaId?: string;
|
|
28
|
+
@Prop({ required: false }) omieOmaId?: string;
|
|
29
|
+
}
|
|
30
|
+
export const CompanySchema = SchemaFactory.createForClass(Company);
|
|
31
|
+
|
|
32
|
+
@Schema({ _id: false })
|
|
33
|
+
export class Individual {
|
|
34
|
+
@Prop() rg: string;
|
|
35
|
+
@Prop() cpf: string;
|
|
36
|
+
@Prop() birthday: Date;
|
|
37
|
+
@Prop() maritalStatus: string;
|
|
38
|
+
@Prop() nationality: string;
|
|
39
|
+
@Prop() profession: string;
|
|
40
|
+
}
|
|
41
|
+
export const IndividualSchema = SchemaFactory.createForClass(Individual);
|
|
42
|
+
|
|
43
|
+
@Schema({ timestamps: true })
|
|
44
|
+
export class Party {
|
|
45
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
46
|
+
_id?: Types.ObjectId;
|
|
47
|
+
|
|
48
|
+
@Prop() name: string;
|
|
49
|
+
@Prop({ required: false }) email?: string;
|
|
50
|
+
@Prop({ required: false }) phone?: string;
|
|
51
|
+
@Prop({ required: false }) picture?: string;
|
|
52
|
+
@Prop({ type: AddressSchema, required: false }) address?: Address;
|
|
53
|
+
@Prop({ type: CompanySchema, required: false }) company?: Company;
|
|
54
|
+
@Prop({ type: IndividualSchema, required: false }) individual?: Individual;
|
|
55
|
+
@Prop({ default: Date.now, required: false }) createdAt?: Date;
|
|
56
|
+
@Prop({ default: Date.now, required: false }) updatedAt?: Date;
|
|
57
|
+
}
|
|
58
|
+
export const PartySchema = SchemaFactory.createForClass(Party);
|
|
59
|
+
|
|
60
|
+
PartySchema.index({ name: 1 });
|
|
61
|
+
PartySchema.index({ 'company.document': 1 });
|
|
62
|
+
PartySchema.index({ 'company.legalName': 1 });
|
|
63
|
+
PartySchema.index({ createdAt: -1 });
|
|
64
|
+
|
|
65
|
+
export const PartyModel = MongooseModel('Party', PartySchema);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
2
|
import { HydratedDocument, model as MongooseModel } from 'mongoose';
|
|
3
|
-
import {
|
|
3
|
+
import { Party } from './party.schema';
|
|
4
4
|
|
|
5
5
|
export type SupplierDocument = HydratedDocument<Supplier>;
|
|
6
6
|
|
|
7
7
|
@Schema({ timestamps: true })
|
|
8
|
-
export class Supplier extends
|
|
8
|
+
export class Supplier extends Party {}
|
|
9
9
|
|
|
10
10
|
export const SupplierSchema = SchemaFactory.createForClass(Supplier);
|
|
11
11
|
export const SupplierModel = MongooseModel('Supplier', SupplierSchema);
|
|
@@ -1,130 +1,54 @@
|
|
|
1
1
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
-
import { HydratedDocument,
|
|
2
|
+
import { HydratedDocument, Types } from 'mongoose';
|
|
3
3
|
|
|
4
4
|
export type UserDocument = HydratedDocument<User>;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
city: string;
|
|
13
|
-
|
|
14
|
-
@Prop()
|
|
15
|
-
state: string;
|
|
16
|
-
|
|
17
|
-
@Prop()
|
|
18
|
-
street: string;
|
|
19
|
-
|
|
20
|
-
@Prop()
|
|
21
|
-
number: string;
|
|
22
|
-
|
|
23
|
-
@Prop()
|
|
24
|
-
complement: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const AddressSchema = SchemaFactory.createForClass(Address);
|
|
28
|
-
|
|
29
|
-
@Schema({ _id: false })
|
|
30
|
-
export class Company {
|
|
31
|
-
@Prop()
|
|
32
|
-
legalName: string;
|
|
33
|
-
|
|
34
|
-
@Prop()
|
|
35
|
-
document: string;
|
|
36
|
-
|
|
37
|
-
@Prop()
|
|
38
|
-
bank: string;
|
|
39
|
-
|
|
40
|
-
@Prop()
|
|
41
|
-
agency: string;
|
|
42
|
-
|
|
43
|
-
@Prop()
|
|
44
|
-
account: string;
|
|
45
|
-
|
|
46
|
-
@Prop()
|
|
47
|
-
digit: string;
|
|
48
|
-
|
|
49
|
-
@Prop()
|
|
50
|
-
pix: string;
|
|
51
|
-
|
|
52
|
-
@Prop()
|
|
53
|
-
email: string;
|
|
54
|
-
|
|
55
|
-
@Prop({ required: false })
|
|
56
|
-
omieGrapaId?: string;
|
|
57
|
-
|
|
58
|
-
@Prop({ required: false })
|
|
59
|
-
omieOmaId?: string;
|
|
60
|
-
|
|
61
|
-
|
|
6
|
+
export enum OrganizationTeam {
|
|
7
|
+
SERVICE = 'service',
|
|
8
|
+
ADMIN = 'admin',
|
|
9
|
+
ARTISTIC = 'artistic',
|
|
10
|
+
FINANCIAL = 'financial',
|
|
11
|
+
COMERCIAL = 'comercial',
|
|
62
12
|
}
|
|
63
13
|
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
rg: string;
|
|
70
|
-
|
|
71
|
-
@Prop()
|
|
72
|
-
cpf: string;
|
|
73
|
-
|
|
74
|
-
@Prop()
|
|
75
|
-
birthday: Date;
|
|
76
|
-
|
|
77
|
-
@Prop()
|
|
78
|
-
maritalStatus: string;
|
|
79
|
-
|
|
80
|
-
@Prop()
|
|
81
|
-
nationality: string;
|
|
82
|
-
|
|
83
|
-
@Prop()
|
|
84
|
-
profession: string;
|
|
14
|
+
export enum UserRole {
|
|
15
|
+
ADMIN = 'admin',
|
|
16
|
+
USER = 'user',
|
|
17
|
+
CLIENT = 'client',
|
|
18
|
+
INFLUENCER = 'influencer',
|
|
85
19
|
}
|
|
86
20
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@Schema({ timestamps: true })
|
|
21
|
+
@Schema({ timestamps: true, collection: 'user' })
|
|
90
22
|
export class User {
|
|
91
|
-
@Prop({ type:
|
|
92
|
-
|
|
23
|
+
@Prop({ type: Types.ObjectId, ref: 'Organization', required: true, index: true })
|
|
24
|
+
organization: Types.ObjectId;
|
|
93
25
|
|
|
94
|
-
@Prop()
|
|
95
|
-
|
|
26
|
+
@Prop({ required: true, trim: true, lowercase: true, index: true })
|
|
27
|
+
email: string;
|
|
96
28
|
|
|
97
|
-
@Prop({ required:
|
|
98
|
-
|
|
29
|
+
@Prop({ required: true, trim: true })
|
|
30
|
+
name: string;
|
|
99
31
|
|
|
100
|
-
@Prop({ required:
|
|
101
|
-
|
|
32
|
+
@Prop({ required: true, trim: true })
|
|
33
|
+
username: string;
|
|
102
34
|
|
|
103
|
-
@Prop({
|
|
104
|
-
|
|
35
|
+
@Prop({ enum: OrganizationTeam })
|
|
36
|
+
team?: OrganizationTeam;
|
|
105
37
|
|
|
106
|
-
@Prop({
|
|
107
|
-
|
|
38
|
+
@Prop({ enum: UserRole })
|
|
39
|
+
role?: UserRole;
|
|
108
40
|
|
|
109
|
-
@Prop({
|
|
110
|
-
|
|
41
|
+
@Prop({ trim: true })
|
|
42
|
+
firebaseUid?: string;
|
|
111
43
|
|
|
112
|
-
@Prop({
|
|
113
|
-
|
|
44
|
+
@Prop({ default: false })
|
|
45
|
+
disabled?: boolean;
|
|
114
46
|
|
|
115
|
-
@Prop({ default: Date.now, required: false })
|
|
116
47
|
createdAt?: Date;
|
|
117
|
-
|
|
118
|
-
@Prop({ default: Date.now, required: false })
|
|
119
48
|
updatedAt?: Date;
|
|
120
49
|
}
|
|
121
50
|
|
|
122
51
|
export const UserSchema = SchemaFactory.createForClass(User);
|
|
123
52
|
|
|
124
|
-
UserSchema.index({
|
|
125
|
-
UserSchema.index({
|
|
126
|
-
UserSchema.index({ 'company.legalName': 1 });
|
|
127
|
-
UserSchema.index({ createdAt: -1 });
|
|
128
|
-
|
|
129
|
-
export const UserModel = MongooseModel('User', UserSchema);
|
|
130
|
-
|
|
53
|
+
UserSchema.index({ organization: 1, email: 1 }, { unique: true });
|
|
54
|
+
UserSchema.index({ organization: 1, username: 1 }, { unique: true });
|