my-typescript-library-rahul52us 1.2.1 → 1.2.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/repository/schemas/extracted.schema.js +15 -4
- package/dist/repository/schemas/extracted.schema.js.map +1 -1
- package/dist/repository/schemas/log.schema.js +19 -10
- package/dist/repository/schemas/log.schema.js.map +1 -1
- package/dist/repository/schemas/notifications.schema.js +14 -3
- package/dist/repository/schemas/notifications.schema.js.map +1 -1
- package/dist/repository/schemas/organisation.schema.js +38 -27
- package/dist/repository/schemas/organisation.schema.js.map +1 -1
- package/dist/setupModal.js +3 -3
- package/dist/setupModal.js.map +1 -1
- package/dist/types/repository/organisation.repository.d.ts +6 -1
- package/dist/types/repository/schemas/extracted.schema.d.ts +5 -5
- package/dist/types/repository/schemas/log.schema.d.ts +3 -3
- package/dist/types/repository/schemas/notifications.schema.d.ts +2 -2
- package/dist/types/repository/schemas/organisation.schema.d.ts +4 -5
- package/dist/types/services/organisation/organisation.service.d.ts +32 -1
- package/package.json +1 -1
- package/src/repository/schemas/extracted.schema.ts +40 -28
- package/src/repository/schemas/log.schema.ts +52 -44
- package/src/repository/schemas/notifications.schema.ts +16 -3
- package/src/repository/schemas/organisation.schema.ts +42 -30
- package/src/setupModal.ts +3 -3
|
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
|
+
// Define the extracted schema
|
|
27
28
|
const extractedSchema = new mongoose_1.Schema({
|
|
28
29
|
created_At: {
|
|
29
30
|
type: Date,
|
|
@@ -38,12 +39,22 @@ const extractedSchema = new mongoose_1.Schema({
|
|
|
38
39
|
},
|
|
39
40
|
fileId: {
|
|
40
41
|
type: mongoose_1.default.Types.ObjectId,
|
|
41
|
-
ref: "fs.files"
|
|
42
|
+
ref: "fs.files",
|
|
42
43
|
},
|
|
43
44
|
data: {
|
|
44
45
|
type: Object,
|
|
45
|
-
required: true
|
|
46
|
-
}
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
47
48
|
});
|
|
48
|
-
|
|
49
|
+
// Handle model initialization
|
|
50
|
+
let ExtractedModel = null;
|
|
51
|
+
if (mongoose_1.default.models.Extracted) {
|
|
52
|
+
console.log("Extracted model already exists.");
|
|
53
|
+
ExtractedModel = mongoose_1.default.models.Extracted;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
console.log("Creating Extracted model fallback.");
|
|
57
|
+
ExtractedModel = mongoose_1.default.model("Extracted", extractedSchema);
|
|
58
|
+
}
|
|
59
|
+
exports.default = ExtractedModel;
|
|
49
60
|
//# sourceMappingURL=extracted.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extracted.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/extracted.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"extracted.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/extracted.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsD;AAWtD,8BAA8B;AAC9B,MAAM,eAAe,GAAW,IAAI,iBAAM,CAAC;IACzC,UAAU,EAAE;QACV,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI,CAAC,GAAG;KAClB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI,CAAC,GAAG;KAClB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,IAAI;KACX;IACD,MAAM,EAAE;QACN,IAAI,EAAE,kBAAQ,CAAC,KAAK,CAAC,QAAQ;QAC7B,GAAG,EAAE,UAAU;KAChB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;CACF,CAAC,CAAC;AAEH,8BAA8B;AAC9B,IAAI,cAAc,GAAsC,IAAI,CAAC;AAE7D,IAAI,kBAAQ,CAAC,MAAM,CAAC,SAAS,EAAE;IAC7B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC/C,cAAc,GAAG,kBAAQ,CAAC,MAAM,CAAC,SAAS,CAAC;CAC5C;KAAM;IACL,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,cAAc,GAAG,kBAAQ,CAAC,KAAK,CAAa,WAAW,EAAE,eAAe,CAAC,CAAC;CAC3E;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -5,37 +5,46 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LogSchema = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
// Define schema
|
|
8
9
|
exports.LogSchema = new mongoose_1.default.Schema({
|
|
9
10
|
statuscode: {
|
|
10
11
|
type: Number,
|
|
11
12
|
},
|
|
12
13
|
message: {
|
|
13
14
|
type: String,
|
|
15
|
+
required: [true, "Message is required"], // Ensure message is required
|
|
14
16
|
},
|
|
15
17
|
type: {
|
|
16
18
|
type: String,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
enum: ['log', 'error', 'warning', 'info', 'success'],
|
|
19
|
+
required: [true, "Type is required"],
|
|
20
|
+
enum: ["log", "error", "warning", "info", "success"],
|
|
20
21
|
},
|
|
21
22
|
logtype: {
|
|
22
23
|
type: String,
|
|
23
|
-
required: [true,
|
|
24
|
+
required: [true, "Logtype is required"],
|
|
24
25
|
},
|
|
25
26
|
company: {
|
|
26
27
|
type: mongoose_1.default.Types.ObjectId,
|
|
27
|
-
|
|
28
|
-
ref: 'Organisation'
|
|
28
|
+
ref: "Organisation",
|
|
29
29
|
},
|
|
30
30
|
user: {
|
|
31
31
|
type: mongoose_1.default.Types.ObjectId,
|
|
32
|
-
|
|
33
|
-
ref: 'Account'
|
|
32
|
+
ref: "Account",
|
|
34
33
|
},
|
|
35
34
|
created_At: {
|
|
36
35
|
type: Date,
|
|
37
36
|
default: Date.now,
|
|
38
|
-
}
|
|
37
|
+
},
|
|
39
38
|
});
|
|
40
|
-
|
|
39
|
+
// Model initialization safely
|
|
40
|
+
let LogModal;
|
|
41
|
+
if (mongoose_1.default.models.Log) {
|
|
42
|
+
console.log("Log model already exists.");
|
|
43
|
+
LogModal = mongoose_1.default.models.Log;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.log("Creating Log model fallback.");
|
|
47
|
+
LogModal = mongoose_1.default.model("Log", exports.LogSchema);
|
|
48
|
+
}
|
|
49
|
+
exports.default = LogModal;
|
|
41
50
|
//# sourceMappingURL=log.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/log.schema.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAsD;
|
|
1
|
+
{"version":3,"file":"log.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/log.schema.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAsD;AAatD,gBAAgB;AACH,QAAA,SAAS,GAAW,IAAI,kBAAQ,CAAC,MAAM,CAAC;IACnD,UAAU,EAAE;QACV,IAAI,EAAE,MAAM;KACb;IACD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,EAAE,6BAA6B;KACvE;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,kBAAkB,CAAC;QACpC,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC;KACrD;IACD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC;KACxC;IACD,OAAO,EAAE;QACP,IAAI,EAAE,kBAAQ,CAAC,KAAK,CAAC,QAAQ;QAC7B,GAAG,EAAE,cAAc;KACpB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,kBAAQ,CAAC,KAAK,CAAC,QAAQ;QAC7B,GAAG,EAAE,SAAS;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI,CAAC,GAAG;KAClB;CACF,CAAC,CAAC;AAEH,8BAA8B;AAC9B,IAAI,QAA8B,CAAC;AAEnC,IAAI,kBAAQ,CAAC,MAAM,CAAC,GAAG,EAAE;IACvB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,QAAQ,GAAG,kBAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;CAChC;KAAM;IACL,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,QAAQ,GAAG,kBAAQ,CAAC,KAAK,CAAO,KAAK,EAAE,iBAAS,CAAC,CAAC;CACnD;AAED,kBAAe,QAAQ,CAAC"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
7
|
+
// Define Notifications Schema
|
|
7
8
|
const NotificationsSchema = new mongoose_1.default.Schema({
|
|
8
9
|
workflow: {
|
|
9
10
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
@@ -27,9 +28,9 @@ const NotificationsSchema = new mongoose_1.default.Schema({
|
|
|
27
28
|
ref: "Account",
|
|
28
29
|
},
|
|
29
30
|
],
|
|
30
|
-
|
|
31
|
+
notificationType: {
|
|
31
32
|
type: String,
|
|
32
|
-
|
|
33
|
+
required: true,
|
|
33
34
|
},
|
|
34
35
|
documentId: {
|
|
35
36
|
type: String,
|
|
@@ -39,5 +40,15 @@ const NotificationsSchema = new mongoose_1.default.Schema({
|
|
|
39
40
|
type: Date,
|
|
40
41
|
},
|
|
41
42
|
}, { timestamps: true });
|
|
42
|
-
|
|
43
|
+
// Safely initialize the Notifications model
|
|
44
|
+
let NotificationsModel;
|
|
45
|
+
if (mongoose_1.default.models.notification) {
|
|
46
|
+
console.log("Notification model already exists.");
|
|
47
|
+
NotificationsModel = mongoose_1.default.models.notification;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.log("Creating notification model fallback.");
|
|
51
|
+
NotificationsModel = mongoose_1.default.model("notification", NotificationsSchema);
|
|
52
|
+
}
|
|
53
|
+
exports.default = NotificationsModel;
|
|
43
54
|
//# sourceMappingURL=notifications.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/notifications.schema.ts"],"names":[],"mappings":";;;;;AAAA,wDAAsD;
|
|
1
|
+
{"version":3,"file":"notifications.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/notifications.schema.ts"],"names":[],"mappings":";;;;;AAAA,wDAAsD;AActD,8BAA8B;AAC9B,MAAM,mBAAmB,GAAW,IAAI,kBAAQ,CAAC,MAAM,CACrD;IACE,QAAQ,EAAE;QACR,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;QACpC,OAAO,EAAE,UAAU;KACpB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,kBAAQ,CAAC,KAAK,CAAC,QAAQ;QAC7B,GAAG,EAAE,SAAS;KACf;IACD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,IAAI;KACd;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,kBAAQ,CAAC,KAAK,CAAC,QAAQ;QAC7B,GAAG,EAAE,SAAS;KACf;IACD,MAAM,EAAE;QACN;YACE,IAAI,EAAE,kBAAQ,CAAC,KAAK,CAAC,QAAQ;YAC7B,GAAG,EAAE,SAAS;SACf;KACF;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACT,IAAI,EAAE,IAAI;KACX;CACF,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;AAEF,4CAA4C;AAC5C,IAAI,kBAAkD,CAAC;AAEvD,IAAI,kBAAQ,CAAC,MAAM,CAAC,YAAY,EAAE;IAChC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,kBAAkB,GAAG,kBAAQ,CAAC,MAAM,CAAC,YAA8C,CAAC;CACrF;KAAM;IACL,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrD,kBAAkB,GAAG,kBAAQ,CAAC,KAAK,CAAiB,cAAc,EAAE,mBAAmB,CAAC,CAAC;CAC1F;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
|
-
// Define
|
|
27
|
+
// Define Organisation schema
|
|
28
28
|
const OrganisationSchema = new mongoose_1.Schema({
|
|
29
29
|
name: {
|
|
30
30
|
type: String,
|
|
@@ -36,27 +36,19 @@ const OrganisationSchema = new mongoose_1.Schema({
|
|
|
36
36
|
compliances: {
|
|
37
37
|
type: [
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
info: {
|
|
43
|
-
type: Object,
|
|
44
|
-
},
|
|
39
|
+
type: String,
|
|
40
|
+
file: String,
|
|
41
|
+
info: mongoose_1.Schema.Types.Mixed,
|
|
45
42
|
compliant: [
|
|
46
43
|
{
|
|
47
|
-
date:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
status: {
|
|
51
|
-
type: String,
|
|
52
|
-
},
|
|
53
|
-
moreinfo: {
|
|
54
|
-
type: String,
|
|
55
|
-
},
|
|
44
|
+
date: String,
|
|
45
|
+
status: String,
|
|
46
|
+
moreinfo: String,
|
|
56
47
|
},
|
|
57
48
|
],
|
|
58
49
|
},
|
|
59
50
|
],
|
|
51
|
+
default: [],
|
|
60
52
|
},
|
|
61
53
|
gstin: {
|
|
62
54
|
type: String,
|
|
@@ -86,24 +78,34 @@ const OrganisationSchema = new mongoose_1.Schema({
|
|
|
86
78
|
},
|
|
87
79
|
address: {
|
|
88
80
|
billing: {
|
|
89
|
-
type:
|
|
81
|
+
street: { type: String },
|
|
82
|
+
city: { type: String },
|
|
83
|
+
state: { type: String },
|
|
84
|
+
pin: { type: String },
|
|
85
|
+
country: { type: String },
|
|
86
|
+
phone: { type: String },
|
|
90
87
|
},
|
|
91
88
|
shipping: {
|
|
92
|
-
type:
|
|
89
|
+
street: { type: String },
|
|
90
|
+
city: { type: String },
|
|
91
|
+
state: { type: String },
|
|
92
|
+
pin: { type: String },
|
|
93
|
+
country: { type: String },
|
|
94
|
+
phone: { type: String },
|
|
93
95
|
},
|
|
94
96
|
},
|
|
95
97
|
bankDetails: {
|
|
96
|
-
type:
|
|
98
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
97
99
|
},
|
|
98
100
|
deposits: {
|
|
99
|
-
type:
|
|
101
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
100
102
|
},
|
|
101
103
|
certificates: {
|
|
102
104
|
msme: [
|
|
103
105
|
{
|
|
104
106
|
files: [
|
|
105
107
|
{
|
|
106
|
-
type: mongoose_1.Schema.Types.ObjectId,
|
|
108
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
107
109
|
ref: "fs.files",
|
|
108
110
|
},
|
|
109
111
|
],
|
|
@@ -113,7 +115,7 @@ const OrganisationSchema = new mongoose_1.Schema({
|
|
|
113
115
|
{
|
|
114
116
|
files: [
|
|
115
117
|
{
|
|
116
|
-
type: mongoose_1.Schema.Types.ObjectId,
|
|
118
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
117
119
|
ref: "fs.files",
|
|
118
120
|
},
|
|
119
121
|
],
|
|
@@ -123,7 +125,7 @@ const OrganisationSchema = new mongoose_1.Schema({
|
|
|
123
125
|
{
|
|
124
126
|
files: [
|
|
125
127
|
{
|
|
126
|
-
type: mongoose_1.Schema.Types.ObjectId,
|
|
128
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
127
129
|
ref: "fs.files",
|
|
128
130
|
},
|
|
129
131
|
],
|
|
@@ -133,7 +135,7 @@ const OrganisationSchema = new mongoose_1.Schema({
|
|
|
133
135
|
{
|
|
134
136
|
files: [
|
|
135
137
|
{
|
|
136
|
-
type: mongoose_1.Schema.Types.ObjectId,
|
|
138
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
137
139
|
ref: "fs.files",
|
|
138
140
|
},
|
|
139
141
|
],
|
|
@@ -142,9 +144,18 @@ const OrganisationSchema = new mongoose_1.Schema({
|
|
|
142
144
|
},
|
|
143
145
|
customerOrg: {
|
|
144
146
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
145
|
-
ref: "
|
|
147
|
+
ref: "Organisation",
|
|
146
148
|
},
|
|
147
149
|
});
|
|
148
|
-
// Export the mongoose model with
|
|
149
|
-
|
|
150
|
+
// Export the mongoose model with generic typing and fallback logic
|
|
151
|
+
let OrganisationModel;
|
|
152
|
+
if (mongoose_1.default.models.Organisation) {
|
|
153
|
+
console.log("Organisation model already exists.");
|
|
154
|
+
OrganisationModel = mongoose_1.default.models.Organisation;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
console.log("Creating Organisation model fallback.");
|
|
158
|
+
OrganisationModel = mongoose_1.default.model("Organisation", OrganisationSchema);
|
|
159
|
+
}
|
|
160
|
+
exports.default = OrganisationModel;
|
|
150
161
|
//# sourceMappingURL=organisation.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organisation.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/organisation.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"organisation.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/organisation.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsD;AAuDtD,6BAA6B;AAC7B,MAAM,kBAAkB,GAAW,IAAI,iBAAM,CAAC;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,CAAC,IAAI,EAAE,kBAAkB,CAAC;QACpC,MAAM,EAAE,KAAK;KACd;IACD,WAAW,EAAE;QACX,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,KAAK;gBACxB,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,MAAM;wBACZ,MAAM,EAAE,MAAM;wBACd,QAAQ,EAAE,MAAM;qBACjB;iBACF;aACF;SACF;QACD,OAAO,EAAE,EAAE;KACZ;IACD,KAAK,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC;KACtC;IACD,GAAG,EAAE;QACH,IAAI,EAAE,MAAM;KACb;IACD,cAAc,EAAE;QACd;YACE,YAAY,EAAE;gBACZ,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,cAAc;KACxB;IACD,OAAO,EAAE;QACP,IAA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AAK,CAAC,QAAQ;wBACpC,GAAG,EAAE,UAAU;qBAChB;iBACF;aACF;SACF;QACD,eAAe,EAAE;YACf;gBACE,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;wBACpC,GAAG,EAAE,UAAU;qBAChB;iBACF;aACF;SACF;KACF;IACD,WAAW,EAAE;QACX,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;QACpC,GAAG,EAAE,cAAc;KACpB;CACF,CAAC,CAAC;AAEH,mEAAmE;AACnE,IAAI,iBAAgD,CAAC;AAErD,IAAI,kBAAQ,CAAC,MAAM,CAAC,YAAY,EAAE;IAChC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,iBAAiB,GAAG,kBAAQ,CAAC,MAAM,CAAC,YAA6C,CAAC;CACnF;KAAM;IACL,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrD,iBAAiB,GAAG,kBAAQ,CAAC,KAAK,CAAgB,cAAc,EAAE,kBAAkB,CAAC,CAAC;CACvF;AAED,kBAAe,iBAAiB,CAAC"}
|
package/dist/setupModal.js
CHANGED
|
@@ -46,9 +46,9 @@ exports.setupLibrary = setupLibrary;
|
|
|
46
46
|
* Getter for models with initialization check
|
|
47
47
|
*/
|
|
48
48
|
const checkInitialization = () => {
|
|
49
|
-
if (!modelsInitialized) {
|
|
50
|
-
|
|
51
|
-
}
|
|
49
|
+
// if (!modelsInitialized) {
|
|
50
|
+
// throw new Error("Library models are not initialized. Call `setupLibrary()` before using library features.");
|
|
51
|
+
// }
|
|
52
52
|
};
|
|
53
53
|
const getDocumentModel = () => {
|
|
54
54
|
checkInitialization();
|
package/dist/setupModal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupModal.js","sourceRoot":"","sources":["../src/setupModal.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AA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AM,kBAAkB,GAAG,GAAG,EAAE;IACrC,mBAAmB,EAAE,CAAC;IACtB,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
1
2
|
type address = {
|
|
2
3
|
shipping: any;
|
|
3
4
|
billing: any;
|
|
@@ -49,7 +50,11 @@ export declare function findOrgById(orgId: string): Promise<{
|
|
|
49
50
|
license: string;
|
|
50
51
|
} | null>;
|
|
51
52
|
export declare function updateorganisation(id: string, data: Partial<OrgProfile>): Promise<any>;
|
|
52
|
-
export declare function findOrgDetails(id: string): Promise<
|
|
53
|
+
export declare function findOrgDetails(id: string): Promise<mongoose.Document<unknown, {}, import("./schemas/organisation.schema").IOrganisation> & import("./schemas/organisation.schema").IOrganisation & Required<{
|
|
54
|
+
_id: unknown;
|
|
55
|
+
}> & {
|
|
56
|
+
__v: number;
|
|
57
|
+
}>;
|
|
53
58
|
export declare function getOrgDetails(searchValue: string, company: string, userId: string, sort: string | null, skip: string | null, limit: string | null): Promise<any>;
|
|
54
59
|
export declare function getCompliancesDetails(searchValue: string, company: string, userId: string, sort: string | null, skip: string | null, limit: string | null): Promise<any[] | Error>;
|
|
55
60
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import mongoose, { Document
|
|
1
|
+
import mongoose, { Document } from "mongoose";
|
|
2
2
|
export interface IExtracted extends Document {
|
|
3
3
|
created_At?: Date;
|
|
4
4
|
updated_At?: Date;
|
|
5
5
|
deleted_At?: Date;
|
|
6
|
-
fileId?:
|
|
7
|
-
data:
|
|
6
|
+
fileId?: mongoose.Types.ObjectId;
|
|
7
|
+
data: Record<string, any>;
|
|
8
8
|
}
|
|
9
|
-
declare
|
|
10
|
-
export default
|
|
9
|
+
declare let ExtractedModel: mongoose.Model<IExtracted> | null;
|
|
10
|
+
export default ExtractedModel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose, { Schema, Document } from
|
|
1
|
+
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
export interface ILog extends Document {
|
|
3
3
|
message: string;
|
|
4
4
|
type: string;
|
|
@@ -9,5 +9,5 @@ export interface ILog extends Document {
|
|
|
9
9
|
statuscode?: number;
|
|
10
10
|
}
|
|
11
11
|
export declare const LogSchema: Schema;
|
|
12
|
-
declare
|
|
13
|
-
export default
|
|
12
|
+
declare let LogModal: mongoose.Model<ILog>;
|
|
13
|
+
export default LogModal;
|
|
@@ -9,5 +9,5 @@ export interface INotifications extends Document {
|
|
|
9
9
|
notificationType: string;
|
|
10
10
|
deletedAt?: any;
|
|
11
11
|
}
|
|
12
|
-
declare
|
|
13
|
-
export default
|
|
12
|
+
declare let NotificationsModel: mongoose.Model<INotifications>;
|
|
13
|
+
export default NotificationsModel;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
import { Document } from 'mongoose';
|
|
1
|
+
import mongoose, { Document } from "mongoose";
|
|
3
2
|
export interface IGSTInformation {
|
|
4
3
|
gsttreatment: string;
|
|
5
4
|
businessgst: string;
|
|
@@ -44,7 +43,7 @@ export interface IOrganisation extends Document {
|
|
|
44
43
|
address: Address;
|
|
45
44
|
gstinformation?: IGSTInformation[];
|
|
46
45
|
customerOrg?: string;
|
|
47
|
-
deposits?:
|
|
46
|
+
deposits?: Record<string, any>;
|
|
48
47
|
}
|
|
49
|
-
declare
|
|
50
|
-
export default
|
|
48
|
+
declare let OrganisationModel: mongoose.Model<IOrganisation>;
|
|
49
|
+
export default OrganisationModel;
|
|
@@ -1,3 +1,30 @@
|
|
|
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/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="passport-local-mongoose" />
|
|
26
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
27
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
1
28
|
import { Request, Response } from 'express';
|
|
2
29
|
interface UserRequest extends Request {
|
|
3
30
|
user?: {
|
|
@@ -7,7 +34,11 @@ interface UserRequest extends Request {
|
|
|
7
34
|
}
|
|
8
35
|
export declare function createOrganizationService(req: any, res: Response): Promise<any>;
|
|
9
36
|
export declare function getOrgDetailsService(req: UserRequest, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
10
|
-
export declare function findOrgDetailsService(req: UserRequest, res: Response): Promise<
|
|
37
|
+
export declare function findOrgDetailsService(req: UserRequest, res: Response): Promise<(import("mongoose").Document<unknown, {}, import("../../repository/schemas/organisation.schema").IOrganisation> & import("../../repository/schemas/organisation.schema").IOrganisation & Required<{
|
|
38
|
+
_id: unknown;
|
|
39
|
+
}> & {
|
|
40
|
+
__v: number;
|
|
41
|
+
}) | Response<any, Record<string, any>>>;
|
|
11
42
|
export declare function updateOrganisationHandler(req: UserRequest, res: Response): Promise<Response>;
|
|
12
43
|
export declare function getOrganisationService(req: UserRequest, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
13
44
|
export declare function getComplainceCountService(req: UserRequest, res: Response): Promise<Response<any, Record<string, any>>>;
|
package/package.json
CHANGED
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
import mongoose, { Schema, Document
|
|
1
|
+
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
|
+
// Define the interface for Extracted
|
|
3
4
|
export interface IExtracted extends Document {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
created_At?: Date;
|
|
6
|
+
updated_At?: Date;
|
|
7
|
+
deleted_At?: Date;
|
|
8
|
+
fileId?: mongoose.Types.ObjectId;
|
|
9
|
+
data: Record<string, any>;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
12
|
+
// Define the extracted schema
|
|
13
|
+
const extractedSchema: Schema = new Schema({
|
|
14
|
+
created_At: {
|
|
15
|
+
type: Date,
|
|
16
|
+
default: Date.now,
|
|
17
|
+
},
|
|
18
|
+
updated_At: {
|
|
19
|
+
type: Date,
|
|
20
|
+
default: Date.now,
|
|
21
|
+
},
|
|
22
|
+
deleted_At: {
|
|
23
|
+
type: Date,
|
|
24
|
+
},
|
|
25
|
+
fileId: {
|
|
26
|
+
type: mongoose.Types.ObjectId,
|
|
27
|
+
ref: "fs.files",
|
|
28
|
+
},
|
|
29
|
+
data: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
// Handle model initialization
|
|
36
|
+
let ExtractedModel: mongoose.Model<IExtracted> | null = null;
|
|
34
37
|
|
|
38
|
+
if (mongoose.models.Extracted) {
|
|
39
|
+
console.log("Extracted model already exists.");
|
|
40
|
+
ExtractedModel = mongoose.models.Extracted;
|
|
41
|
+
} else {
|
|
42
|
+
console.log("Creating Extracted model fallback.");
|
|
43
|
+
ExtractedModel = mongoose.model<IExtracted>("Extracted", extractedSchema);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default ExtractedModel;
|
|
@@ -1,49 +1,57 @@
|
|
|
1
|
-
import mongoose, { Schema, Document } from
|
|
1
|
+
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
|
+
// Define interface
|
|
3
4
|
export interface ILog extends Document {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
message: string;
|
|
6
|
+
type: string;
|
|
7
|
+
logtype: string;
|
|
8
|
+
created_At: Date;
|
|
9
|
+
company?: string; // Made optional
|
|
10
|
+
user?: string; // Made optional
|
|
11
|
+
statuscode?: number;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
default: Date.now,
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
);
|
|
14
|
+
// Define schema
|
|
15
|
+
export const LogSchema: Schema = new mongoose.Schema({
|
|
16
|
+
statuscode: {
|
|
17
|
+
type: Number,
|
|
18
|
+
},
|
|
19
|
+
message: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: [true, "Message is required"], // Ensure message is required
|
|
22
|
+
},
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: [true, "Type is required"],
|
|
26
|
+
enum: ["log", "error", "warning", "info", "success"],
|
|
27
|
+
},
|
|
28
|
+
logtype: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: [true, "Logtype is required"],
|
|
31
|
+
},
|
|
32
|
+
company: {
|
|
33
|
+
type: mongoose.Types.ObjectId,
|
|
34
|
+
ref: "Organisation",
|
|
35
|
+
},
|
|
36
|
+
user: {
|
|
37
|
+
type: mongoose.Types.ObjectId,
|
|
38
|
+
ref: "Account",
|
|
39
|
+
},
|
|
40
|
+
created_At: {
|
|
41
|
+
type: Date,
|
|
42
|
+
default: Date.now,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
// Model initialization safely
|
|
47
|
+
let LogModal: mongoose.Model<ILog>;
|
|
48
|
+
|
|
49
|
+
if (mongoose.models.Log) {
|
|
50
|
+
console.log("Log model already exists.");
|
|
51
|
+
LogModal = mongoose.models.Log;
|
|
52
|
+
} else {
|
|
53
|
+
console.log("Creating Log model fallback.");
|
|
54
|
+
LogModal = mongoose.model<ILog>("Log", LogSchema);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default LogModal;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
|
+
// Interface for type safety
|
|
3
4
|
export interface INotifications extends Document {
|
|
4
5
|
role?: string;
|
|
5
6
|
user?: string;
|
|
@@ -11,6 +12,7 @@ export interface INotifications extends Document {
|
|
|
11
12
|
deletedAt?: any;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
// Define Notifications Schema
|
|
14
16
|
const NotificationsSchema: Schema = new mongoose.Schema(
|
|
15
17
|
{
|
|
16
18
|
workflow: {
|
|
@@ -35,9 +37,9 @@ const NotificationsSchema: Schema = new mongoose.Schema(
|
|
|
35
37
|
ref: "Account",
|
|
36
38
|
},
|
|
37
39
|
],
|
|
38
|
-
|
|
40
|
+
notificationType: {
|
|
39
41
|
type: String,
|
|
40
|
-
|
|
42
|
+
required: true,
|
|
41
43
|
},
|
|
42
44
|
documentId: {
|
|
43
45
|
type: String,
|
|
@@ -50,4 +52,15 @@ const NotificationsSchema: Schema = new mongoose.Schema(
|
|
|
50
52
|
{ timestamps: true }
|
|
51
53
|
);
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
// Safely initialize the Notifications model
|
|
56
|
+
let NotificationsModel: mongoose.Model<INotifications>;
|
|
57
|
+
|
|
58
|
+
if (mongoose.models.notification) {
|
|
59
|
+
console.log("Notification model already exists.");
|
|
60
|
+
NotificationsModel = mongoose.models.notification as mongoose.Model<INotifications>;
|
|
61
|
+
} else {
|
|
62
|
+
console.log("Creating notification model fallback.");
|
|
63
|
+
NotificationsModel = mongoose.model<INotifications>("notification", NotificationsSchema);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default NotificationsModel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import mongoose, { Schema } from "mongoose";
|
|
2
|
-
import { Document } from 'mongoose';
|
|
1
|
+
import mongoose, { Schema, Document } from "mongoose";
|
|
3
2
|
|
|
3
|
+
// Interfaces
|
|
4
4
|
export interface IGSTInformation {
|
|
5
5
|
gsttreatment: string;
|
|
6
6
|
businessgst: string;
|
|
@@ -38,6 +38,7 @@ export interface ICompliance {
|
|
|
38
38
|
compliant: IComplianceItem[];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// Organisation interface extending Document
|
|
41
42
|
export interface IOrganisation extends Document {
|
|
42
43
|
name: string;
|
|
43
44
|
compliances: ICompliance[];
|
|
@@ -49,10 +50,10 @@ export interface IOrganisation extends Document {
|
|
|
49
50
|
address: Address;
|
|
50
51
|
gstinformation?: IGSTInformation[];
|
|
51
52
|
customerOrg?: string;
|
|
52
|
-
deposits?:
|
|
53
|
+
deposits?: Record<string, any>;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
// Define
|
|
56
|
+
// Define Organisation schema
|
|
56
57
|
const OrganisationSchema: Schema = new Schema({
|
|
57
58
|
name: {
|
|
58
59
|
type: String,
|
|
@@ -64,27 +65,19 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
64
65
|
compliances: {
|
|
65
66
|
type: [
|
|
66
67
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
info: {
|
|
71
|
-
type: Object,
|
|
72
|
-
},
|
|
68
|
+
type: String,
|
|
69
|
+
file: String,
|
|
70
|
+
info: Schema.Types.Mixed,
|
|
73
71
|
compliant: [
|
|
74
72
|
{
|
|
75
|
-
date:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
status: {
|
|
79
|
-
type: String,
|
|
80
|
-
},
|
|
81
|
-
moreinfo: {
|
|
82
|
-
type: String,
|
|
83
|
-
},
|
|
73
|
+
date: String,
|
|
74
|
+
status: String,
|
|
75
|
+
moreinfo: String,
|
|
84
76
|
},
|
|
85
77
|
],
|
|
86
78
|
},
|
|
87
79
|
],
|
|
80
|
+
default: [],
|
|
88
81
|
},
|
|
89
82
|
gstin: {
|
|
90
83
|
type: String,
|
|
@@ -114,24 +107,34 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
114
107
|
},
|
|
115
108
|
address: {
|
|
116
109
|
billing: {
|
|
117
|
-
type:
|
|
110
|
+
street: { type: String },
|
|
111
|
+
city: { type: String },
|
|
112
|
+
state: { type: String },
|
|
113
|
+
pin: { type: String },
|
|
114
|
+
country: { type: String },
|
|
115
|
+
phone: { type: String },
|
|
118
116
|
},
|
|
119
117
|
shipping: {
|
|
120
|
-
type:
|
|
118
|
+
street: { type: String },
|
|
119
|
+
city: { type: String },
|
|
120
|
+
state: { type: String },
|
|
121
|
+
pin: { type: String },
|
|
122
|
+
country: { type: String },
|
|
123
|
+
phone: { type: String },
|
|
121
124
|
},
|
|
122
125
|
},
|
|
123
126
|
bankDetails: {
|
|
124
|
-
type:
|
|
127
|
+
type: Schema.Types.Mixed,
|
|
125
128
|
},
|
|
126
129
|
deposits: {
|
|
127
|
-
type:
|
|
130
|
+
type: Schema.Types.Mixed,
|
|
128
131
|
},
|
|
129
132
|
certificates: {
|
|
130
133
|
msme: [
|
|
131
134
|
{
|
|
132
135
|
files: [
|
|
133
136
|
{
|
|
134
|
-
type: Schema.Types.ObjectId,
|
|
137
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
135
138
|
ref: "fs.files",
|
|
136
139
|
},
|
|
137
140
|
],
|
|
@@ -141,7 +144,7 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
141
144
|
{
|
|
142
145
|
files: [
|
|
143
146
|
{
|
|
144
|
-
type: Schema.Types.ObjectId,
|
|
147
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
145
148
|
ref: "fs.files",
|
|
146
149
|
},
|
|
147
150
|
],
|
|
@@ -151,7 +154,7 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
151
154
|
{
|
|
152
155
|
files: [
|
|
153
156
|
{
|
|
154
|
-
type: Schema.Types.ObjectId,
|
|
157
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
155
158
|
ref: "fs.files",
|
|
156
159
|
},
|
|
157
160
|
],
|
|
@@ -161,7 +164,7 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
161
164
|
{
|
|
162
165
|
files: [
|
|
163
166
|
{
|
|
164
|
-
type: Schema.Types.ObjectId,
|
|
167
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
165
168
|
ref: "fs.files",
|
|
166
169
|
},
|
|
167
170
|
],
|
|
@@ -170,10 +173,19 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
170
173
|
},
|
|
171
174
|
customerOrg: {
|
|
172
175
|
type: mongoose.Schema.Types.ObjectId,
|
|
173
|
-
ref: "
|
|
176
|
+
ref: "Organisation",
|
|
174
177
|
},
|
|
175
178
|
});
|
|
176
179
|
|
|
177
|
-
// Export the mongoose model with
|
|
178
|
-
|
|
180
|
+
// Export the mongoose model with generic typing and fallback logic
|
|
181
|
+
let OrganisationModel: mongoose.Model<IOrganisation>;
|
|
182
|
+
|
|
183
|
+
if (mongoose.models.Organisation) {
|
|
184
|
+
console.log("Organisation model already exists.");
|
|
185
|
+
OrganisationModel = mongoose.models.Organisation as mongoose.Model<IOrganisation>;
|
|
186
|
+
} else {
|
|
187
|
+
console.log("Creating Organisation model fallback.");
|
|
188
|
+
OrganisationModel = mongoose.model<IOrganisation>("Organisation", OrganisationSchema);
|
|
189
|
+
}
|
|
179
190
|
|
|
191
|
+
export default OrganisationModel;
|
package/src/setupModal.ts
CHANGED
|
@@ -48,9 +48,9 @@ export const setupLibrary = (connection: typeof mongoose) => {
|
|
|
48
48
|
* Getter for models with initialization check
|
|
49
49
|
*/
|
|
50
50
|
const checkInitialization = () => {
|
|
51
|
-
if (!modelsInitialized) {
|
|
52
|
-
|
|
53
|
-
}
|
|
51
|
+
// if (!modelsInitialized) {
|
|
52
|
+
// throw new Error("Library models are not initialized. Call `setupLibrary()` before using library features.");
|
|
53
|
+
// }
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export const getDocumentModel = () => {
|