world-med-commons 1.0.2 → 1.0.3

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
@@ -9,3 +9,4 @@ export * from './models/drug-variant.schema';
9
9
  export * from './models/business-inventory.schema';
10
10
  export * from './models/patient.schema';
11
11
  export * from './models/suppliers.schema';
12
+ export * from './models/apiKey.schema';
package/dist/index.js CHANGED
@@ -25,4 +25,5 @@ __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
27
  __exportStar(require("./models/suppliers.schema"), exports);
28
+ __exportStar(require("./models/apiKey.schema"), exports);
28
29
  //# 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;AACxC,4DAAyC"}
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,4DAA0C;AAC1C,yDAAuC"}
@@ -0,0 +1,93 @@
1
+ import mongoose, { Document } from "mongoose";
2
+ import { Business } from "./business.schema";
3
+ export declare class ApiKey extends Document {
4
+ key: String;
5
+ name: String;
6
+ isActive: Boolean;
7
+ ownerType: string;
8
+ business?: Business;
9
+ lastUsedAt: Date;
10
+ }
11
+ export declare const ApiKeySchema: mongoose.Schema<ApiKey, mongoose.Model<ApiKey, any, any, any, (mongoose.Document<unknown, any, ApiKey, any, mongoose.DefaultSchemaOptions> & ApiKey & Required<{
12
+ _id: mongoose.Types.ObjectId;
13
+ }> & {
14
+ __v: number;
15
+ } & {
16
+ id: string;
17
+ }) | (mongoose.Document<unknown, any, ApiKey, any, mongoose.DefaultSchemaOptions> & ApiKey & Required<{
18
+ _id: mongoose.Types.ObjectId;
19
+ }> & {
20
+ __v: number;
21
+ }), any, ApiKey>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
22
+ id: string;
23
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
24
+ _id: mongoose.Types.ObjectId;
25
+ }> & {
26
+ __v: number;
27
+ }, "id"> & {
28
+ id: string;
29
+ }, {
30
+ name?: mongoose.SchemaDefinitionProperty<String, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
31
+ id: string;
32
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
33
+ _id: mongoose.Types.ObjectId;
34
+ }> & {
35
+ __v: number;
36
+ }, "id"> & {
37
+ id: string;
38
+ }>;
39
+ _id?: mongoose.SchemaDefinitionProperty<mongoose.Types.ObjectId, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
40
+ id: string;
41
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
42
+ _id: mongoose.Types.ObjectId;
43
+ }> & {
44
+ __v: number;
45
+ }, "id"> & {
46
+ id: string;
47
+ }>;
48
+ business?: mongoose.SchemaDefinitionProperty<Business, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
49
+ id: string;
50
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
51
+ _id: mongoose.Types.ObjectId;
52
+ }> & {
53
+ __v: number;
54
+ }, "id"> & {
55
+ id: string;
56
+ }>;
57
+ isActive?: mongoose.SchemaDefinitionProperty<Boolean, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
58
+ id: string;
59
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
60
+ _id: mongoose.Types.ObjectId;
61
+ }> & {
62
+ __v: number;
63
+ }, "id"> & {
64
+ id: string;
65
+ }>;
66
+ key?: mongoose.SchemaDefinitionProperty<String, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
67
+ id: string;
68
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
69
+ _id: mongoose.Types.ObjectId;
70
+ }> & {
71
+ __v: number;
72
+ }, "id"> & {
73
+ id: string;
74
+ }>;
75
+ ownerType?: mongoose.SchemaDefinitionProperty<string, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
76
+ id: string;
77
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
78
+ _id: mongoose.Types.ObjectId;
79
+ }> & {
80
+ __v: number;
81
+ }, "id"> & {
82
+ id: string;
83
+ }>;
84
+ lastUsedAt?: mongoose.SchemaDefinitionProperty<Date, ApiKey, mongoose.Document<unknown, {}, ApiKey, {
85
+ id: string;
86
+ }, mongoose.DefaultSchemaOptions> & Omit<ApiKey & Required<{
87
+ _id: mongoose.Types.ObjectId;
88
+ }> & {
89
+ __v: number;
90
+ }, "id"> & {
91
+ id: string;
92
+ }>;
93
+ }, ApiKey>;
@@ -0,0 +1,50 @@
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.ApiKeySchema = exports.ApiKey = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const business_schema_1 = require("./business.schema");
16
+ let ApiKey = class ApiKey extends mongoose_2.Document {
17
+ };
18
+ exports.ApiKey = ApiKey;
19
+ __decorate([
20
+ (0, mongoose_1.Prop)({ required: true, unique: true }),
21
+ __metadata("design:type", String)
22
+ ], ApiKey.prototype, "key", void 0);
23
+ __decorate([
24
+ (0, mongoose_1.Prop)({ required: true }),
25
+ __metadata("design:type", String)
26
+ ], ApiKey.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, mongoose_1.Prop)({ required: false, default: true }),
29
+ __metadata("design:type", Boolean)
30
+ ], ApiKey.prototype, "isActive", void 0);
31
+ __decorate([
32
+ (0, mongoose_1.Prop)({ required: true, enum: ['Business', 'Microservice'] }),
33
+ __metadata("design:type", String)
34
+ ], ApiKey.prototype, "ownerType", void 0);
35
+ __decorate([
36
+ (0, mongoose_1.Prop)({
37
+ required: false,
38
+ type: mongoose_2.default.Schema.Types.ObjectId, ref: 'Business'
39
+ }),
40
+ __metadata("design:type", business_schema_1.Business)
41
+ ], ApiKey.prototype, "business", void 0);
42
+ __decorate([
43
+ (0, mongoose_1.Prop)({ required: false }),
44
+ __metadata("design:type", Date)
45
+ ], ApiKey.prototype, "lastUsedAt", void 0);
46
+ exports.ApiKey = ApiKey = __decorate([
47
+ (0, mongoose_1.Schema)({ timestamps: true })
48
+ ], ApiKey);
49
+ exports.ApiKeySchema = mongoose_1.SchemaFactory.createForClass(ApiKey);
50
+ //# sourceMappingURL=apiKey.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiKey.schema.js","sourceRoot":"","sources":["../../src/models/apiKey.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6D;AAC7D,uCAA8D;AAC9D,uDAA2C;AAKpC,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,mBAAQ;CAkBnC,CAAA;AAlBY,wBAAM;AAEjB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;8BACjC,MAAM;mCAAC;AAEZ;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACnB,MAAM;oCAAC;AAEb;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC/B,OAAO;wCAAC;AAGlB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC;;yCAC3C;AAMlB;IAJC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU;KACtD,CAAC;8BACS,0BAAQ;wCAAC;AAEpB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;8BACb,IAAI;0CAAA;iBAjBN,MAAM;IAHlB,IAAA,iBAAM,EACL,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB;GACY,MAAM,CAkBlB;AAEY,QAAA,YAAY,GAAG,wBAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC"}
@@ -25,6 +25,7 @@ export declare class Business {
25
25
  suppliers?: Supplier[];
26
26
  currencyCode: string;
27
27
  minimumQuantityThreshold: number;
28
+ isActive: boolean;
28
29
  }
