world-med-commons 1.0.0

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.
@@ -0,0 +1,3 @@
1
+ export * from './models/business.schema';
2
+ export * from './models/user.schema';
3
+ export * from './models/employee.schema';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./models/business.schema"), exports);
18
+ __exportStar(require("./models/user.schema"), exports);
19
+ __exportStar(require("./models/employee.schema"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,uDAAqC;AACrC,2DAAyC"}
@@ -0,0 +1,170 @@
1
+ import mongoose, { HydratedDocument } from 'mongoose';
2
+ export type BusinessDocument = HydratedDocument<Business>;
3
+ export declare class Business {
4
+ name: string;
5
+ email: string;
6
+ phoneNumber: string;
7
+ website: string;
8
+ logo: string;
9
+ description: string;
10
+ address: string;
11
+ city: string;
12
+ state: string;
13
+ zipCode: string;
14
+ country: string;
15
+ geolocation: {
16
+ lat: number;
17
+ lng: number;
18
+ };
19
+ Parent: Business;
20
+ isActive: boolean;
21
+ }
22
+ export declare const BusinessSchema: mongoose.Schema<Business, mongoose.Model<Business, any, any, any, (mongoose.Document<unknown, any, Business, any, mongoose.DefaultSchemaOptions> & Business & {
23
+ _id: mongoose.Types.ObjectId;
24
+ } & {
25
+ __v: number;
26
+ } & {
27
+ id: string;
28
+ }) | (mongoose.Document<unknown, any, Business, any, mongoose.DefaultSchemaOptions> & Business & {
29
+ _id: mongoose.Types.ObjectId;
30
+ } & {
31
+ __v: number;
32
+ }), any, Business>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, Business, mongoose.Document<unknown, {}, Business, {
33
+ id: string;
34
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
35
+ _id: mongoose.Types.ObjectId;
36
+ } & {
37
+ __v: number;
38
+ }, "id"> & {
39
+ id: string;
40
+ }, {
41
+ name?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
42
+ id: string;
43
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
44
+ _id: mongoose.Types.ObjectId;
45
+ } & {
46
+ __v: number;
47
+ }, "id"> & {
48
+ id: string;
49
+ }>;
50
+ email?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
51
+ id: string;
52
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
53
+ _id: mongoose.Types.ObjectId;
54
+ } & {
55
+ __v: number;
56
+ }, "id"> & {
57
+ id: string;
58
+ }>;
59
+ phoneNumber?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
60
+ id: string;
61
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
62
+ _id: mongoose.Types.ObjectId;
63
+ } & {
64
+ __v: number;
65
+ }, "id"> & {
66
+ id: string;
67
+ }>;
68
+ website?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
69
+ id: string;
70
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
71
+ _id: mongoose.Types.ObjectId;
72
+ } & {
73
+ __v: number;
74
+ }, "id"> & {
75
+ id: string;
76
+ }>;
77
+ logo?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
78
+ id: string;
79
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
80
+ _id: mongoose.Types.ObjectId;
81
+ } & {
82
+ __v: number;
83
+ }, "id"> & {
84
+ id: string;
85
+ }>;
86
+ description?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
87
+ id: string;
88
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
89
+ _id: mongoose.Types.ObjectId;
90
+ } & {
91
+ __v: number;
92
+ }, "id"> & {
93
+ id: string;
94
+ }>;
95
+ address?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
96
+ id: string;
97
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
98
+ _id: mongoose.Types.ObjectId;
99
+ } & {
100
+ __v: number;
101
+ }, "id"> & {
102
+ id: string;
103
+ }>;
104
+ city?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
105
+ id: string;
106
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
107
+ _id: mongoose.Types.ObjectId;
108
+ } & {
109
+ __v: number;
110
+ }, "id"> & {
111
+ id: string;
112
+ }>;
113
+ state?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
114
+ id: string;
115
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
116
+ _id: mongoose.Types.ObjectId;
117
+ } & {
118
+ __v: number;
119
+ }, "id"> & {
120
+ id: string;
121
+ }>;
122
+ zipCode?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
123
+ id: string;
124
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
125
+ _id: mongoose.Types.ObjectId;
126
+ } & {
127
+ __v: number;
128
+ }, "id"> & {
129
+ id: string;
130
+ }>;
131
+ country?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
132
+ id: string;
133
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
134
+ _id: mongoose.Types.ObjectId;
135
+ } & {
136
+ __v: number;
137
+ }, "id"> & {
138
+ id: string;
139
+ }>;
140
+ geolocation?: mongoose.SchemaDefinitionProperty<{
141
+ lat: number;
142
+ lng: number;
143
+ }, Business, mongoose.Document<unknown, {}, Business, {
144
+ id: string;
145
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
146
+ _id: mongoose.Types.ObjectId;
147
+ } & {
148
+ __v: number;
149
+ }, "id"> & {
150
+ id: string;
151
+ }>;
152
+ Parent?: mongoose.SchemaDefinitionProperty<Business, Business, mongoose.Document<unknown, {}, Business, {
153
+ id: string;
154
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
155
+ _id: mongoose.Types.ObjectId;
156
+ } & {
157
+ __v: number;
158
+ }, "id"> & {
159
+ id: string;
160
+ }>;
161
+ isActive?: mongoose.SchemaDefinitionProperty<boolean, Business, mongoose.Document<unknown, {}, Business, {
162
+ id: string;
163
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
164
+ _id: mongoose.Types.ObjectId;
165
+ } & {
166
+ __v: number;
167
+ }, "id"> & {
168
+ id: string;
169
+ }>;
170
+ }, Business>;
@@ -0,0 +1,93 @@
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.BusinessSchema = exports.Business = void 0;
13
+ const mongoose_1 = require("mongoose");
14
+ const mongoose_2 = require("@nestjs/mongoose");
15
+ let Business = class Business {
16
+ };
17
+ exports.Business = Business;
18
+ __decorate([
19
+ (0, mongoose_2.Prop)({ required: true }),
20
+ __metadata("design:type", String)
21
+ ], Business.prototype, "name", void 0);
22
+ __decorate([
23
+ (0, mongoose_2.Prop)({
24
+ unique: true,
25
+ required: true
26
+ }),
27
+ __metadata("design:type", String)
28
+ ], Business.prototype, "email", void 0);
29
+ __decorate([
30
+ (0, mongoose_2.Prop)({ required: true }),
31
+ __metadata("design:type", String)
32
+ ], Business.prototype, "phoneNumber", void 0);
33
+ __decorate([
34
+ (0, mongoose_2.Prop)(),
35
+ __metadata("design:type", String)
36
+ ], Business.prototype, "website", void 0);
37
+ __decorate([
38
+ (0, mongoose_2.Prop)(),
39
+ __metadata("design:type", String)
40
+ ], Business.prototype, "logo", void 0);
41
+ __decorate([
42
+ (0, mongoose_2.Prop)(),
43
+ __metadata("design:type", String)
44
+ ], Business.prototype, "description", void 0);
45
+ __decorate([
46
+ (0, mongoose_2.Prop)(),
47
+ __metadata("design:type", String)
48
+ ], Business.prototype, "address", void 0);
49
+ __decorate([
50
+ (0, mongoose_2.Prop)(),
51
+ __metadata("design:type", String)
52
+ ], Business.prototype, "city", void 0);
53
+ __decorate([
54
+ (0, mongoose_2.Prop)(),
55
+ __metadata("design:type", String)
56
+ ], Business.prototype, "state", void 0);
57
+ __decorate([
58
+ (0, mongoose_2.Prop)(),
59
+ __metadata("design:type", String)
60
+ ], Business.prototype, "zipCode", void 0);
61
+ __decorate([
62
+ (0, mongoose_2.Prop)(),
63
+ __metadata("design:type", String)
64
+ ], Business.prototype, "country", void 0);
65
+ __decorate([
66
+ (0, mongoose_2.Prop)({
67
+ type: {
68
+ lat: { type: Number },
69
+ lng: { type: Number },
70
+ },
71
+ index: '2dsphere',
72
+ }),
73
+ __metadata("design:type", Object)
74
+ ], Business.prototype, "geolocation", void 0);
75
+ __decorate([
76
+ (0, mongoose_2.Prop)({
77
+ type: mongoose_1.default.Schema.Types.ObjectId, ref: 'Business'
78
+ }),
79
+ __metadata("design:type", Business)
80
+ ], Business.prototype, "Parent", void 0);
81
+ __decorate([
82
+ (0, mongoose_2.Prop)({
83
+ default: false
84
+ }),
85
+ __metadata("design:type", Boolean)
86
+ ], Business.prototype, "isActive", void 0);
87
+ exports.Business = Business = __decorate([
88
+ (0, mongoose_2.Schema)({
89
+ timestamps: true
90
+ })
91
+ ], Business);
92
+ exports.BusinessSchema = mongoose_2.SchemaFactory.createForClass(Business);
93
+ //# sourceMappingURL=business.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"business.schema.js","sourceRoot":"","sources":["../../src/models/business.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsD;AACtD,+CAA+D;AASxD,IAAM,QAAQ,GAAd,MAAM,QAAQ;CA8CpB,CAAA;AA9CY,4BAAQ;AAEnB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACZ;AAIb;IAHC,IAAA,eAAI,EAAC;QACJ,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;KAAE,CAAC;;uCACL;AAEd;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACL;AAEpB;IADC,IAAA,eAAI,GAAE;;yCACS;AAEhB;IADC,IAAA,eAAI,GAAE;;sCACM;AAEb;IADC,IAAA,eAAI,GAAE;;6CACa;AAEpB;IADC,IAAA,eAAI,GAAE;;yCACS;AAEhB;IADC,IAAA,eAAI,GAAE;;sCACM;AAEb;IADC,IAAA,eAAI,GAAE;;uCACO;AAEd;IADC,IAAA,eAAI,GAAE;;yCACS;AAEhB;IADC,IAAA,eAAI,GAAE;;yCACS;AAQhB;IAPC,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE;YACJ,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACrB,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACtB;QACD,KAAK,EAAE,UAAU;KAClB,CAAC;;6CAIA;AAKF;IAHC,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU;KACtD,CAAC;8BACM,QAAQ;wCAAC;AAKjB;IAHC,IAAA,eAAI,EAAC;QACJ,OAAO,EAAE,KAAK;KACf,CAAC;;0CACgB;mBA7CP,QAAQ;IALpB,IAAA,iBAAM,EACL;QACE,UAAU,EAAE,IAAI;KACjB,CACF;GACY,QAAQ,CA8CpB;AAEY,QAAA,cAAc,GAAG,wBAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,104 @@
1
+ import mongoose, { HydratedDocument } from 'mongoose';
2
+ import { Business } from "./business.schema";
3
+ import { User } from "./user.schema";
4
+ export type EmployeeDocument = HydratedDocument<Employee>;
5
+ export declare class Employee {
6
+ business: Business;
7
+ user: User;
8
+ role: string;
9
+ isActive: boolean;
10
+ hireAt: Date;
11
+ address: {
12
+ county?: string;
13
+ city: string;
14
+ street: string;
15
+ building?: string;
16
+ floor?: string;
17
+ apartment?: string;
18
+ zipCode?: string;
19
+ state?: string;
20
+ };
21
+ }
22
+ export declare const EmployeeSchema: mongoose.Schema<Employee, mongoose.Model<Employee, any, any, any, (mongoose.Document<unknown, any, Employee, any, mongoose.DefaultSchemaOptions> & Employee & {
23
+ _id: mongoose.Types.ObjectId;
24
+ } & {
25
+ __v: number;
26
+ } & {
27
+ id: string;
28
+ }) | (mongoose.Document<unknown, any, Employee, any, mongoose.DefaultSchemaOptions> & Employee & {
29
+ _id: mongoose.Types.ObjectId;
30
+ } & {
31
+ __v: number;
32
+ }), any, Employee>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, Employee, mongoose.Document<unknown, {}, Employee, {
33
+ id: string;
34
+ }, mongoose.DefaultSchemaOptions> & Omit<Employee & {
35
+ _id: mongoose.Types.ObjectId;
36
+ } & {
37
+ __v: number;
38
+ }, "id"> & {
39
+ id: string;
40
+ }, {
41
+ business?: mongoose.SchemaDefinitionProperty<Business, Employee, mongoose.Document<unknown, {}, Employee, {
42
+ id: string;
43
+ }, mongoose.DefaultSchemaOptions> & Omit<Employee & {
44
+ _id: mongoose.Types.ObjectId;
45
+ } & {
46
+ __v: number;
47
+ }, "id"> & {
48
+ id: string;
49
+ }>;
50
+ user?: mongoose.SchemaDefinitionProperty<User, Employee, mongoose.Document<unknown, {}, Employee, {
51
+ id: string;
52
+ }, mongoose.DefaultSchemaOptions> & Omit<Employee & {
53
+ _id: mongoose.Types.ObjectId;
54
+ } & {
55
+ __v: number;
56
+ }, "id"> & {
57
+ id: string;
58
+ }>;
59
+ role?: mongoose.SchemaDefinitionProperty<string, Employee, mongoose.Document<unknown, {}, Employee, {
60
+ id: string;
61
+ }, mongoose.DefaultSchemaOptions> & Omit<Employee & {
62
+ _id: mongoose.Types.ObjectId;
63
+ } & {
64
+ __v: number;
65
+ }, "id"> & {
66
+ id: string;
67
+ }>;
68
+ isActive?: mongoose.SchemaDefinitionProperty<boolean, Employee, mongoose.Document<unknown, {}, Employee, {
69
+ id: string;
70
+ }, mongoose.DefaultSchemaOptions> & Omit<Employee & {
71
+ _id: mongoose.Types.ObjectId;
72
+ } & {
73
+ __v: number;
74
+ }, "id"> & {
75
+ id: string;
76
+ }>;
77
+ hireAt?: mongoose.SchemaDefinitionProperty<Date, Employee, mongoose.Document<unknown, {}, Employee, {
78
+ id: string;
79
+ }, mongoose.DefaultSchemaOptions> & Omit<Employee & {
80
+ _id: mongoose.Types.ObjectId;
81
+ } & {
82
+ __v: number;
83
+ }, "id"> & {
84
+ id: string;
85
+ }>;
86
+ address?: mongoose.SchemaDefinitionProperty<{
87
+ county?: string;
88
+ city: string;
89
+ street: string;
90
+ building?: string;
91
+ floor?: string;
92
+ apartment?: string;
93
+ zipCode?: string;
94
+ state?: string;
95
+ }, Employee, mongoose.Document<unknown, {}, Employee, {
96
+ id: string;
97
+ }, mongoose.DefaultSchemaOptions> & Omit<Employee & {
98
+ _id: mongoose.Types.ObjectId;
99
+ } & {
100
+ __v: number;
101
+ }, "id"> & {
102
+ id: string;
103
+ }>;
104
+ }, Employee>;
@@ -0,0 +1,67 @@
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.EmployeeSchema = exports.Employee = void 0;
13
+ const mongoose_1 = require("mongoose");
14
+ const mongoose_2 = require("@nestjs/mongoose");
15
+ const business_schema_1 = require("./business.schema");
16
+ const user_schema_1 = require("./user.schema");
17
+ let Employee = class Employee {
18
+ };
19
+ exports.Employee = Employee;
20
+ __decorate([
21
+ (0, mongoose_2.Prop)({
22
+ type: mongoose_1.default.Schema.Types.ObjectId,
23
+ ref: 'Business',
24
+ required: true,
25
+ index: true,
26
+ }),
27
+ __metadata("design:type", business_schema_1.Business)
28
+ ], Employee.prototype, "business", void 0);
29
+ __decorate([
30
+ (0, mongoose_2.Prop)({
31
+ type: mongoose_1.default.Schema.Types.ObjectId,
32
+ ref: 'User',
33
+ required: true,
34
+ index: true,
35
+ }),
36
+ __metadata("design:type", user_schema_1.User)
37
+ ], Employee.prototype, "user", void 0);
38
+ __decorate([
39
+ (0, mongoose_2.Prop)({
40
+ enum: ['OWNER', 'EMPLOYEE', 'MANAGER', 'PHARMACIST', 'CLERK'],
41
+ default: 'EMPLOYEE',
42
+ }),
43
+ __metadata("design:type", String)
44
+ ], Employee.prototype, "role", void 0);
45
+ __decorate([
46
+ (0, mongoose_2.Prop)({
47
+ default: true,
48
+ }),
49
+ __metadata("design:type", Boolean)
50
+ ], Employee.prototype, "isActive", void 0);
51
+ __decorate([
52
+ (0, mongoose_2.Prop)(),
53
+ __metadata("design:type", Date)
54
+ ], Employee.prototype, "hireAt", void 0);
55
+ __decorate([
56
+ (0, mongoose_2.Prop)({
57
+ type: Object,
58
+ }),
59
+ __metadata("design:type", Object)
60
+ ], Employee.prototype, "address", void 0);
61
+ exports.Employee = Employee = __decorate([
62
+ (0, mongoose_2.Schema)({
63
+ timestamps: true,
64
+ })
65
+ ], Employee);
66
+ exports.EmployeeSchema = mongoose_2.SchemaFactory.createForClass(Employee);
67
+ //# sourceMappingURL=employee.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"employee.schema.js","sourceRoot":"","sources":["../../src/models/employee.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsD;AACtD,+CAA+D;AAC/D,uDAA2C;AAC3C,+CAAmC;AAO5B,IAAM,QAAQ,GAAd,MAAM,QAAQ;CA4CpB,CAAA;AA5CY,4BAAQ;AAOnB;IANC,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;QACpC,GAAG,EAAE,UAAU;QACf,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ,CAAC;8BACQ,0BAAQ;0CAAC;AAOnB;IANC,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;QACpC,GAAG,EAAE,MAAM;QACX,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ,CAAC;8BACI,kBAAI;sCAAC;AAKX;IAJC,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC;QAC7D,OAAO,EAAE,UAAU;KACpB,CAAC;;sCACW;AAOb;IALC,IAAA,eAAI,EACH;QACE,OAAO,EAAE,IAAI;KACd,CACF;;0CACiB;AAGlB;IADC,IAAA,eAAI,GAAE;8BACC,IAAI;wCAAC;AAKb;IAHC,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,MAAM;KACb,CAAC;;yCAUD;mBA3CU,QAAQ;IAHpB,IAAA,iBAAM,EAAC;QACN,UAAU,EAAE,IAAI;KACjB,CAAC;GACW,QAAQ,CA4CpB;AAEY,QAAA,cAAc,GAAG,wBAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,154 @@
1
+ import { HydratedDocument } from 'mongoose';
2
+ export type UserDocument = HydratedDocument<User>;
3
+ export declare class Address {
4
+ county?: string;
5
+ city: string;
6
+ street: string;
7
+ building: string;
8
+ floor?: string;
9
+ apartment?: string;
10
+ zipCode?: string;
11
+ state: string;
12
+ }
13
+ export declare class User {
14
+ email: string;
15
+ phoneNumber?: string;
16
+ emailVerified?: boolean;
17
+ displayName: string;
18
+ photoURL?: string;
19
+ disabled: boolean;
20
+ createdAt: Date;
21
+ updatedAt: Date;
22
+ deletedAt?: Date;
23
+ roles?: string[];
24
+ addresses?: Address;
25
+ uid: string;
26
+ }
27
+ export declare const UserSchema: import("mongoose").Schema<User, import("mongoose").Model<User, any, any, any, (import("mongoose").Document<unknown, any, User, any, import("mongoose").DefaultSchemaOptions> & User & {
28
+ _id: import("mongoose").Types.ObjectId;
29
+ } & {
30
+ __v: number;
31
+ } & {
32
+ id: string;
33
+ }) | (import("mongoose").Document<unknown, any, User, any, import("mongoose").DefaultSchemaOptions> & User & {
34
+ _id: import("mongoose").Types.ObjectId;
35
+ } & {
36
+ __v: number;
37
+ }), any, User>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, import("mongoose").Document<unknown, {}, User, {
38
+ id: string;
39
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
40
+ _id: import("mongoose").Types.ObjectId;
41
+ } & {
42
+ __v: number;
43
+ }, "id"> & {
44
+ id: string;
45
+ }, {
46
+ email?: import("mongoose").SchemaDefinitionProperty<string, User, import("mongoose").Document<unknown, {}, User, {
47
+ id: string;
48
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
49
+ _id: import("mongoose").Types.ObjectId;
50
+ } & {
51
+ __v: number;
52
+ }, "id"> & {
53
+ id: string;
54
+ }>;
55
+ phoneNumber?: import("mongoose").SchemaDefinitionProperty<string, User, import("mongoose").Document<unknown, {}, User, {
56
+ id: string;
57
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
58
+ _id: import("mongoose").Types.ObjectId;
59
+ } & {
60
+ __v: number;
61
+ }, "id"> & {
62
+ id: string;
63
+ }>;
64
+ emailVerified?: import("mongoose").SchemaDefinitionProperty<boolean, User, import("mongoose").Document<unknown, {}, User, {
65
+ id: string;
66
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
67
+ _id: import("mongoose").Types.ObjectId;
68
+ } & {
69
+ __v: number;
70
+ }, "id"> & {
71
+ id: string;
72
+ }>;
73
+ displayName?: import("mongoose").SchemaDefinitionProperty<string, User, import("mongoose").Document<unknown, {}, User, {
74
+ id: string;
75
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
76
+ _id: import("mongoose").Types.ObjectId;
77
+ } & {
78
+ __v: number;
79
+ }, "id"> & {
80
+ id: string;
81
+ }>;
82
+ photoURL?: import("mongoose").SchemaDefinitionProperty<string, User, import("mongoose").Document<unknown, {}, User, {
83
+ id: string;
84
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
85
+ _id: import("mongoose").Types.ObjectId;
86
+ } & {
87
+ __v: number;
88
+ }, "id"> & {
89
+ id: string;
90
+ }>;
91
+ disabled?: import("mongoose").SchemaDefinitionProperty<boolean, User, import("mongoose").Document<unknown, {}, User, {
92
+ id: string;
93
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
94
+ _id: import("mongoose").Types.ObjectId;
95
+ } & {
96
+ __v: number;
97
+ }, "id"> & {
98
+ id: string;
99
+ }>;
100
+ createdAt?: import("mongoose").SchemaDefinitionProperty<Date, User, import("mongoose").Document<unknown, {}, User, {
101
+ id: string;
102
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
103
+ _id: import("mongoose").Types.ObjectId;
104
+ } & {
105
+ __v: number;
106
+ }, "id"> & {
107
+ id: string;
108
+ }>;
109
+ updatedAt?: import("mongoose").SchemaDefinitionProperty<Date, User, import("mongoose").Document<unknown, {}, User, {
110
+ id: string;
111
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
112
+ _id: import("mongoose").Types.ObjectId;
113
+ } & {
114
+ __v: number;
115
+ }, "id"> & {
116
+ id: string;
117
+ }>;
118
+ deletedAt?: import("mongoose").SchemaDefinitionProperty<Date, User, import("mongoose").Document<unknown, {}, User, {
119
+ id: string;
120
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
121
+ _id: import("mongoose").Types.ObjectId;
122
+ } & {
123
+ __v: number;
124
+ }, "id"> & {
125
+ id: string;
126
+ }>;
127
+ roles?: import("mongoose").SchemaDefinitionProperty<string[], User, import("mongoose").Document<unknown, {}, User, {
128
+ id: string;
129
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
130
+ _id: import("mongoose").Types.ObjectId;
131
+ } & {
132
+ __v: number;
133
+ }, "id"> & {
134
+ id: string;
135
+ }>;
136
+ addresses?: import("mongoose").SchemaDefinitionProperty<Address, User, import("mongoose").Document<unknown, {}, User, {
137
+ id: string;
138
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
139
+ _id: import("mongoose").Types.ObjectId;
140
+ } & {
141
+ __v: number;
142
+ }, "id"> & {
143
+ id: string;
144
+ }>;
145
+ uid?: import("mongoose").SchemaDefinitionProperty<string, User, import("mongoose").Document<unknown, {}, User, {
146
+ id: string;
147
+ }, import("mongoose").DefaultSchemaOptions> & Omit<User & {
148
+ _id: import("mongoose").Types.ObjectId;
149
+ } & {
150
+ __v: number;
151
+ }, "id"> & {
152
+ id: string;
153
+ }>;
154
+ }, User>;
@@ -0,0 +1,79 @@
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.UserSchema = exports.User = exports.Address = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ class Address {
15
+ }
16
+ exports.Address = Address;
17
+ let User = class User {
18
+ };
19
+ exports.User = User;
20
+ __decorate([
21
+ (0, mongoose_1.Prop)({
22
+ required: true,
23
+ unique: true,
24
+ }),
25
+ __metadata("design:type", String)
26
+ ], User.prototype, "email", void 0);
27
+ __decorate([
28
+ (0, mongoose_1.Prop)(),
29
+ __metadata("design:type", String)
30
+ ], User.prototype, "phoneNumber", void 0);
31
+ __decorate([
32
+ (0, mongoose_1.Prop)({
33
+ default: false,
34
+ }),
35
+ __metadata("design:type", Boolean)
36
+ ], User.prototype, "emailVerified", void 0);
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ required: true }),
39
+ __metadata("design:type", String)
40
+ ], User.prototype, "displayName", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)(),
43
+ __metadata("design:type", String)
44
+ ], User.prototype, "photoURL", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)(),
47
+ __metadata("design:type", Boolean)
48
+ ], User.prototype, "disabled", void 0);
49
+ __decorate([
50
+ (0, mongoose_1.Prop)(),
51
+ __metadata("design:type", Date)
52
+ ], User.prototype, "createdAt", void 0);
53
+ __decorate([
54
+ (0, mongoose_1.Prop)(),
55
+ __metadata("design:type", Date)
56
+ ], User.prototype, "updatedAt", void 0);
57
+ __decorate([
58
+ (0, mongoose_1.Prop)(),
59
+ __metadata("design:type", Date)
60
+ ], User.prototype, "deletedAt", void 0);
61
+ __decorate([
62
+ (0, mongoose_1.Prop)(),
63
+ __metadata("design:type", Array)
64
+ ], User.prototype, "roles", void 0);
65
+ __decorate([
66
+ (0, mongoose_1.Prop)(),
67
+ __metadata("design:type", Address)
68
+ ], User.prototype, "addresses", void 0);
69
+ __decorate([
70
+ (0, mongoose_1.Prop)(),
71
+ __metadata("design:type", String)
72
+ ], User.prototype, "uid", void 0);
73
+ exports.User = User = __decorate([
74
+ (0, mongoose_1.Schema)({
75
+ timestamps: true,
76
+ })
77
+ ], User);
78
+ exports.UserSchema = mongoose_1.SchemaFactory.createForClass(User);
79
+ //# sourceMappingURL=user.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.schema.js","sourceRoot":"","sources":["../../src/models/user.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA8D;AAK9D,MAAa,OAAO;CASnB;AATD,0BASC;AAKM,IAAM,IAAI,GAAV,MAAM,IAAI;CA8BhB,CAAA;AA9BY,oBAAI;AAKf;IAJC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;KACb,CAAC;;mCACY;AAEd;IADC,IAAA,eAAI,GAAE;;yCACc;AAIrB;IAHC,IAAA,eAAI,EAAC;QACJ,OAAO,EAAE,KAAK;KACf,CAAC;;2CACsB;AAExB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACL;AAEpB;IADC,IAAA,eAAI,GAAE;;sCACW;AAElB;IADC,IAAA,eAAI,GAAE;;sCACW;AAElB;IADC,IAAA,eAAI,GAAE;8BACI,IAAI;uCAAC;AAEhB;IADC,IAAA,eAAI,GAAE;8BACI,IAAI;uCAAC;AAEhB;IADC,IAAA,eAAI,GAAE;8BACK,IAAI;uCAAC;AAEjB;IADC,IAAA,eAAI,GAAE;;mCACU;AAEjB;IADC,IAAA,eAAI,GAAE;8BACK,OAAO;uCAAC;AAEpB;IADC,IAAA,eAAI,GAAE;;iCACK;eA7BD,IAAI;IAHhB,IAAA,iBAAM,EAAC;QACN,UAAU,EAAE,IAAI;KACjB,CAAC;GACW,IAAI,CA8BhB;AAIY,QAAA,UAAU,GAAG,wBAAa,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "world-med-commons",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "build:watch": "tsc --watch"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "devDependencies": {
15
+ "@types/node": "^20.0.0",
16
+ "typescript": "^5.0.0"
17
+ },
18
+ "dependencies": {
19
+ "@nestjs/mongoose": "^11.0.4",
20
+ "mongoose": "^9.2.4"
21
+ }
22
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './models/business.schema';
2
+ export * from './models/user.schema';
3
+ export * from './models/employee.schema';
@@ -0,0 +1,59 @@
1
+ import mongoose, { HydratedDocument } from 'mongoose';
2
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
3
+
4
+ export type BusinessDocument = HydratedDocument<Business>;
5
+
6
+ @Schema(
7
+ {
8
+ timestamps: true
9
+ }
10
+ )
11
+ export class Business {
12
+ @Prop({ required: true })
13
+ name: string;
14
+ @Prop({
15
+ unique: true,
16
+ required: true })
17
+ email: string;
18
+ @Prop({ required: true })
19
+ phoneNumber: string;
20
+ @Prop()
21
+ website: string;
22
+ @Prop()
23
+ logo: string;
24
+ @Prop()
25
+ description: string;
26
+ @Prop()
27
+ address: string;
28
+ @Prop()
29
+ city: string;
30
+ @Prop()
31
+ state: string;
32
+ @Prop()
33
+ zipCode: string;
34
+ @Prop()
35
+ country: string;
36
+ @Prop({
37
+ type: {
38
+ lat: { type: Number },
39
+ lng: { type: Number },
40
+ },
41
+ index: '2dsphere',
42
+ })
43
+ geolocation: {
44
+ lat: number;
45
+ lng: number;
46
+ };
47
+
48
+ @Prop({
49
+ type: mongoose.Schema.Types.ObjectId, ref: 'Business'
50
+ })
51
+ Parent: Business;
52
+
53
+ @Prop({
54
+ default: false
55
+ })
56
+ isActive: boolean;
57
+ }
58
+
59
+ export const BusinessSchema = SchemaFactory.createForClass(Business);
@@ -0,0 +1,57 @@
1
+ import mongoose, { HydratedDocument } from 'mongoose';
2
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
3
+ import {Business} from "./business.schema";
4
+ import {User} from "./user.schema";
5
+
6
+ export type EmployeeDocument = HydratedDocument<Employee>;
7
+
8
+ @Schema({
9
+ timestamps: true,
10
+ })
11
+ export class Employee {
12
+ @Prop({
13
+ type: mongoose.Schema.Types.ObjectId,
14
+ ref: 'Business',
15
+ required: true,
16
+ index: true,
17
+ })
18
+ business: Business;
19
+ @Prop({
20
+ type: mongoose.Schema.Types.ObjectId,
21
+ ref: 'User',
22
+ required: true,
23
+ index: true,
24
+ })
25
+ user: User;
26
+ @Prop({
27
+ enum: ['OWNER', 'EMPLOYEE', 'MANAGER', 'PHARMACIST', 'CLERK'],
28
+ default: 'EMPLOYEE',
29
+ })
30
+ role: string;
31
+
32
+ @Prop(
33
+ {
34
+ default: true,
35
+ }
36
+ )
37
+ isActive: boolean;
38
+
39
+ @Prop()
40
+ hireAt: Date;
41
+
42
+ @Prop({
43
+ type: Object,
44
+ })
45
+ address: {
46
+ county?: string;
47
+ city: string;
48
+ street: string;
49
+ building?: string;
50
+ floor?: string;
51
+ apartment?: string;
52
+ zipCode?: string;
53
+ state?: string;
54
+ }
55
+ }
56
+
57
+ export const EmployeeSchema = SchemaFactory.createForClass(Employee);
@@ -0,0 +1,54 @@
1
+ import { Prop, SchemaFactory, Schema} from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+
4
+ export type UserDocument = HydratedDocument<User>;
5
+
6
+ export class Address {
7
+ county?: string;
8
+ city: string;
9
+ street: string;
10
+ building: string;
11
+ floor?: string;
12
+ apartment?: string;
13
+ zipCode?: string;
14
+ state: string;
15
+ }
16
+
17
+ @Schema({
18
+ timestamps: true,
19
+ })
20
+ export class User {
21
+ @Prop({
22
+ required: true,
23
+ unique: true,
24
+ })
25
+ email: string;
26
+ @Prop()
27
+ phoneNumber?: string;
28
+ @Prop({
29
+ default: false,
30
+ })
31
+ emailVerified?: boolean;
32
+ @Prop({ required: true })
33
+ displayName: string;
34
+ @Prop()
35
+ photoURL?: string;
36
+ @Prop()
37
+ disabled: boolean;
38
+ @Prop()
39
+ createdAt: Date;
40
+ @Prop()
41
+ updatedAt: Date;
42
+ @Prop()
43
+ deletedAt?: Date;
44
+ @Prop()
45
+ roles?: string[];
46
+ @Prop()
47
+ addresses?: Address;
48
+ @Prop()
49
+ uid: string;
50
+ }
51
+
52
+
53
+
54
+ export const UserSchema = SchemaFactory.createForClass(User);
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "declaration": true,
5
+ "removeComments": true,
6
+ "emitDecoratorMetadata": true,
7
+ "experimentalDecorators": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "target": "ES2021",
10
+ "sourceMap": true,
11
+ "outDir": "./dist",
12
+ "rootDir": "./src",
13
+ "strict": false,
14
+ "skipLibCheck": true
15
+ },
16
+ "include": ["src/**/*"],
17
+ "exclude": ["node_modules", "dist"]
18
+ }