world-med-commons 1.0.1 → 1.0.2

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
@@ -8,3 +8,4 @@ export * from './models/drug.schema';
8
8
  export * from './models/drug-variant.schema';
9
9
  export * from './models/business-inventory.schema';
10
10
  export * from './models/patient.schema';
11
+ export * from './models/suppliers.schema';
package/dist/index.js CHANGED
@@ -24,4 +24,5 @@ __exportStar(require("./models/drug.schema"), exports);
24
24
  __exportStar(require("./models/drug-variant.schema"), exports);
25
25
  __exportStar(require("./models/business-inventory.schema"), exports);
26
26
  __exportStar(require("./models/patient.schema"), exports);
27
+ __exportStar(require("./models/suppliers.schema"), exports);
27
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,uDAAqC;AACrC,2DAAyC;AACzC,0DAAwC;AACxC,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AACrC,+DAA6C;AAC7C,qEAAmD;AACnD,0DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,uDAAqC;AACrC,2DAAyC;AACzC,0DAAwC;AACxC,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AACrC,+DAA6C;AAC7C,qEAAmD;AACnD,0DAAwC;AACxC,4DAAyC"}
@@ -1,9 +1,10 @@
1
1
  import mongoose, { Document, HydratedDocument, Types } from 'mongoose';
2
2
  import { Business } from "./business.schema";
3
3
  import { DrugVariant } from "./drug-variant.schema";