29
30
  export declare const BusinessSchema: mongoose.Schema<Business, mongoose.Model<Business, any, any, any, (mongoose.Document<unknown, any, Business, any, mongoose.DefaultSchemaOptions> & Business & {
30
31
  _id: mongoose.Types.ObjectId;
@@ -210,4 +211,13 @@ export declare const BusinessSchema: mongoose.Schema<Business, mongoose.Model<Bu
210
211
  }, "id"> & {
211
212
  id: string;
212
213
  }>;
214
+ isActive?: mongoose.SchemaDefinitionProperty<boolean, Business, mongoose.Document<unknown, {}, Business, {
215
+ id: string;
216
+ }, mongoose.DefaultSchemaOptions> & Omit<Business & {
217
+ _id: mongoose.Types.ObjectId;
218
+ } & {
219
+ __v: number;
220
+ }, "id"> & {
221
+ id: string;
222
+ }>;
213
223
  }, Business>;
@@ -98,6 +98,10 @@ __decorate([
98
98
  (0, mongoose_2.Prop)({ required: false, default: 5 }),
99
99
  __metadata("design:type", Number)
100
100
  ], Business.prototype, "minimumQuantityThreshold", void 0);
101
+ __decorate([
102
+ (0, mongoose_2.Prop)({ required: true, default: false }),
103
+ __metadata("design:type", Boolean)
104
+ ], Business.prototype, "isActive", void 0);
101
105
  exports.Business = Business = __decorate([
102
106
  (0, mongoose_2.Schema)({
103
107
  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;AAYxD,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAwDpB,CAAA;AAxDY,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,eA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AAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;;2CACrD;AAGvB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;;0CACtD;AAGrB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,EAAC,CAAC;;2CACpD;AAGvB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACL;AAGpB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC;;0DACL;AAGhC;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;0CACvB;mBA1DP,QAAQ;IALpB,IAAA,iBAAM,EACL;QACE,UAAU,EAAE,IAAI;KACjB,CACF;GACY,QAAQ,CA2DpB;AAEY,QAAA,cAAc,GAAG,wBAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC"}
@@ -5,11 +5,13 @@ export type DrugVariantDocument = HydratedDocument<DrugVariant>;
5
5
  export declare class DrugVariant extends Document {
6
6
  drug: Drug;
7
7
  brandName?: string;
8
- manufacturer: string;
9
- strength: string;
10
- form: string;
8
+ manufacturer?: string;
9
+ strength?: string;
10
+ form?: string;
11
11
  packageSize?: string;
12
12
  ndc?: string;
13
+ isPrescriptionRequired?: boolean;
14
+ images?: string[];
13
15
  pharmacyInventory: PharmacyInventory[];
14
16
  }
15
17
  export declare const DrugVariantSchema: mongoose.Schema<DrugVariant, mongoose.Model<DrugVariant, any, any, any, (mongoose.Document<unknown, any, DrugVariant, any, mongoose.DefaultSchemaOptions> & DrugVariant & Required<{
@@ -103,6 +105,24 @@ export declare const DrugVariantSchema: mongoose.Schema<DrugVariant, mongoose.Mo
103
105
  }, "id"> & {
104
106
  id: string;
105
107
  }>;
108
+ isPrescriptionRequired?: mongoose.SchemaDefinitionProperty<boolean, DrugVariant, mongoose.Document<unknown, {}, DrugVariant, {
109
+ id: string;
110
+ }, mongoose.DefaultSchemaOptions> & Omit<DrugVariant & Required<{
111
+ _id: mongoose.Types.ObjectId;
112
+ }> & {
113
+ __v: number;
114
+ }, "id"> & {
115
+ id: string;
116
+ }>;
117
+ images?: mongoose.SchemaDefinitionProperty<string[], DrugVariant, mongoose.Document<unknown, {}, DrugVariant, {
118
+ id: string;
119
+ }, mongoose.DefaultSchemaOptions> & Omit<DrugVariant & Required<{
120
+ _id: mongoose.Types.ObjectId;
121
+ }> & {
122
+ __v: number;
123
+ }, "id"> & {
124
+ id: string;
125
+ }>;
106
126
  pharmacyInventory?: mongoose.SchemaDefinitionProperty<PharmacyInventory[], DrugVariant, mongoose.Document<unknown, {}, DrugVariant, {
107
127
  id: string;
108
128
  }, mongoose.DefaultSchemaOptions> & Omit<DrugVariant & Required<{
@@ -25,30 +25,33 @@ __decorate([
25
25
  __metadata("design:type", String)
26
26
  ], DrugVariant.prototype, "brandName", void 0);
27
27
  __decorate([
28
- (0, mongoose_1.Prop)(),
28
+ (0, mongoose_1.Prop)({ required: false }),
29
29
  __metadata("design:type", String)
30
30
  ], DrugVariant.prototype, "manufacturer", void 0);
31
31
  __decorate([
32
- (0, mongoose_1.Prop)(),
32
+ (0, mongoose_1.Prop)({ required: false }),
33
33
  __metadata("design:type", String)
34
34
  ], DrugVariant.prototype, "strength", void 0);
35
35
  __decorate([
36
- (0, mongoose_1.Prop)({ required: true, enum: [
37
- 'tablet', 'capsule', 'syrup', 'suspension', 'injection', 'infusion',
38
- 'cream', 'ointment', 'drops', 'gel', 'powder', 'granule', 'lozenge',
39
- 'suppository', 'patch', 'aerosol', 'inhalant', 'emulsion', 'lotion',
40
- 'film', 'implant', 'ring', 'shampoo', 'foam', 'paste',
41
- ] }),
36
+ (0, mongoose_1.Prop)({ required: false }),
42
37
  __metadata("design:type", String)
43
38
  ], DrugVariant.prototype, "form", void 0);
44
39
  __decorate([
45
- (0, mongoose_1.Prop)(),
40
+ (0, mongoose_1.Prop)({ required: false }),
46
41
  __metadata("design:type", String)
47
42
  ], DrugVariant.prototype, "packageSize", void 0);
48
43
  __decorate([
49
- (0, mongoose_1.Prop)({ unique: true, sparse: true }),
44
+ (0, mongoose_1.Prop)({ unique: false, sparse: true }),
50
45
  __metadata("design:type", String)
51
46
  ], DrugVariant.prototype, "ndc", void 0);
47
+ __decorate([
48
+ (0, mongoose_1.Prop)({ required: false, default: false }),
49
+ __metadata("design:type", Boolean)
50
+ ], DrugVariant.prototype, "isPrescriptionRequired", void 0);
51
+ __decorate([
52
+ (0, mongoose_1.Prop)({ required: false, default: [] }),
53
+ __metadata("design:type", Array)
54
+ ], DrugVariant.prototype, "images", void 0);
52
55
  __decorate([
53
56
  (0, mongoose_1.Prop)({
54
57
  type: [{ type: mongoose_2.default.Schema.Types.ObjectId, ref: 'PharmacyInventory' }]
@@ -59,6 +62,6 @@ exports.DrugVariant = DrugVariant = __decorate([
59
62
  (0, mongoose_1.Schema)({ timestamps: true })
60
63
  ], DrugVariant);
61
64
  exports.DrugVariantSchema = mongoose_1.SchemaFactory.createForClass(DrugVariant);
62
- exports.DrugVariantSchema.index({ drug: 1, manufacturer: 1, strength: 1, form: 1 }, { unique: true });
65
+ exports.DrugVariantSchema.index({ drug: 1, manufacturer: 1, strength: 1, form: 1 });
63
66
  exports.DrugVariantSchema.index({ brandName: 'text', manufacturer: 'text' });
64
67
  //# sourceMappingURL=drug-variant.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drug-variant.schema.js","sourceRoot":"","sources":["../../src/models/drug-variant.schema.ts"],"names":[],"mappings":";;;;;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,CAAC;;wCACzB;AAGb;IADC,IAAA,eAAI,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;2DACR;AAGjC;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;2CACtB;AAKjB;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;sBA/B3B,WAAW;IADvB,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;GAChB,WAAW,CAgCvB;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,CAAC,CAAC;AAC5E,yBAAiB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "world-med-commons",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -8,4 +8,5 @@ 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'
11
+ export * from './models/suppliers.schema';
12
+ export * from './models/apiKey.schema';
@@ -0,0 +1,28 @@
1
+ import {Prop, Schema, SchemaFactory} from "@nestjs/mongoose";
2
+ import mongoose, {Document, HydratedDocument} from "mongoose";
3
+ import {Business} from "./business.schema";
4
+
5
+ @Schema(
6
+ { timestamps: true }
7
+ )
8
+ export class ApiKey extends Document{
9
+ @Prop({ required: true, unique: true})
10
+ key: String;
11
+ @Prop({ required: true })
12
+ name: String; // e.g., "Production Key", "Inventory Service"
13
+ @Prop({ required: false, default: true })
14
+ isActive: Boolean;
15
+
16
+ @Prop({ required: true, enum: ['Business', 'Microservice'] })
17
+ ownerType: string;
18
+
19
+ @Prop({
20
+ required: false,
21
+ type: mongoose.Schema.Types.ObjectId, ref: 'Business'
22
+ })
23
+ business?: Business;
24
+ @Prop({ required: false })
25
+ lastUsedAt : Date
26
+ }
27
+
28
+ export const ApiKeySchema = SchemaFactory.createForClass(ApiKey);
@@ -67,6 +67,9 @@ export class Business {
67
67
 
68
68
  @Prop({ required: false, default: 5})
69
69
  minimumQuantityThreshold: number
70
+
71
+ @Prop({ required: true, default: false })
72
+ isActive: boolean;
70
73
  }
71
74
 
72
75
  export const BusinessSchema = SchemaFactory.createForClass(Business);
@@ -13,36 +13,35 @@ export class DrugVariant extends Document {
13
13
  @Prop()
14
14
  brandName?: string; // e.g. "Panadol", "Amoxil" (null for pure generics)
15
15
 
16
- @Prop()
17
- manufacturer: string; // e.g. "GSK", "Pfizer", "Local Generic Co."
16
+ @Prop({ required: false })
17
+ manufacturer?: string; // e.g. "GSK", "Pfizer", "Local Generic Co."
18
18
 
19
- @Prop()
20
- strength: string; // e.g. "500mg", "250mg/5ml", "1g/vial"
19
+ @Prop({ required: false })
20
+ strength?: string; // e.g. "500mg", "250mg/5ml", "1g/vial"
21
21
 
22
- @Prop({ required: true, enum: [
23
- 'tablet', 'capsule', 'syrup', 'suspension', 'injection', 'infusion',
24
- 'cream', 'ointment', 'drops', 'gel', 'powder', 'granule', 'lozenge',
25
- 'suppository', 'patch', 'aerosol', 'inhalant', 'emulsion', 'lotion',
26
- 'film', 'implant', 'ring', 'shampoo', 'foam', 'paste', /* add more as needed */
27
- ]})
28
- form: string; // tb → tablet, cp → capsule, syr → syrup
22
+ @Prop({ required: false})
23
+ form?: string; // tb → tablet, cp → capsule, syr syrup
29
24
 
30
- @Prop()
25
+ @Prop({ required: false })
31
26
  packageSize?: string; // e.g. "10 × 10 tabs", "100ml bottle", "1 vial"
32
27
 
33
- @Prop({ unique: true, sparse: true })
28
+ @Prop({ unique: false, sparse: true })
34
29
  ndc?: string; // If using US-style NDC or national equivalent
35
30
 
31
+ @Prop({required: false, default: false })
32
+ isPrescriptionRequired?: boolean;
33
+
34
+ @Prop({ required: false, default: [] })
35
+ images?: string[]
36
+
36
37
  @Prop({
37
38
  type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'PharmacyInventory' }]
38
39
  })
39
40
  pharmacyInventory: PharmacyInventory[]
40
-
41
-
42
41
  }
43
42
 
44
43
  export const DrugVariantSchema = SchemaFactory.createForClass(DrugVariant);
45
44
 
46
45
  // Important indexes
47
- DrugVariantSchema.index({ drug: 1, manufacturer: 1, strength: 1, form: 1 }, { unique: true });
46
+ DrugVariantSchema.index({ drug: 1, manufacturer: 1, strength: 1, form: 1 });
48
47
  DrugVariantSchema.index({ brandName: 'text', manufacturer: 'text' });