my-typescript-library-rahul52us 1.3.4 → 1.3.6
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/config/auth/passportConfig.js +1 -0
- package/dist/config/auth/passportConfig.js.map +1 -1
- package/dist/controllers/auth.controller.js.map +1 -1
- package/dist/controllers/license/license.controller.js +1 -1
- package/dist/controllers/license/license.controller.js.map +1 -1
- package/dist/controllers/rbac/rbac.controller.js +1 -5
- package/dist/controllers/rbac/rbac.controller.js.map +1 -1
- package/dist/repository/document.repository.js +174 -22
- package/dist/repository/document.repository.js.map +1 -1
- package/dist/repository/filesystem.repository.js +3 -3
- package/dist/repository/filesystem.repository.js.map +1 -1
- package/dist/repository/log.repository.js.map +1 -1
- package/dist/repository/notifications.repository.js.map +1 -1
- package/dist/repository/organisation.repository.js.map +1 -1
- package/dist/repository/schemas/accountdetails.schema.js.map +1 -1
- package/dist/repository/schemas/accounts.schema.js +10 -33
- package/dist/repository/schemas/accounts.schema.js.map +1 -1
- package/dist/repository/schemas/document.schema.js +12 -19
- package/dist/repository/schemas/document.schema.js.map +1 -1
- package/dist/repository/schemas/extracted.schema.js +3 -5
- package/dist/repository/schemas/extracted.schema.js.map +1 -1
- package/dist/repository/schemas/fileSystem.schema.js +2 -5
- package/dist/repository/schemas/fileSystem.schema.js.map +1 -1
- package/dist/repository/schemas/form.schema.js +1 -1
- package/dist/repository/schemas/form.schema.js.map +1 -1
- package/dist/repository/schemas/log.schema.js +4 -4
- package/dist/repository/schemas/log.schema.js.map +1 -1
- package/dist/repository/schemas/notifications.schema.js +2 -3
- package/dist/repository/schemas/notifications.schema.js.map +1 -1
- package/dist/repository/schemas/organisation.schema.js +25 -29
- package/dist/repository/schemas/organisation.schema.js.map +1 -1
- package/dist/repository/schemas/profile.schema.js +1 -1
- package/dist/repository/schemas/profile.schema.js.map +1 -1
- package/dist/repository/schemas/role.schema.js +1 -1
- package/dist/repository/schemas/role.schema.js.map +1 -1
- package/dist/repository/schemas/tokens.schema.js +5 -5
- package/dist/repository/schemas/tokens.schema.js.map +1 -1
- package/dist/repository/schemas/userrole.schema.js +1 -1
- package/dist/repository/schemas/userrole.schema.js.map +1 -1
- package/dist/repository/schemas/workflow.schema.js +14 -40
- package/dist/repository/schemas/workflow.schema.js.map +1 -1
- package/dist/repository/user.repository.js +32 -20
- package/dist/repository/user.repository.js.map +1 -1
- package/dist/repository/user_tokens.repository.js.map +1 -1
- package/dist/repository/userrole.repository.js +1 -1
- package/dist/repository/userrole.repository.js.map +1 -1
- package/dist/repository/workflow.repository.js +0 -1
- package/dist/repository/workflow.repository.js.map +1 -1
- package/dist/routes/auth.route.js +6 -5
- package/dist/routes/auth.route.js.map +1 -1
- package/dist/routes/document.route.js +2 -0
- package/dist/routes/document.route.js.map +1 -1
- package/dist/routes/fileSystem.route.js +1 -0
- package/dist/routes/fileSystem.route.js.map +1 -1
- package/dist/routes/form.route.js +1 -1
- package/dist/routes/form.route.js.map +1 -1
- package/dist/routes/index.js +1 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/log.route.js +1 -1
- package/dist/routes/log.route.js.map +1 -1
- package/dist/routes/notifications.route.js +1 -1
- package/dist/routes/notifications.route.js.map +1 -1
- package/dist/routes/profile.route.js +4 -3
- package/dist/routes/profile.route.js.map +1 -1
- package/dist/routes/role.route.js +7 -4
- package/dist/routes/role.route.js.map +1 -1
- package/dist/routes/user.route.js +10 -8
- package/dist/routes/user.route.js.map +1 -1
- package/dist/routes/userrole.route.js +6 -4
- package/dist/routes/userrole.route.js.map +1 -1
- package/dist/routes/workflow.route.js.map +1 -1
- package/dist/server.js +1 -3
- package/dist/server.js.map +1 -1
- package/dist/services/apikey/apikey.service.js +102 -0
- package/dist/services/apikey/apikey.service.js.map +1 -0
- package/dist/services/authentication/change-password.service.js +1 -1
- package/dist/services/authentication/change-password.service.js.map +1 -1
- package/dist/services/authentication/forgot-password.service.js.map +1 -1
- package/dist/services/authentication/login.service.js.map +1 -1
- package/dist/services/authentication/register.service.js.map +1 -1
- package/dist/services/authentication/resend-email.service.js.map +1 -1
- package/dist/services/authentication/reset-password.service.js +25 -7
- package/dist/services/authentication/reset-password.service.js.map +1 -1
- package/dist/services/authentication/verify-email.service.js.map +1 -1
- package/dist/services/document/document.services.js +172 -89
- package/dist/services/document/document.services.js.map +1 -1
- package/dist/services/document/dummy.js +85 -0
- package/dist/services/document/dummy.js.map +1 -0
- package/dist/services/fileSystem/fileSystem.service.js.map +1 -1
- package/dist/services/logs/vendorLog.service.js +1 -1
- package/dist/services/logs/vendorLog.service.js.map +1 -1
- package/dist/services/notifications/notifications.service.js.map +1 -1
- package/dist/services/organisation/organisation.service.js.map +1 -1
- package/dist/services/profile/profile.services.js.map +1 -1
- package/dist/services/userroles/userrole.service.js.map +1 -1
- package/dist/services/workflow/workflow.service.js +2 -0
- package/dist/services/workflow/workflow.service.js.map +1 -1
- package/dist/types/controllers/auth.controller.d.ts +3 -3
- package/dist/types/repository/document.repository.d.ts +56 -16
- package/dist/types/repository/form.repository.d.ts +7 -3
- package/dist/types/repository/organisation.repository.d.ts +1 -6
- package/dist/types/repository/profile.repository.d.ts +4 -3
- package/dist/types/repository/role.repository.d.ts +5 -2
- package/dist/types/repository/schemas/accounts.schema.d.ts +14 -11
- package/dist/types/repository/schemas/document.schema.d.ts +4 -4
- package/dist/types/repository/schemas/extracted.schema.d.ts +3 -3
- package/dist/types/repository/schemas/fileSystem.schema.d.ts +2 -6
- package/dist/types/repository/schemas/form.schema.d.ts +1 -1
- package/dist/types/repository/schemas/organisation.schema.d.ts +11 -11
- package/dist/types/repository/schemas/profile.schema.d.ts +1 -1
- package/dist/types/repository/schemas/role.schema.d.ts +1 -1
- package/dist/types/repository/schemas/userrole.schema.d.ts +1 -1
- package/dist/types/repository/schemas/workflow.schema.d.ts +2 -14
- package/dist/types/repository/user.repository.d.ts +45 -16
- package/dist/types/repository/userrole.repository.d.ts +5 -2
- package/dist/types/repository/workflow.repository.d.ts +4 -38
- package/dist/types/server.d.ts +0 -1
- package/dist/types/services/apikey/apikey.service.d.ts +12 -0
- package/dist/types/services/authentication/change-password.service.d.ts +1 -1
- package/dist/types/services/authentication/forgot-password.service.d.ts +2 -2
- package/dist/types/services/authentication/getuser.service.d.ts +29 -3
- package/dist/types/services/authentication/login.service.d.ts +1 -1
- package/dist/types/services/authentication/register.admin.service.d.ts +1 -1
- package/dist/types/services/authentication/register.service.d.ts +1 -1
- package/dist/types/services/authentication/resend-email.service.d.ts +2 -2
- package/dist/types/services/authentication/reset-password.service.d.ts +2 -2
- package/dist/types/services/authentication/verify-email.service.d.ts +1 -1
- package/dist/types/services/document/document.services.d.ts +42 -12
- package/dist/types/services/document/dummy.d.ts +45 -0
- package/dist/types/services/logs/log.service.d.ts +1 -1
- package/dist/types/services/profile/profile.services.d.ts +3 -3
- package/dist/types/services/roles/role.services.d.ts +33 -5
- package/dist/types/services/userroles/userrole.service.d.ts +5 -13
- package/dist/types/services/workflow/workflow.service.d.ts +2 -2
- package/dist/types/utils/common.d.ts +5 -0
- package/dist/utils/common.js +23 -1
- package/dist/utils/common.js.map +1 -1
- package/dist/utils/log.service.js +1 -1
- package/dist/utils/log.service.js.map +1 -1
- package/package.json +1 -1
- package/src/config/auth/passportConfig.ts +3 -0
- package/src/controllers/auth.controller.ts +2 -2
- package/src/controllers/license/license.controller.ts +1 -1
- package/src/controllers/rbac/rbac.controller.ts +1 -2
- package/src/repository/document.repository.ts +221 -37
- package/src/repository/filesystem.repository.ts +4 -4
- package/src/repository/form.repository.ts +4 -4
- package/src/repository/log.repository.ts +1 -1
- package/src/repository/notifications.repository.ts +1 -3
- package/src/repository/organisation.repository.ts +1 -2
- package/src/repository/profile.repository.ts +1 -1
- package/src/repository/role.repository.ts +1 -1
- package/src/repository/schemas/WorkflowSettingsScheme.ts +0 -2
- package/src/repository/schemas/accountdetails.schema.ts +2 -5
- package/src/repository/schemas/accounts.schema.ts +30 -31
- package/src/repository/schemas/document.schema.ts +15 -18
- package/src/repository/schemas/extracted.schema.ts +28 -31
- package/src/repository/schemas/fileSystem.schema.ts +4 -7
- package/src/repository/schemas/form.schema.ts +1 -2
- package/src/repository/schemas/log.schema.ts +6 -7
- package/src/repository/schemas/notifications.schema.ts +2 -4
- package/src/repository/schemas/organisation.schema.ts +44 -51
- package/src/repository/schemas/profile.schema.ts +1 -2
- package/src/repository/schemas/role.schema.ts +1 -2
- package/src/repository/schemas/tokens.schema.ts +18 -20
- package/src/repository/schemas/userrole.schema.ts +1 -2
- package/src/repository/schemas/workflow.schema.ts +41 -61
- package/src/repository/user.repository.ts +74 -56
- package/src/repository/user_tokens.repository.ts +1 -1
- package/src/repository/userrole.repository.ts +3 -3
- package/src/repository/workflow.repository.ts +4 -5
- package/src/routes/auth.route.ts +6 -5
- package/src/routes/document.route.ts +5 -1
- package/src/routes/fileSystem.route.ts +2 -0
- package/src/routes/form.route.ts +6 -1
- package/src/routes/index.ts +2 -1
- package/src/routes/log.route.ts +2 -4
- package/src/routes/notifications.route.ts +2 -2
- package/src/routes/org.route.ts +1 -1
- package/src/routes/profile.route.ts +4 -3
- package/src/routes/role.route.ts +7 -4
- package/src/routes/user.route.ts +29 -7
- package/src/routes/userrole.route.ts +6 -4
- package/src/routes/workflow.route.ts +10 -2
- package/src/server.ts +0 -1
- package/src/services/authentication/change-password.service.ts +3 -7
- package/src/services/authentication/forgot-password.service.ts +2 -2
- package/src/services/authentication/login.service.ts +1 -1
- package/src/services/authentication/register.admin.service.ts +1 -1
- package/src/services/authentication/register.service.ts +0 -2
- package/src/services/authentication/resend-email.service.ts +2 -3
- package/src/services/authentication/reset-password.service.ts +33 -12
- package/src/services/authentication/verify-email.service.ts +1 -1
- package/src/services/document/document.services.ts +216 -119
- package/src/services/document/dummy.ts +81 -0
- package/src/services/fileSystem/fileSystem.service.ts +3 -3
- package/src/services/logs/log.service.ts +1 -1
- package/src/services/logs/vendorLog.service.ts +1 -1
- package/src/services/notifications/notifications.service.ts +8 -9
- package/src/services/organisation/organisation.service.ts +5 -7
- package/src/services/profile/profile.services.ts +4 -7
- package/src/services/roles/role.services.ts +4 -4
- package/src/services/statement/accountdetails.service.ts +1 -1
- package/src/services/userroles/userrole.service.ts +5 -6
- package/src/services/workflow/workSettings.service.ts +1 -1
- package/src/services/workflow/workflow.service.ts +11 -5
- package/src/utils/common.ts +36 -13
- package/src/utils/log.service.ts +1 -1
- package/.vscode/extensions.json +0 -5
- package/dist/controllers/rbac/grantaccess.json +0 -72
- package/dist/setupModal.js +0 -58
- package/dist/setupModal.js.map +0 -1
- package/dist/types/setupModal.d.ts +0 -7
- package/src/setupModal.ts +0 -60
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import mongoose, { Schema, Document, Model } from "mongoose";
|
|
2
2
|
import passportLocalMongoose from "passport-local-mongoose";
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
|
|
4
|
+
// Interface definition for the Account Document
|
|
5
|
+
interface IAccount extends Document {
|
|
6
6
|
name: string;
|
|
7
7
|
username: string;
|
|
8
8
|
moNumber: string;
|
|
9
|
-
role?: string;
|
|
9
|
+
role?: string;
|
|
10
10
|
userType?: string;
|
|
11
11
|
approvalType?: string;
|
|
12
12
|
avatarUrl?: string;
|
|
13
13
|
is_active?: boolean;
|
|
14
|
-
createdAt?:
|
|
15
|
-
updatedAt?:
|
|
16
|
-
deletedAt?:
|
|
17
|
-
company?:
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
deletedAt?: Date;
|
|
17
|
+
company?: mongoose.Types.ObjectId;
|
|
18
18
|
permission?: string[];
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
clientOrg?: string;
|
|
20
|
+
|
|
21
|
+
// Added missing fields
|
|
22
|
+
designation?: string;
|
|
23
|
+
level?: string;
|
|
24
|
+
defaultWorkflow?: mongoose.Types.ObjectId;
|
|
25
|
+
userPermission?: string[];
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
//
|
|
28
|
+
// Extend the Mongoose Model interface to include `register`
|
|
24
29
|
interface IAccountModel extends Model<IAccount> {
|
|
25
|
-
register(
|
|
26
|
-
authenticate
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cb: (err: any, user?: IAccount | false) => void
|
|
30
|
-
) => void;
|
|
31
|
-
serializeUser(): (user: IAccount, done: (err: any, id?: any) => void) => void;
|
|
32
|
-
deserializeUser(): (id: any, done: (err: any, user?: IAccount | null) => void) => void;
|
|
33
|
-
}
|
|
30
|
+
register(email: string, password: string): Promise<IAccount>;
|
|
31
|
+
authenticate: any;
|
|
32
|
+
serializeUser: any;
|
|
33
|
+
deserializeUser: any;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
}
|
|
36
|
+
// Define your schema
|
|
37
|
+
const AccountSchema: Schema = new mongoose.Schema<IAccount>({
|
|
37
38
|
name: {
|
|
38
39
|
type: String,
|
|
39
40
|
trim: true,
|
|
@@ -44,14 +45,14 @@ const AccountSchema: Schema = new Schema({
|
|
|
44
45
|
trim: true,
|
|
45
46
|
lowercase: true,
|
|
46
47
|
unique: true,
|
|
47
|
-
required: [true,
|
|
48
|
+
required: [true, 'Email address is required'],
|
|
48
49
|
},
|
|
49
50
|
designation: {
|
|
50
51
|
type: String,
|
|
51
52
|
},
|
|
52
53
|
userType: {
|
|
53
54
|
type: String,
|
|
54
|
-
default:
|
|
55
|
+
default: 'user',
|
|
55
56
|
},
|
|
56
57
|
role: {
|
|
57
58
|
type: String,
|
|
@@ -59,7 +60,7 @@ const AccountSchema: Schema = new Schema({
|
|
|
59
60
|
},
|
|
60
61
|
level: {
|
|
61
62
|
type: String,
|
|
62
|
-
default:
|
|
63
|
+
default: 'admin',
|
|
63
64
|
},
|
|
64
65
|
avatarUrl: {
|
|
65
66
|
type: String,
|
|
@@ -79,12 +80,12 @@ const AccountSchema: Schema = new Schema({
|
|
|
79
80
|
type: Date,
|
|
80
81
|
},
|
|
81
82
|
company: {
|
|
82
|
-
type: mongoose.Types.ObjectId,
|
|
83
|
-
ref:
|
|
83
|
+
type: mongoose.Schema.Types.ObjectId, // Fixed type issue here
|
|
84
|
+
ref: 'Organisation',
|
|
84
85
|
},
|
|
85
86
|
defaultWorkflow: {
|
|
86
87
|
type: mongoose.Schema.Types.ObjectId,
|
|
87
|
-
ref:
|
|
88
|
+
ref: 'WorkFlow',
|
|
88
89
|
},
|
|
89
90
|
permission: {
|
|
90
91
|
type: [String],
|
|
@@ -94,7 +95,7 @@ const AccountSchema: Schema = new Schema({
|
|
|
94
95
|
},
|
|
95
96
|
});
|
|
96
97
|
|
|
97
|
-
//
|
|
98
|
+
// Apply the passportLocalMongoose plugin
|
|
98
99
|
AccountSchema.plugin(passportLocalMongoose);
|
|
99
100
|
|
|
100
101
|
let AccountModel: IAccountModel;
|
|
@@ -105,6 +106,4 @@ if (mongoose.models.Account) {
|
|
|
105
106
|
AccountModel = mongoose.model<IAccount, IAccountModel>("Account", AccountSchema);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
export default AccountModel;
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
export default AccountModel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose, { Schema } from "mongoose";
|
|
1
|
+
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
3
|
export interface IDocument extends Document {
|
|
4
4
|
documentId?: string;
|
|
@@ -13,7 +13,9 @@ export interface IDocument extends Document {
|
|
|
13
13
|
user?: string;
|
|
14
14
|
tags?: any;
|
|
15
15
|
additionalFiles?: any;
|
|
16
|
+
isguaranteed?:boolean
|
|
16
17
|
}
|
|
18
|
+
|
|
17
19
|
export interface IApproval extends Document {
|
|
18
20
|
comment?: string;
|
|
19
21
|
status: string;
|
|
@@ -22,7 +24,7 @@ export interface IApproval extends Document {
|
|
|
22
24
|
userId?: mongoose.Types.ObjectId;
|
|
23
25
|
createdAt: any;
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
const ApprovalSchema: Schema = new mongoose.Schema({
|
|
26
28
|
comment: {
|
|
27
29
|
type: String,
|
|
28
30
|
default: "",
|
|
@@ -55,7 +57,7 @@ export const ApprovalSchema: Schema = new mongoose.Schema({
|
|
|
55
57
|
},
|
|
56
58
|
createdAt: {
|
|
57
59
|
type: Date,
|
|
58
|
-
default: new Date()
|
|
60
|
+
default : new Date()
|
|
59
61
|
},
|
|
60
62
|
updatedAt: {
|
|
61
63
|
type: Date,
|
|
@@ -71,17 +73,9 @@ export const DocumentSchema: Schema = new mongoose.Schema({
|
|
|
71
73
|
type: mongoose.Schema.Types.ObjectId,
|
|
72
74
|
default: "WorkFlow",
|
|
73
75
|
},
|
|
74
|
-
|
|
75
|
-
type :
|
|
76
|
-
default :
|
|
77
|
-
},
|
|
78
|
-
partnerId : {
|
|
79
|
-
type : String,
|
|
80
|
-
default : ""
|
|
81
|
-
},
|
|
82
|
-
order_taken_by:{
|
|
83
|
-
type : String,
|
|
84
|
-
default : ""
|
|
76
|
+
isguaranteed:{
|
|
77
|
+
type : Boolean,
|
|
78
|
+
default : false
|
|
85
79
|
},
|
|
86
80
|
company: {
|
|
87
81
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -135,6 +129,7 @@ export const DocumentSchema: Schema = new mongoose.Schema({
|
|
|
135
129
|
},
|
|
136
130
|
status: {
|
|
137
131
|
type: String,
|
|
132
|
+
default : 'pending'
|
|
138
133
|
},
|
|
139
134
|
helpInfo: {
|
|
140
135
|
type: mongoose.Schema.Types.Mixed,
|
|
@@ -142,14 +137,16 @@ export const DocumentSchema: Schema = new mongoose.Schema({
|
|
|
142
137
|
}
|
|
143
138
|
});
|
|
144
139
|
|
|
145
|
-
|
|
140
|
+
|
|
141
|
+
let DocumentModal: mongoose.Model<any> | null = null;
|
|
146
142
|
|
|
147
143
|
if (mongoose.models.Document) {
|
|
148
144
|
console.log("Document model already exists.");
|
|
149
|
-
|
|
145
|
+
DocumentModal = mongoose.models.Document;
|
|
150
146
|
} else {
|
|
151
147
|
console.log("Creating Document model fallback.");
|
|
152
|
-
|
|
148
|
+
DocumentModal = mongoose.model<any>("Document", DocumentSchema);
|
|
153
149
|
}
|
|
154
150
|
|
|
155
|
-
export default
|
|
151
|
+
export default DocumentModal;
|
|
152
|
+
|
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
import mongoose, { Schema, Document } from "mongoose";
|
|
1
|
+
import mongoose, { Schema, Document, Date } from "mongoose";
|
|
2
2
|
|
|
3
|
-
// Define the interface for Extracted
|
|
4
3
|
export interface IExtracted extends Document {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
created_At?: Date;
|
|
5
|
+
updated_At?: Date;
|
|
6
|
+
deleted_At?: Date;
|
|
7
|
+
fileId?: string;
|
|
8
|
+
data: object;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
11
|
+
const extractedSchema = new Schema({
|
|
12
|
+
created_At: {
|
|
13
|
+
type: Date,
|
|
14
|
+
default: Date.now,
|
|
15
|
+
},
|
|
16
|
+
updated_At: {
|
|
17
|
+
type: Date,
|
|
18
|
+
default: Date.now,
|
|
19
|
+
},
|
|
20
|
+
deleted_At: {
|
|
21
|
+
type: Date,
|
|
22
|
+
},
|
|
23
|
+
fileId: {
|
|
24
|
+
type: mongoose.Types.ObjectId,
|
|
25
|
+
ref: "fs.files"
|
|
26
|
+
},
|
|
27
|
+
data: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true
|
|
30
|
+
}
|
|
31
|
+
})
|
|
34
32
|
|
|
35
|
-
// Handle model initialization
|
|
36
33
|
let ExtractedModel: mongoose.Model<IExtracted> | null = null;
|
|
37
34
|
|
|
38
35
|
if (mongoose.models.Extracted) {
|
|
@@ -43,4 +40,4 @@ if (mongoose.models.Extracted) {
|
|
|
43
40
|
ExtractedModel = mongoose.model<IExtracted>("Extracted", extractedSchema);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
export default ExtractedModel;
|
|
43
|
+
export default ExtractedModel;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import mongoose, { Document, Model, Schema } from "mongoose";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export interface IFileSystemSchema extends Document {
|
|
3
|
+
interface IfileSystemSchema extends Document {
|
|
5
4
|
fileId: mongoose.Types.ObjectId;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
export const fileSystemSchema: Schema = new Schema(
|
|
7
|
+
const fileSystemSchema: Schema = new Schema(
|
|
10
8
|
{
|
|
11
9
|
fileId: {
|
|
12
10
|
type: mongoose.Types.ObjectId,
|
|
13
11
|
index: true,
|
|
14
|
-
required: true, // Ensure it's a required field to align with interface expectations
|
|
15
12
|
},
|
|
16
13
|
},
|
|
17
14
|
{ timestamps: true }
|
|
18
15
|
);
|
|
19
16
|
|
|
20
17
|
// Handle Model Initialization
|
|
21
|
-
let FileSystemModel: Model<
|
|
18
|
+
let FileSystemModel: Model<any> | null = null;
|
|
22
19
|
|
|
23
20
|
// Check if the model already exists to avoid overwriting during hot reloads
|
|
24
21
|
if (mongoose.models.FileSystem) {
|
|
25
22
|
FileSystemModel = mongoose.models.FileSystem;
|
|
26
23
|
} else {
|
|
27
|
-
FileSystemModel = mongoose.model<
|
|
24
|
+
FileSystemModel = mongoose.model<any>("FileSystem", fileSystemSchema);
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
export default FileSystemModel;
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
|
-
// Define interface
|
|
4
3
|
export interface ILog extends Document {
|
|
5
4
|
message: string;
|
|
6
5
|
type: string;
|
|
7
6
|
logtype: string;
|
|
8
7
|
created_At: Date;
|
|
9
|
-
company?: string;
|
|
10
|
-
user?: string;
|
|
8
|
+
company?: string;
|
|
9
|
+
user?: string;
|
|
11
10
|
statuscode?: number;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
// Define schema
|
|
15
13
|
export const LogSchema: Schema = new mongoose.Schema({
|
|
16
14
|
statuscode: {
|
|
17
15
|
type: Number,
|
|
18
16
|
},
|
|
19
17
|
message: {
|
|
20
18
|
type: String,
|
|
21
|
-
required: [true, "Message is required"], // Ensure message is required
|
|
22
19
|
},
|
|
23
20
|
type: {
|
|
24
21
|
type: String,
|
|
25
|
-
|
|
22
|
+
value: String,
|
|
23
|
+
required: [true, "type is required"],
|
|
26
24
|
enum: ["log", "error", "warning", "info", "success"],
|
|
27
25
|
},
|
|
28
26
|
logtype: {
|
|
@@ -31,10 +29,12 @@ export const LogSchema: Schema = new mongoose.Schema({
|
|
|
31
29
|
},
|
|
32
30
|
company: {
|
|
33
31
|
type: mongoose.Types.ObjectId,
|
|
32
|
+
required: [true, "User is not logged in"],
|
|
34
33
|
ref: "Organisation",
|
|
35
34
|
},
|
|
36
35
|
user: {
|
|
37
36
|
type: mongoose.Types.ObjectId,
|
|
37
|
+
required: [true, "User is not logged in"],
|
|
38
38
|
ref: "Account",
|
|
39
39
|
},
|
|
40
40
|
created_At: {
|
|
@@ -43,7 +43,6 @@ export const LogSchema: Schema = new mongoose.Schema({
|
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
// Model initialization safely
|
|
47
46
|
let LogModal: mongoose.Model<ILog>;
|
|
48
47
|
|
|
49
48
|
if (mongoose.models.Log) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
|
-
// Interface for type safety
|
|
4
3
|
export interface INotifications extends Document {
|
|
5
4
|
role?: string;
|
|
6
5
|
user?: string;
|
|
@@ -12,7 +11,6 @@ export interface INotifications extends Document {
|
|
|
12
11
|
deletedAt?: any;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
// Define Notifications Schema
|
|
16
14
|
const NotificationsSchema: Schema = new mongoose.Schema(
|
|
17
15
|
{
|
|
18
16
|
workflow: {
|
|
@@ -37,9 +35,9 @@ const NotificationsSchema: Schema = new mongoose.Schema(
|
|
|
37
35
|
ref: "Account",
|
|
38
36
|
},
|
|
39
37
|
],
|
|
40
|
-
|
|
38
|
+
type: {
|
|
41
39
|
type: String,
|
|
42
|
-
|
|
40
|
+
default: null,
|
|
43
41
|
},
|
|
44
42
|
documentId: {
|
|
45
43
|
type: String,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export interface IGSTInformation {
|
|
3
|
+
interface IGSTInformation {
|
|
5
4
|
gsttreatment: string;
|
|
6
5
|
businessgst: string;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
type address = {
|
|
10
9
|
billing?: {
|
|
11
10
|
street: string;
|
|
12
11
|
city: string;
|
|
@@ -24,22 +23,20 @@ export type Address = {
|
|
|
24
23
|
phone: string;
|
|
25
24
|
};
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
export interface IComplianceItem {
|
|
29
|
-
date: string;
|
|
30
|
-
status: string;
|
|
31
|
-
moreinfo: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface ICompliance {
|
|
26
|
+
interface ICompliance {
|
|
35
27
|
type: string;
|
|
36
28
|
file: string;
|
|
37
29
|
info: object;
|
|
38
30
|
compliant: IComplianceItem[];
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
interface IComplianceItem {
|
|
34
|
+
date: string;
|
|
35
|
+
status: string;
|
|
36
|
+
moreinfo: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface IOrganisation extends Document {
|
|
43
40
|
name: string;
|
|
44
41
|
compliances: ICompliance[];
|
|
45
42
|
domain?: string;
|
|
@@ -47,14 +44,13 @@ export interface IOrganisation extends Document {
|
|
|
47
44
|
gstin: string;
|
|
48
45
|
pan?: string;
|
|
49
46
|
license: string;
|
|
50
|
-
address:
|
|
47
|
+
address: address;
|
|
51
48
|
gstinformation?: IGSTInformation[];
|
|
52
49
|
customerOrg?: string;
|
|
53
|
-
deposits?:
|
|
50
|
+
deposits?: object;
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
const OrganisationSchema: Schema = new Schema({
|
|
53
|
+
const OrganisationSchema: Schema = new mongoose.Schema({
|
|
58
54
|
name: {
|
|
59
55
|
type: String,
|
|
60
56
|
trim: true,
|
|
@@ -65,19 +61,27 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
65
61
|
compliances: {
|
|
66
62
|
type: [
|
|
67
63
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
file: {
|
|
65
|
+
type: String,
|
|
66
|
+
},
|
|
67
|
+
info: {
|
|
68
|
+
type: Object,
|
|
69
|
+
},
|
|
71
70
|
compliant: [
|
|
72
71
|
{
|
|
73
|
-
date:
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
date: {
|
|
73
|
+
type: String,
|
|
74
|
+
},
|
|
75
|
+
status: {
|
|
76
|
+
type: String,
|
|
77
|
+
},
|
|
78
|
+
moreinfo: {
|
|
79
|
+
type: String,
|
|
80
|
+
},
|
|
76
81
|
},
|
|
77
82
|
],
|
|
78
83
|
},
|
|
79
84
|
],
|
|
80
|
-
default: [],
|
|
81
85
|
},
|
|
82
86
|
gstin: {
|
|
83
87
|
type: String,
|
|
@@ -107,34 +111,24 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
107
111
|
},
|
|
108
112
|
address: {
|
|
109
113
|
billing: {
|
|
110
|
-
|
|
111
|
-
city: { type: String },
|
|
112
|
-
state: { type: String },
|
|
113
|
-
pin: { type: String },
|
|
114
|
-
country: { type: String },
|
|
115
|
-
phone: { type: String },
|
|
114
|
+
type: Object,
|
|
116
115
|
},
|
|
117
116
|
shipping: {
|
|
118
|
-
|
|
119
|
-
city: { type: String },
|
|
120
|
-
state: { type: String },
|
|
121
|
-
pin: { type: String },
|
|
122
|
-
country: { type: String },
|
|
123
|
-
phone: { type: String },
|
|
117
|
+
type: Object,
|
|
124
118
|
},
|
|
125
119
|
},
|
|
126
120
|
bankDetails: {
|
|
127
|
-
type:
|
|
121
|
+
type: Object,
|
|
128
122
|
},
|
|
129
123
|
deposits: {
|
|
130
|
-
type:
|
|
124
|
+
type: Object,
|
|
131
125
|
},
|
|
132
126
|
certificates: {
|
|
133
127
|
msme: [
|
|
134
128
|
{
|
|
135
129
|
files: [
|
|
136
130
|
{
|
|
137
|
-
type:
|
|
131
|
+
type: Schema.Types.ObjectId,
|
|
138
132
|
ref: "fs.files",
|
|
139
133
|
},
|
|
140
134
|
],
|
|
@@ -144,7 +138,7 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
144
138
|
{
|
|
145
139
|
files: [
|
|
146
140
|
{
|
|
147
|
-
type:
|
|
141
|
+
type: Schema.Types.ObjectId,
|
|
148
142
|
ref: "fs.files",
|
|
149
143
|
},
|
|
150
144
|
],
|
|
@@ -154,30 +148,29 @@ const OrganisationSchema: Schema = new Schema({
|
|
|
154
148
|
{
|
|
155
149
|
files: [
|
|
156
150
|
{
|
|
157
|
-
type:
|
|
151
|
+
type: Schema.Types.ObjectId,
|
|
158
152
|
ref: "fs.files",
|
|
159
153
|
},
|
|
160
154
|
],
|
|
161
155
|
},
|
|
162
156
|
],
|
|
163
157
|
cancelledCheque: [
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
158
|
+
{
|
|
159
|
+
files: [
|
|
160
|
+
{
|
|
161
|
+
type: Schema.Types.ObjectId,
|
|
162
|
+
ref: "fs.files",
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
},
|
|
172
166
|
],
|
|
173
167
|
},
|
|
174
168
|
customerOrg: {
|
|
175
169
|
type: mongoose.Schema.Types.ObjectId,
|
|
176
|
-
ref: "
|
|
170
|
+
ref: "organisation",
|
|
177
171
|
},
|
|
178
172
|
});
|
|
179
173
|
|
|
180
|
-
// Export the mongoose model with generic typing and fallback logic
|
|
181
174
|
let OrganisationModel: mongoose.Model<IOrganisation>;
|
|
182
175
|
|
|
183
176
|
if (mongoose.models.Organisation) {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
3
|
interface ISession extends Document {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
userId: Schema.Types.ObjectId;
|
|
5
|
+
type: string;
|
|
6
|
+
created_at: Date;
|
|
7
|
+
};
|
|
8
8
|
|
|
9
9
|
const TokensSchema: Schema = new mongoose.Schema({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
10
|
+
userId: {
|
|
11
|
+
type: Schema.Types.ObjectId,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
type: String
|
|
16
|
+
},
|
|
17
|
+
created_at:{
|
|
18
|
+
type: Date,
|
|
19
|
+
default: Date.now
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
})
|
|
23
23
|
|
|
24
24
|
// Safe way to dynamically fetch or initialize the model
|
|
25
25
|
let TokenModel : any = null;
|
|
@@ -32,6 +32,4 @@ if (mongoose.models.Token) {
|
|
|
32
32
|
TokenModel = mongoose.model<ISession>('Token', TokensSchema);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export default TokenModel;
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
export default TokenModel;
|