4
- declare class Batch {
4
+ export declare class Batch {
5
5
  batchNumber: string;
6
6
  expiryDate: Date;
7
+ manufacturingDate: Date;
7
8
  quantity: number;
8
9
  costPrice?: number;
9
10
  sellingPrice?: number;
@@ -19,6 +20,9 @@ export declare class PharmacyInventory extends Document {
19
20
  barcode?: string;
20
21
  taxRate?: number;
21
22
  notes?: string;
23
+ isDeleted: boolean;
24
+ modifiedBy: string;
25
+ minimumQuantityThreshold: number;
22
26
  }
23
27
  export declare const BusinessInventorySchema: mongoose.Schema<PharmacyInventory, mongoose.Model<PharmacyInventory, any, any, any, (mongoose.Document<unknown, any, PharmacyInventory, any, mongoose.DefaultSchemaOptions> & PharmacyInventory & Required<{
24
28
  _id: Types.ObjectId;
@@ -66,6 +70,15 @@ export declare const BusinessInventorySchema: mongoose.Schema<PharmacyInventory,
66
70
  }, "id"> & {
67
71
  id: string;
68
72
  }>;
73
+ minimumQuantityThreshold?: mongoose.SchemaDefinitionProperty<number, PharmacyInventory, mongoose.Document<unknown, {}, PharmacyInventory, {
74
+ id: string;
75
+ }, mongoose.DefaultSchemaOptions> & Omit<PharmacyInventory & Required<{
76
+ _id: Types.ObjectId;
77
+ }> & {
78
+ __v: number;
79
+ }, "id"> & {
80
+ id: string;
81
+ }>;
69
82
  variant?: mongoose.SchemaDefinitionProperty<DrugVariant, PharmacyInventory, mongoose.Document<unknown, {}, PharmacyInventory, {
70
83
  id: string;
71
84
  }, mongoose.DefaultSchemaOptions> & Omit<PharmacyInventory & Required<{
@@ -111,5 +124,22 @@ export declare const BusinessInventorySchema: mongoose.Schema<PharmacyInventory,
111
124
  }, "id"> & {
112
125
  id: string;
113
126
  }>;
127
+ isDeleted?: mongoose.SchemaDefinitionProperty<boolean, PharmacyInventory, mongoose.Document<unknown, {}, PharmacyInventory, {
128
+ id: string;
129
+ }, mongoose.DefaultSchemaOptions> & Omit<PharmacyInventory & Required<{
130
+ _id: Types.ObjectId;
131
+ }> & {
132
+ __v: number;
133
+ }, "id"> & {
134
+ id: string;
135
+ }>;
136
+ modifiedBy?: mongoose.SchemaDefinitionProperty<string, PharmacyInventory, mongoose.Document<unknown, {}, PharmacyInventory, {
137
+ id: string;
138
+ }, mongoose.DefaultSchemaOptions> & Omit<PharmacyInventory & Required<{
139
+ _id: Types.ObjectId;
140
+ }> & {
141
+ __v: number;
142
+ }, "id"> & {
143
+ id: string;
144
+ }>;
114
145
  }, PharmacyInventory>;
115
- export {};
@@ -9,22 +9,57 @@ 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.BusinessInventorySchema = exports.PharmacyInventory = void 0;
12
+ exports.BusinessInventorySchema = exports.PharmacyInventory = exports.Batch = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
15
  const business_schema_1 = require("./business.schema");
16
16
  const drug_variant_schema_1 = require("./drug-variant.schema");
17
17
  class Batch {
18
18
  }
19
+ exports.Batch = Batch;
20
+ __decorate([
21
+ (0, mongoose_1.Prop)({ required: true }),
22
+ __metadata("design:type", String)
23
+ ], Batch.prototype, "batchNumber", void 0);
24
+ __decorate([
25
+ (0, mongoose_1.Prop)({ required: false }),
26
+ __metadata("design:type", Date)
27
+ ], Batch.prototype, "expiryDate", void 0);
28
+ __decorate([
29
+ (0, mongoose_1.Prop)({ required: true }),
30
+ __metadata("design:type", Date)
31
+ ], Batch.prototype, "manufacturingDate", void 0);
32
+ __decorate([
33
+ (0, mongoose_1.Prop)({ required: true }),
34
+ __metadata("design:type", Number)
35
+ ], Batch.prototype, "quantity", void 0);
36
+ __decorate([
37
+ (0, mongoose_1.Prop)(),
38
+ __metadata("design:type", Number)
39
+ ], Batch.prototype, "costPrice", void 0);
40
+ __decorate([
41
+ (0, mongoose_1.Prop)(),
42
+ __metadata("design:type", Number)
43
+ ], Batch.prototype, "sellingPrice", void 0);
44
+ __decorate([
45
+ (0, mongoose_1.Prop)(),
46
+ __metadata("design:type", Date)
47
+ ], Batch.prototype, "receivedDate", void 0);
48
+ __decorate([
49
+ (0, mongoose_1.Prop)({ type: mongoose_2.default.Schema.Types.ObjectId, ref: 'Supplier', required: true }),
50
+ __metadata("design:type", String)
51
+ ], Batch.prototype, "supplier", void 0);
19
52
  let PharmacyInventory = class PharmacyInventory extends mongoose_2.Document {
20
53
  };
21
54
  exports.PharmacyInventory = PharmacyInventory;
22
55
  __decorate([
23
- (0, mongoose_1.Prop)({ type: mongoose_2.default.Schema.Types.ObjectId, ref: 'Business', required: true, index: true }),
56
+ (0, mongoose_1.Prop)({ type: mongoose_2.default.Schema.Types.ObjectId,
57
+ ref: 'Business', required: true, index: true }),
24
58
  __metadata("design:type", business_schema_1.Business)
25
59
  ], PharmacyInventory.prototype, "business", void 0);
26
60
  __decorate([
27
- (0, mongoose_1.Prop)({ type: mongoose_2.default.Schema.Types.ObjectId, ref: 'DrugVariant', required: true, index: true }),
61
+ (0, mongoose_1.Prop)({ type: mongoose_2.default.Schema.Types.ObjectId,
62
+ ref: 'DrugVariant', required: true, index: true }),
28
63
  __metadata("design:type", drug_variant_schema_1.DrugVariant)
29
64
  ], PharmacyInventory.prototype, "variant", void 0);
30
65
  __decorate([
@@ -47,9 +82,20 @@ __decorate([
47
82
  (0, mongoose_1.Prop)(),
48
83
  __metadata("design:type", String)
49
84
  ], PharmacyInventory.prototype, "notes", void 0);
85
+ __decorate([
86
+ (0, mongoose_1.Prop)({ default: false }),
87
+ __metadata("design:type", Boolean)
88
+ ], PharmacyInventory.prototype, "isDeleted", void 0);
89
+ __decorate([
90
+ (0, mongoose_1.Prop)({ required: true }),
91
+ __metadata("design:type", String)
92
+ ], PharmacyInventory.prototype, "modifiedBy", void 0);
93
+ __decorate([
94
+ (0, mongoose_1.Prop)({ required: true, default: 5 }),
95
+ __metadata("design:type", Number)
96
+ ], PharmacyInventory.prototype, "minimumQuantityThreshold", void 0);
50
97
  exports.PharmacyInventory = PharmacyInventory = __decorate([
51
98
  (0, mongoose_1.Schema)({ timestamps: true })
52
99
  ], PharmacyInventory);
53
100
  exports.BusinessInventorySchema = mongoose_1.SchemaFactory.createForClass(PharmacyInventory);
54
- exports.BusinessInventorySchema.index({ pharmacy: 1, variant: 1 }, { unique: true });
55
101
  //# sourceMappingURL=business-inventory.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"business-inventory.schema.js","sourceRoot":"","sources":["../../src/models/business-inventory.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,uCAAqE;AACrE,uDAA2C;AAC3C,+DAAkD;AAElD,MAAM,KAAK;CAQV;AAKM,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,mBAAQ;CAuB9C,CAAA;AAvBY,8CAAiB;AAE5B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;8BACnF,0BAAQ;mDAAC;AAGnB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;8BACvF,iCAAW;kDAAC;AAIrB;IADC,IAAA,eAAI,GAAE;8BACA,KAAK;gDAAC;AAGb;IADC,IAAA,eAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACK;AAG1B;IADC,IAAA,eAAI,GAAE;;kDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;kDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;gDACQ;4BArBJ,iBAAiB;IAD7B,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;GAChB,iBAAiB,CAuB7B;AAEY,QAAA,uBAAuB,GAAG,wBAAa,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;AAEvF,+BAAuB,CAAC,KAA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eAAI,EAAC,EAAE,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;QAC1C,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;8BAC3C,iCAAW;kDAAC;AAIrB;IADC,IAAA,eAAI,GAAE;8BACA,KAAK;gDAAC;AAGb;IADC,IAAA,eAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACK;AAG1B;IADC,IAAA,eAAI,GAAE;;kDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;kDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;gDACQ;AAGf;IADC,IAAA,eAAI,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;oDACN;AAGnB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAGnB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC;;mEACH;4BAhCtB,iBAAiB;IAD7B,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;GAChB,iBAAiB,CAkC7B;AAEY,QAAA,uBAAuB,GAAG,wBAAa,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import mongoose, { HydratedDocument } from 'mongoose';
2
2
  import { Patient } from "./patient.schema";
3
3
  import { Employee } from "./employee.schema";
4
+ import { Supplier } from "./suppliers.schema";
4
5
  export type BusinessDocument = HydratedDocument<Business>;
5
6
  export declare class Business {
6
7
  name: string;
@@ -21,6 +22,9 @@ export declare class Business {
21
22
  Parent: Business;
22
23
  employees?: Employee[];
23
24
  patients?: Patient[];
25
+ suppliers?: Supplier[];
26
+ currencyCode: string;
27
+ minimumQuantityThreshold: number;
24
28
  }
25
29
  export declare const BusinessSchema: mongoose.Schema<Business, mongoose.Model<Business, any, any, any, (mongoose.Document<unknown, any, Business, any, mongoose.DefaultSchemaOptions> & Business & {
26
30
  _id: mongoose.Types.ObjectId;
@@ -179,4 +183,31 @@ export declare const BusinessSchema: mongoose.Schema<Business, mongoose.Model<Bu
179
183
  }, "id"> & {
180
184
  id: string;
181
185
  }>;
186
+ suppliers?: mongoose.SchemaDefinitionProperty<Supplier[], Business, mongoose.Document<unknown, {}, Business, {
187
+ id: string;
188
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
189
+ _id: mongoose.Types.ObjectId;
190
+ } & {
191
+ __v: number;
192
+ }, "id"> & {
193
+ id: string;
194
+ }>;
195
+ currencyCode?: mongoose.SchemaDefinitionProperty<string, Business, mongoose.Document<unknown, {}, Business, {
196
+ id: string;
197
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
198
+ _id: mongoose.Types.ObjectId;
199
+ } & {
200
+ __v: number;
201
+ }, "id"> & {
202
+ id: string;
203
+ }>;
204
+ minimumQuantityThreshold?: mongoose.SchemaDefinitionProperty<number, Business, mongoose.Document<unknown, {}, Business, {
205
+ id: string;
206
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
207
+ _id: mongoose.Types.ObjectId;
208
+ } & {
209
+ __v: number;
210
+ }, "id"> & {
211
+ id: string;
212
+ }>;
182
213
  }, Business>;
@@ -86,6 +86,18 @@ __decorate([
86
86
  (0, mongoose_2.Prop)({ type: [{ type: mongoose_1.default.Schema.Types.ObjectId, ref: 'Patient' }] }),
87
87
  __metadata("design:type", Array)
88
88
  ], Business.prototype, "patients", void 0);
89
+ __decorate([
90
+ (0, mongoose_2.Prop)({ type: [{ type: mongoose_1.default.Schema.Types.ObjectId, ref: 'Supplier' }] }),
91
+ __metadata("design:type", Array)
92
+ ], Business.prototype, "suppliers", void 0);
93
+ __decorate([
94
+ (0, mongoose_2.Prop)({ required: true }),
95
+ __metadata("design:type", String)
96
+ ], Business.prototype, "currencyCode", void 0);
97
+ __decorate([
98
+ (0, mongoose_2.Prop)({ required: false, default: 5 }),
99
+ __metadata("design:type", Number)
100
+ ], Business.prototype, "minimumQuantityThreshold", void 0);
89
101
  exports.Business = Business = __decorate([
90
102
  (0, mongoose_2.Schema)({
91
103
  timestamps: true
@@ -1 +1 @@
1
- {"version":3,"file":"business.schema.js","sourceRoot":"","sources":["../../src/models/business.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsD;AACtD,+CAA+D;AAWxD,IAAM,QAAQ,GAAd,MAAM,QAAQ;CA+CpB,CAAA;AA/CY,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;AAGjB;I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  import mongoose, { Document, HydratedDocument } from 'mongoose';
2
2
  import { Drug } from "./drug.schema";
3
+ import { PharmacyInventory } from "./business-inventory.schema";
3
4
  export type DrugVariantDocument = HydratedDocument<DrugVariant>;
4
5
  export declare class DrugVariant extends Document {
5
6
  drug: Drug;
@@ -9,6 +10,7 @@ export declare class DrugVariant extends Document {
9
10
  form: string;
10
11
  packageSize?: string;
11
12
  ndc?: string;
13
+ pharmacyInventory: PharmacyInventory[];
12
14
  }
13
15
  export declare const DrugVariantSchema: mongoose.Schema<DrugVariant, mongoose.Model<DrugVariant, any, any, any, (mongoose.Document<unknown, any, DrugVariant, any, mongoose.DefaultSchemaOptions> & DrugVariant & Required<{
14
16
  _id: mongoose.Types.ObjectId;
@@ -101,4 +103,13 @@ export declare const DrugVariantSchema: mongoose.Schema<DrugVariant, mongoose.Mo
101
103
  }, "id"> & {
102
104
  id: string;
103
105
  }>;
106
+ pharmacyInventory?: mongoose.SchemaDefinitionProperty<PharmacyInventory[], DrugVariant, mongoose.Document<unknown, {}, DrugVariant, {
107
+ id: string;
108
+ }, mongoose.DefaultSchemaOptions> & Omit<DrugVariant & Required<{
109
+ _id: mongoose.Types.ObjectId;
110
+ }> & {
111
+ __v: number;
112
+ }, "id"> & {
113
+ id: string;
114
+ }>;
104
115
  }, DrugVariant>;
@@ -49,6 +49,12 @@ __decorate([
49
49
  (0, mongoose_1.Prop)({ unique: true, sparse: true }),
50
50
  __metadata("design:type", String)
51
51
  ], DrugVariant.prototype, "ndc", void 0);
52
+ __decorate([
53
+ (0, mongoose_1.Prop)({
54
+ type: [{ type: mongoose_2.default.Schema.Types.ObjectId, ref: 'PharmacyInventory' }]
55
+ }),
56
+ __metadata("design:type", Array)
57
+ ], DrugVariant.prototype, "pharmacyInventory", void 0);
52
58
  exports.DrugVariant = DrugVariant = __decorate([
53
59
  (0, mongoose_1.Schema)({ timestamps: true })
54
60
  ], DrugVariant);
@@ -1 +1 @@
1
- {"version":3,"file":"drug-variant.schema.js","sourceR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;gDACc;AAGrB;IADC,IAAA,eAAI,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;wCACxB;AAKb;IAHC,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC;KAC3E,CAAC;;sDACoC;sBA9B3B,WAAW;IADvB,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;GAChB,WAAW,CAiCvB;AAEY,QAAA,iBAAiB,GAAG,wBAAa,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;AAG3E,yBAAiB,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9F,yBAAiB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC"}
@@ -1,70 +1,81 @@
1
- import { Document, HydratedDocument } from 'mongoose';
1
+ import mongoose, { Document, HydratedDocument } from 'mongoose';
2
+ import { DrugVariant } from "./drug-variant.schema";
2
3
  export type DrugDocument = HydratedDocument<Drug>;
3
4
  export declare class Drug extends Document {
4
5
  genericName: string;
5
6
  atcCode?: string;
6
- therapeuticClass?: string;
7
+ therapeuticClass?: string[];
7
8
  commonSideEffects?: string[];
9
+ variants: DrugVariant[];
8
10
  }
9
- export declare const DrugSchema: import("mongoose").Schema<Drug, import("mongoose").Model<Drug, any, any, any, (Document<unknown, any, Drug, any, import("mongoose").DefaultSchemaOptions> & Drug & Required<{
10
- _id: import("mongoose").Types.ObjectId;
11
+ export declare const DrugSchema: mongoose.Schema<Drug, mongoose.Model<Drug, any, any, any, (mongoose.Document<unknown, any, Drug, any, mongoose.DefaultSchemaOptions> & Drug & Required<{
12
+ _id: mongoose.Types.ObjectId;
11
13
  }> & {
12
14
  __v: number;
13
15
  } & {
14
16
  id: string;
15
- }) | (Document<unknown, any, Drug, any, import("mongoose").DefaultSchemaOptions> & Drug & Required<{
16
- _id: import("mongoose").Types.ObjectId;
17
+ }) | (mongoose.Document<unknown, any, Drug, any, mongoose.DefaultSchemaOptions> & Drug & Required<{
18
+ _id: mongoose.Types.ObjectId;
17
19
  }> & {
18
20
  __v: number;
19
- }), any, Drug>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Drug, Document<unknown, {}, Drug, {
21
+ }), any, Drug>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, Drug, mongoose.Document<unknown, {}, Drug, {
20
22
  id: string;
21
- }, import("mongoose").DefaultSchemaOptions> & Omit<Drug & Required<{
22
- _id: import("mongoose").Types.ObjectId;
23
+ }, mongoose.DefaultSchemaOptions> & Omit<Drug & Required<{
24
+ _id: mongoose.Types.ObjectId;
23
25
  }> & {
24
26
  __v: number;
25
27
  }, "id"> & {
26
28
  id: string;
27
29
  }, {
28
- _id?: import("mongoose").SchemaDefinitionProperty<import("mongoose").Types.ObjectId, Drug, Document<unknown, {}, Drug, {
30
+ _id?: mongoose.SchemaDefinitionProperty<mongoose.Types.ObjectId, Drug, mongoose.Document<unknown, {}, Drug, {
29
31
  id: string;
30
- }, import("mongoose").DefaultSchemaOptions> & Omit<Drug & Required<{
31
- _id: import("mongoose").Types.ObjectId;
32
+ }, mongoose.DefaultSchemaOptions> & Omit<Drug & Required<{
33
+ _id: mongoose.Types.ObjectId;
32
34
  }> & {
33
35
  __v: number;
34
36
  }, "id"> & {
35
37
  id: string;
36
38
  }>;
37
- genericName?: import("mongoose").SchemaDefinitionProperty<string, Drug, Document<unknown, {}, Drug, {
39
+ genericName?: mongoose.SchemaDefinitionProperty<string, Drug, mongoose.Document<unknown, {}, Drug, {
38
40
  id: string;
39
- }, import("mongoose").DefaultSchemaOptions> & Omit<Drug & Required<{
40
- _id: import("mongoose").Types.ObjectId;
41
+ }, mongoose.DefaultSchemaOptions> & Omit<Drug & Required<{
42
+ _id: mongoose.Types.ObjectId;
41
43
  }> & {
42
44
  __v: number;
43
45
  }, "id"> & {
44
46
  id: string;
45
47
  }>;
46
- atcCode?: import("mongoose").SchemaDefinitionProperty<string, Drug, Document<unknown, {}, Drug, {
48
+ atcCode?: mongoose.SchemaDefinitionProperty<string, Drug, mongoose.Document<unknown, {}, Drug, {
47
49
  id: string;
48
- }, import("mongoose").DefaultSchemaOptions> & Omit<Drug & Required<{
49
- _id: import("mongoose").Types.ObjectId;
50
+ }, mongoose.DefaultSchemaOptions> & Omit<Drug & Required<{
51
+ _id: mongoose.Types.ObjectId;
50
52
  }> & {
51
53
  __v: number;
52
54
  }, "id"> & {
53
55
  id: string;
54
56
  }>;
55
- therapeuticClass?: import("mongoose").SchemaDefinitionProperty<string, Drug, Document<unknown, {}, Drug, {
57
+ therapeuticClass?: mongoose.SchemaDefinitionProperty<string[], Drug, mongoose.Document<unknown, {}, Drug, {
56
58
  id: string;
57
- }, import("mongoose").DefaultSchemaOptions> & Omit<Drug & Required<{
58
- _id: import("mongoose").Types.ObjectId;
59
+ }, mongoose.DefaultSchemaOptions> & Omit<Drug & Required<{
60
+ _id: mongoose.Types.ObjectId;
59
61
  }> & {
60
62
  __v: number;
61
63
  }, "id"> & {
62
64
  id: string;
63
65
  }>;
64
- commonSideEffects?: import("mongoose").SchemaDefinitionProperty<string[], Drug, Document<unknown, {}, Drug, {
66
+ commonSideEffects?: mongoose.SchemaDefinitionProperty<string[], Drug, mongoose.Document<unknown, {}, Drug, {
65
67
  id: string;
66
- }, import("mongoose").DefaultSchemaOptions> & Omit<Drug & Required<{
67
- _id: import("mongoose").Types.ObjectId;
68
+ }, mongoose.DefaultSchemaOptions> & Omit<Drug & Required<{
69
+ _id: mongoose.Types.ObjectId;
70
+ }> & {
71
+ __v: number;
72
+ }, "id"> & {
73
+ id: string;
74
+ }>;
75
+ variants?: mongoose.SchemaDefinitionProperty<DrugVariant[], Drug, mongoose.Document<unknown, {}, Drug, {
76
+ id: string;
77
+ }, mongoose.DefaultSchemaOptions> & Omit<Drug & Required<{
78
+ _id: mongoose.Types.ObjectId;
68
79
  }> & {
69
80
  __v: number;
70
81
  }, "id"> & {
@@ -24,13 +24,17 @@ __decorate([
24
24
  __metadata("design:type", String)
25
25
  ], Drug.prototype, "atcCode", void 0);
26
26
  __decorate([
27
- (0, mongoose_1.Prop)(),
28
- __metadata("design:type", String)
27
+ (0, mongoose_1.Prop)({ type: [String], default: [] }),
28
+ __metadata("design:type", Array)
29
29
  ], Drug.prototype, "therapeuticClass", void 0);
30
30
  __decorate([
31
31
  (0, mongoose_1.Prop)({ type: [String], default: [] }),
32
32
  __metadata("design:type", Array)
33
33
  ], Drug.prototype, "commonSideEffects", void 0);
34
+ __decorate([
35
+ (0, mongoose_1.Prop)({ type: [{ type: mongoose_2.default.Schema.Types.ObjectId, ref: 'DrugVariant' }] }),
36
+ __metadata("design:type", Array)
37
+ ], Drug.prototype, "variants", void 0);
34
38
  exports.Drug = Drug = __decorate([
35
39
  (0, mongoose_1.Schema)({ timestamps: true })
36
40
  ], Drug);
@@ -1 +1 @@
1
- {"version":3,"file":"drug.schema.js","sourceRoot":"","sources":["../../src/models/drug.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,uCAAoD;AAK7C,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,mBAAQ;CAYjC,CAAA;AAZY,oBAAI;AAEf;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;yCAChC;AAGpB;IADC,IAAA,eAAI,GAAE;;qCACU;AAGjB;IADC,IAAA,eAAI,GAAE;;8CACmB;AAG1B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE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AK,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { HydratedDocument, Types } from "mongoose";
2
+ import { Address } from "./user.schema";
3
+ export type SuppliersDocument = HydratedDocument<Supplier>;
4
+ export declare class Supplier {
5
+ name: string;
6
+ address?: Address;
7
+ email?: string;
8
+ phoneNumber?: string;
9
+ website?: string;
10
+ business: Types.ObjectId;
11
+ }
12
+ export declare const SupplierSchema: import("mongoose").Schema<Supplier, import("mongoose").Model<Supplier, any, any, any, (import("mongoose").Document<unknown, any, Supplier, any, import("mongoose").DefaultSchemaOptions> & Supplier & {
13
+ _id: Types.ObjectId;
14
+ } & {
15
+ __v: number;
16
+ } & {
17
+ id: string;
18
+ }) | (import("mongoose").Document<unknown, any, Supplier, any, import("mongoose").DefaultSchemaOptions> & Supplier & {
19
+ _id: Types.ObjectId;
20
+ } & {
21
+ __v: number;
22
+ }), any, Supplier>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Supplier, import("mongoose").Document<unknown, {}, Supplier, {
23
+ id: string;
24
+ }, import("mongoose").DefaultSchemaOptions> & Omit<Supplier & {
25
+ _id: Types.ObjectId;
26
+ } & {
27
+ __v: number;
28
+ }, "id"> & {
29
+ id: string;
30
+ }, {
31
+ name?: import("mongoose").SchemaDefinitionProperty<string, Supplier, import("mongoose").Document<unknown, {}, Supplier, {
32
+ id: string;
33
+ }, import("mongoose").DefaultSchemaOptions> & Omit<Supplier & {
34
+ _id: Types.ObjectId;
35
+ } & {
36
+ __v: number;
37
+ }, "id"> & {
38
+ id: string;
39
+ }>;
40
+ address?: import("mongoose").SchemaDefinitionProperty<Address, Supplier, import("mongoose").Document<unknown, {}, Supplier, {
41
+ id: string;
42
+ }, import("mongoose").DefaultSchemaOptions> & Omit<Supplier & {
43
+ _id: Types.ObjectId;
44
+ } & {
45
+ __v: number;
46
+ }, "id"> & {
47
+ id: string;
48
+ }>;
49
+ email?: import("mongoose").SchemaDefinitionProperty<string, Supplier, import("mongoose").Document<unknown, {}, Supplier, {
50
+ id: string;
51
+ }, import("mongoose").DefaultSchemaOptions> & Omit<Supplier & {
52
+ _id: Types.ObjectId;
53
+ } & {
54
+ __v: number;
55
+ }, "id"> & {
56
+ id: string;
57
+ }>;
58
+ phoneNumber?: import("mongoose").SchemaDefinitionProperty<string, Supplier, import("mongoose").Document<unknown, {}, Supplier, {
59
+ id: string;
60
+ }, import("mongoose").DefaultSchemaOptions> & Omit<Supplier & {
61
+ _id: Types.ObjectId;
62
+ } & {
63
+ __v: number;
64
+ }, "id"> & {
65
+ id: string;
66
+ }>;
67
+ website?: import("mongoose").SchemaDefinitionProperty<string, Supplier, import("mongoose").Document<unknown, {}, Supplier, {
68
+ id: string;
69
+ }, import("mongoose").DefaultSchemaOptions> & Omit<Supplier & {
70
+ _id: Types.ObjectId;
71
+ } & {
72
+ __v: number;
73
+ }, "id"> & {
74
+ id: string;
75
+ }>;
76
+ business?: import("mongoose").SchemaDefinitionProperty<Types.ObjectId, Supplier, import("mongoose").Document<unknown, {}, Supplier, {
77
+ id: string;
78
+ }, import("mongoose").DefaultSchemaOptions> & Omit<Supplier & {
79
+ _id: Types.ObjectId;
80
+ } & {
81
+ __v: number;
82
+ }, "id"> & {
83
+ id: string;
84
+ }>;
85
+ }, Supplier>;
@@ -0,0 +1,49 @@
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.SupplierSchema = exports.Supplier = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const user_schema_1 = require("./user.schema");
16
+ let Supplier = class Supplier {
17
+ };
18
+ exports.Supplier = Supplier;
19
+ __decorate([
20
+ (0, mongoose_1.Prop)({ required: true }),
21
+ __metadata("design:type", String)
22
+ ], Supplier.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, mongoose_1.Prop)(),
25
+ __metadata("design:type", user_schema_1.Address)
26
+ ], Supplier.prototype, "address", void 0);
27
+ __decorate([
28
+ (0, mongoose_1.Prop)(),
29
+ __metadata("design:type", String)
30
+ ], Supplier.prototype, "email", void 0);
31
+ __decorate([
32
+ (0, mongoose_1.Prop)(),
33
+ __metadata("design:type", String)
34
+ ], Supplier.prototype, "phoneNumber", void 0);
35
+ __decorate([
36
+ (0, mongoose_1.Prop)(),
37
+ __metadata("design:type", String)
38
+ ], Supplier.prototype, "website", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: 'Business', required: true, index: true }),
41
+ __metadata("design:type", mongoose_2.Types.ObjectId)
42
+ ], Supplier.prototype, "business", void 0);
43
+ exports.Supplier = Supplier = __decorate([
44
+ (0, mongoose_1.Schema)({
45
+ timestamps: true
46
+ })
47
+ ], Supplier);
48
+ exports.SupplierSchema = mongoose_1.SchemaFactory.createForClass(Supplier);
49
+ //# sourceMappingURL=suppliers.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suppliers.schema.js","sourceRoot":"","sources":["../../src/models/suppliers.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6D;AAC7D,uCAAiD;AACjD,+CAAsC;AAO/B,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAepB,CAAA;AAfY,4BAAQ;AAGnB;IADC,IAAA,eAAI,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;;sCACV;AAEb;IADC,IAAA,eAAI,GAAE;8BACG,qBAAO;yCAAC;AAElB;IADC,IAAA,eAAI,GAAE;;uCACQ;AAEf;IADC,IAAA,eAAI,GAAE;;6CACc;AAErB;IADC,IAAA,eAAI,GAAE;;yCACU;AAGjB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,gBAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;8BAClE,gBAAK,CAAC,QAAQ;0CAAC;mBAdd,QAAQ;IAHpB,IAAA,iBAAM,EAAC;QACN,UAAU,EAAE,IAAI;KACjB,CAAC;GACW,QAAQ,CAepB;AAEY,QAAA,cAAc,GAAG,wBAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "world-med-commons",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -8,3 +8,4 @@ export * from './models/drug.schema';
8
8
  export * from './models/drug-variant.schema';
9
9
  export * from './models/business-inventory.schema';
10
10
  export * from './models/patient.schema';
11
+ export * from './models/suppliers.schema'
@@ -3,13 +3,22 @@ import mongoose, {Document, HydratedDocument, Types} from 'mongoose';
3
3
  import {Business} from "./business.schema";
4
4
  import {DrugVariant} from "./drug-variant.schema";
5
5
 
6
- class Batch {
6
+ export class Batch {
7
+ @Prop({ required: true })
7
8
  batchNumber: string;
9
+ @Prop({ required: false })
8
10
  expiryDate: Date;
11
+ @Prop({ required: true })
12
+ manufacturingDate: Date;
13
+ @Prop({ required: true })
9
14
  quantity: number;
15
+ @Prop()
10
16
  costPrice?: number;
17
+ @Prop()
11
18
  sellingPrice?: number;
19
+ @Prop()
12
20
  receivedDate?: Date;
21
+ @Prop({type: mongoose.Schema.Types.ObjectId, ref: 'Supplier' ,required: true})
13
22
  supplier?: string;
14
23
  }
15
24
 
@@ -17,10 +26,12 @@ export type PharmacyInventoryDocument = HydratedDocument<PharmacyInventory>;
17
26
 
18
27
  @Schema({ timestamps: true })
19
28
  export class PharmacyInventory extends Document {
20
- @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Business', required: true, index: true })
29
+ @Prop({ type: mongoose.Schema.Types.ObjectId,
30
+ ref: 'Business', required: true, index: true })
21
31
  business: Business;
22
32
 
23
- @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'DrugVariant', required: true, index: true })
33
+ @Prop({ type: mongoose.Schema.Types.ObjectId,
34
+ ref: 'DrugVariant', required: true, index: true })
24
35
  variant: DrugVariant; // → specific product
25
36
 
26
37
  // Batch-level tracking (most pharmacies track by batch for expiry & traceability)
@@ -39,8 +50,16 @@ export class PharmacyInventory extends Document {
39
50
  @Prop()
40
51
  notes?: string;
41
52
 
53
+ @Prop({ default: false })
54
+ isDeleted: boolean;
55
+
56
+ @Prop({ required: true })
57
+ modifiedBy: string;
58
+
59
+ @Prop({ required: true, default: 5})
60
+ minimumQuantityThreshold: number;
61
+
42
62
  }
43
63
 
44
64
  export const BusinessInventorySchema = SchemaFactory.createForClass(PharmacyInventory);
45
65
 
46
- BusinessInventorySchema.index({ pharmacy: 1, variant: 1 }, { unique: true });
@@ -2,6 +2,7 @@ import mongoose, { HydratedDocument } from 'mongoose';
2
2
  import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
3
3
  import {Patient} from "./patient.schema";
4
4
  import {Employee} from "./employee.schema";
5
+ import {Supplier} from "./suppliers.schema";
5
6
 
6
7
  export type BusinessDocument = HydratedDocument<Business>;
7
8
 
@@ -57,6 +58,15 @@ export class Business {
57
58
 
58
59
  @Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Patient' }] })
59
60
  patients?: Patient[];
61
+
62
+ @Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Supplier' }]})
63
+ suppliers?: Supplier[];
64
+
65
+ @Prop({ required: true })
66
+ currencyCode: string
67
+
68
+ @Prop({ required: false, default: 5})
69
+ minimumQuantityThreshold: number
60
70
  }
61
71
 
62
72
  export const BusinessSchema = SchemaFactory.createForClass(Business);
@@ -1,6 +1,7 @@
1
1
  import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
2
  import mongoose, {Document, HydratedDocument} from 'mongoose';
3
3
  import {Drug} from "./drug.schema";
4
+ import {PharmacyInventory} from "./business-inventory.schema";
4
5
 
5
6
  export type DrugVariantDocument = HydratedDocument<DrugVariant>;
6
7
 
@@ -30,7 +31,13 @@ export class DrugVariant extends Document {
30
31
  packageSize?: string; // e.g. "10 × 10 tabs", "100ml bottle", "1 vial"
31
32
 
32
33
  @Prop({ unique: true, sparse: true })
33
- ndc?: string; // If using US-style NDC or national equivalent
34
+ ndc?: string; // If using US-style NDC or national equivalent
35
+
36
+ @Prop({
37
+ type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'PharmacyInventory' }]
38
+ })
39
+ pharmacyInventory: PharmacyInventory[]
40
+
34
41
 
35
42
  }
36
43
 
@@ -1,5 +1,6 @@
1
1
  import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import {Document, HydratedDocument} from 'mongoose';
2
+ import mongoose, {Document, HydratedDocument} from 'mongoose';
3
+ import {DrugVariant} from "./drug-variant.schema";
3
4
 
4
5
  export type DrugDocument = HydratedDocument<Drug>
5
6
 
@@ -11,11 +12,14 @@ export class Drug extends Document {
11
12
  @Prop()
12
13
  atcCode?: string; // Anatomical Therapeutic Chemical code (optional)
13
14
 
14
- @Prop()
15
- therapeuticClass?: string; // e.g. "Analgesic", "Antibiotic"
15
+ @Prop({ type: [String], default: [] })
16
+ therapeuticClass?: string[]; // e.g. ["Analgesic", "Antibiotic"]
16
17
 
17
18
  @Prop({ type: [String], default: [] })
18
19
  commonSideEffects?: string[];
20
+
21
+ @Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'DrugVariant' }] })
22
+ variants: DrugVariant[];
19
23
  }
20
24
 
21
25
  export const DrugSchema = SchemaFactory.createForClass(Drug);
@@ -0,0 +1,28 @@
1
+ import {Prop, Schema, SchemaFactory} from "@nestjs/mongoose";
2
+ import {HydratedDocument, Types} from "mongoose";
3
+ import {Address} from "./user.schema";
4
+
5
+ export type SuppliersDocument = HydratedDocument<Supplier>;
6
+
7
+ @Schema({
8
+ timestamps: true
9
+ })
10
+ export class Supplier {
11
+
12
+ @Prop({required: true})
13
+ name: string;
14
+ @Prop()
15
+ address?: Address;
16
+ @Prop()
17
+ email?: string;
18
+ @Prop()
19
+ phoneNumber?: string;
20
+ @Prop()
21
+ website?: string;
22
+
23
+ @Prop({ type: Types.ObjectId, ref: 'Business', required: true, index: true})
24
+ business: Types.ObjectId;
25
+ }
26
+
27
+ export const SupplierSchema = SchemaFactory.createForClass(Supplier);
28
+