my-typescript-library-rahul52us 1.2.5 → 1.2.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/repository/document.repository.js.map +1 -1
- package/dist/routes/workflow.route.js +9 -8
- package/dist/routes/workflow.route.js.map +1 -1
- package/dist/services/document/document.services.js +3 -7
- package/dist/services/document/document.services.js.map +1 -1
- package/dist/types/repository/document.repository.d.ts +18 -47
- package/dist/types/repository/form.repository.d.ts +2 -32
- package/dist/types/repository/notifications.repository.d.ts +1 -2
- package/dist/types/repository/user.repository.d.ts +13 -110
- package/dist/types/services/authentication/getuser.service.d.ts +3 -3
- package/dist/types/services/authentication/register.service.d.ts +2 -2
- package/dist/types/services/document/document.services.d.ts +15 -41
- package/dist/types/services/workflow/workSettings.service.d.ts +1 -1
- package/dist/types/services/workflow/workflow.service.d.ts +8 -8
- package/package.json +1 -1
- package/src/repository/document.repository.ts +20 -20
- package/src/repository/form.repository.ts +4 -4
- package/src/repository/notifications.repository.ts +1 -1
- package/src/repository/user.repository.ts +15 -15
- package/src/routes/workflow.route.ts +10 -8
- package/src/services/document/document.services.ts +22 -22
- package/src/services/workflow/workSettings.service.ts +1 -1
- package/src/services/workflow/workflow.service.ts +7 -7
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import { authenticateJWT } from "../controllers/auth.controller";
|
|
3
3
|
import {
|
|
4
|
+
createWorkflowSettingService,
|
|
4
5
|
getWorkflowSettingsService,
|
|
5
6
|
} from "../services/workflow/workSettings.service";
|
|
7
|
+
import { createWorkFlowService, deleteWorkflow, getallUsersWorkFlowService, getallWorkFlowService, getDefaultWorkFlowService, updateWorkFlowService, updateWorkFlowUserStatus } from "../services/workflow/workflow.service";
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
const WorkFlow = express.Router();
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
WorkFlow.get("/get", authenticateJWT, getallWorkFlowService);
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
WorkFlow.post("/create", authenticateJWT, createWorkFlowService);
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
WorkFlow.put("/update/:id", authenticateJWT, updateWorkFlowService);
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
WorkFlow.delete("/delete/:id", authenticateJWT, deleteWorkflow);
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
WorkFlow.get("/get/default", authenticateJWT, getDefaultWorkFlowService);
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
WorkFlow.put("/status/:id", authenticateJWT, updateWorkFlowUserStatus);
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
WorkFlow.get("/get/users", authenticateJWT, getallUsersWorkFlowService);
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
WorkFlow.post("/setting/create", authenticateJWT, createWorkflowSettingService);
|
|
25
27
|
|
|
26
28
|
WorkFlow.get("/setting/get", authenticateJWT, getWorkflowSettingsService);
|
|
27
29
|
|
|
@@ -45,7 +45,7 @@ interface UserRequest extends Request {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export async function getCountService(req: UserRequest, res: Response) {
|
|
48
|
+
export async function getCountService(req: UserRequest, res: Response): Promise<any> {
|
|
49
49
|
try {
|
|
50
50
|
let { level, _id } = req.user;
|
|
51
51
|
let exchangeType = (req.query.exchangeType as string) || null;
|
|
@@ -57,7 +57,7 @@ export async function getCountService(req: UserRequest, res: Response) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export async function findOneAndDeleteDocument(req : any, res : any) {
|
|
60
|
+
export async function findOneAndDeleteDocument(req : any, res : any): Promise<any> {
|
|
61
61
|
try
|
|
62
62
|
{
|
|
63
63
|
await findOneByDocumentIdAndDelete({
|
|
@@ -76,7 +76,7 @@ export async function findOneAndDeleteDocument(req : any, res : any) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export async function createPendingApprovalFunction(req: any) {
|
|
79
|
+
export async function createPendingApprovalFunction(req: any) : Promise<any> {
|
|
80
80
|
try {
|
|
81
81
|
if (req.body.documentId) {
|
|
82
82
|
await findOneByDocumentIdAndDelete({
|
|
@@ -93,7 +93,7 @@ export async function createPendingApprovalFunction(req: any) {
|
|
|
93
93
|
req.body.activeWorkflow || req.user.defaultWorkflow
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
-
if (
|
|
96
|
+
if (status === "success") {
|
|
97
97
|
if (type === "word") {
|
|
98
98
|
values = {
|
|
99
99
|
user: userID,
|
|
@@ -145,12 +145,12 @@ export async function createPendingApprovalFunction(req: any) {
|
|
|
145
145
|
helpInfo: req.body.helpInfo || {},
|
|
146
146
|
};
|
|
147
147
|
if (file) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
values = { ...values, file:
|
|
148
|
+
const uploadedFile: any = await uploadFile(
|
|
149
|
+
file.file,
|
|
150
|
+
file.name,
|
|
151
|
+
file.type
|
|
152
|
+
);
|
|
153
|
+
values = { ...values, file: uploadedFile.fileId };
|
|
154
154
|
}
|
|
155
155
|
} else {
|
|
156
156
|
const uploadedFile: any = await uploadFile(
|
|
@@ -476,7 +476,7 @@ export async function createPendingApprovalFunction(req: any) {
|
|
|
476
476
|
export async function createPendingApprovalService(
|
|
477
477
|
req: UserRequest,
|
|
478
478
|
res: Response
|
|
479
|
-
) {
|
|
479
|
+
) : Promise<any> {
|
|
480
480
|
try {
|
|
481
481
|
const { status, data, statusCode, message } =
|
|
482
482
|
await createPendingApprovalFunction({ user: req?.user, body: req?.body });
|
|
@@ -498,7 +498,7 @@ export async function createPendingApprovalService(
|
|
|
498
498
|
export async function getAllPendingApprovalService(
|
|
499
499
|
req: UserRequest,
|
|
500
500
|
res: Response
|
|
501
|
-
) {
|
|
501
|
+
) : Promise<any>{
|
|
502
502
|
try {
|
|
503
503
|
let { company, _id } = req.user;
|
|
504
504
|
let value = (req.query.value as string) || "";
|
|
@@ -523,7 +523,7 @@ export async function getAllPendingApprovalService(
|
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
-
export async function getAllDocumentFunction(req: any) {
|
|
526
|
+
export async function getAllDocumentFunction(req: any) : Promise<any> {
|
|
527
527
|
try {
|
|
528
528
|
// let { company, _id, level, defaultWorkflow } = req.user;
|
|
529
529
|
let { defaultWorkflow } = req.user;
|
|
@@ -598,7 +598,7 @@ export async function getAllDocumentFunction(req: any) {
|
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
|
|
601
|
-
export async function getAllDocumentService(req: UserRequest, res: Response) {
|
|
601
|
+
export async function getAllDocumentService(req: UserRequest, res: Response) : Promise<any> {
|
|
602
602
|
try {
|
|
603
603
|
const { status, statusCode, documents } = await getAllDocumentFunction({
|
|
604
604
|
body: req?.body,
|
|
@@ -645,7 +645,7 @@ export async function getCountByLevelAndStatusFunction(req: any) {
|
|
|
645
645
|
export async function getcountDocumentsByLevelAndStatusService(
|
|
646
646
|
req: UserRequest,
|
|
647
647
|
res: Response
|
|
648
|
-
) {
|
|
648
|
+
) : Promise<any> {
|
|
649
649
|
try {
|
|
650
650
|
const { status, statusCode, data } = await getCountByLevelAndStatusFunction(
|
|
651
651
|
{ body: req?.body, user: req?.user }
|
|
@@ -658,7 +658,7 @@ export async function getcountDocumentsByLevelAndStatusService(
|
|
|
658
658
|
export async function getPendingApprovalService(
|
|
659
659
|
req: UserRequest,
|
|
660
660
|
res: Response
|
|
661
|
-
) {
|
|
661
|
+
) : Promise<any>{
|
|
662
662
|
try {
|
|
663
663
|
let { company, _id } = req.user;
|
|
664
664
|
let value = (req.query.value as string) || "";
|
|
@@ -997,7 +997,7 @@ export async function updateDocumentFunction(req: any, docId: any) {
|
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
|
-
export async function updateDocumentService(req: UserRequest, res: Response) {
|
|
1000
|
+
export async function updateDocumentService(req: UserRequest, res: Response) : Promise<any> {
|
|
1001
1001
|
try {
|
|
1002
1002
|
const id = req?.params?.id;
|
|
1003
1003
|
const { status, statusCode, message } = await updateDocumentFunction(
|
|
@@ -1017,7 +1017,7 @@ export async function updateDocumentService(req: UserRequest, res: Response) {
|
|
|
1017
1017
|
export async function updateDocumentLevel2Service(
|
|
1018
1018
|
req: UserRequest,
|
|
1019
1019
|
res: Response
|
|
1020
|
-
) {
|
|
1020
|
+
) : Promise<any>{
|
|
1021
1021
|
try {
|
|
1022
1022
|
const id = req.params.id;
|
|
1023
1023
|
const updates = req.body;
|
|
@@ -1074,7 +1074,7 @@ export async function updateDocumentLevel2Service(
|
|
|
1074
1074
|
export async function updateDocumentLevelService(
|
|
1075
1075
|
req: UserRequest,
|
|
1076
1076
|
res: Response
|
|
1077
|
-
) {
|
|
1077
|
+
) : Promise<any>{
|
|
1078
1078
|
try {
|
|
1079
1079
|
const id = req.params.id;
|
|
1080
1080
|
const updates = req.body;
|
|
@@ -1134,7 +1134,7 @@ export async function updateDocumentLevelService(
|
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
1136
|
|
|
1137
|
-
export const getDashChartService = async (req: UserRequest, res: Response) => {
|
|
1137
|
+
export const getDashChartService = async (req: UserRequest, res: Response) : Promise<any> => {
|
|
1138
1138
|
try {
|
|
1139
1139
|
req.body.user = req.user;
|
|
1140
1140
|
const result = await getDashChartdata(req.body);
|
|
@@ -1147,7 +1147,7 @@ export const getDashChartService = async (req: UserRequest, res: Response) => {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
};
|
|
1149
1149
|
|
|
1150
|
-
export const deleteAllDocumentsService = async (req: any, res: Response) => {
|
|
1150
|
+
export const deleteAllDocumentsService = async (req: any, res: Response) : Promise<any> => {
|
|
1151
1151
|
try {
|
|
1152
1152
|
const { status, data } = await deleteAllDocuments();
|
|
1153
1153
|
if (status === "success") {
|
|
@@ -1169,7 +1169,7 @@ export const deleteAllDocumentsService = async (req: any, res: Response) => {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
};
|
|
1171
1171
|
|
|
1172
|
-
export const deleteSingleDocumentService = async (req: any, res: Response) => {
|
|
1172
|
+
export const deleteSingleDocumentService = async (req: any, res: Response) : Promise<any> => {
|
|
1173
1173
|
try {
|
|
1174
1174
|
const { status, data } = await deleteSingleDocument({
|
|
1175
1175
|
id: new mongoose.Types.ObjectId(req.params.id),
|
|
@@ -41,7 +41,7 @@ export async function createWorkflowSettingFunction(req: any) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export async function createWorkflowSettingService(req: any, res: Response) {
|
|
44
|
+
export async function createWorkflowSettingService(req: any, res: Response):Promise<any> {
|
|
45
45
|
try {
|
|
46
46
|
const { status, statusCode, data } = await createWorkflowSettingFunction({
|
|
47
47
|
body: req?.body,
|
|
@@ -182,7 +182,7 @@ export async function generateWorkflow(req: any) {
|
|
|
182
182
|
export async function createWorkFlowService(
|
|
183
183
|
req: UserRequest,
|
|
184
184
|
res: Response
|
|
185
|
-
): Promise<
|
|
185
|
+
): Promise<any> {
|
|
186
186
|
try {
|
|
187
187
|
const { status, statusCode, message } = await generateWorkflow({
|
|
188
188
|
body: req.body,
|
|
@@ -272,7 +272,7 @@ export async function getDefaultWorkflowFunction(req: any) {
|
|
|
272
272
|
export async function getDefaultWorkFlowService(
|
|
273
273
|
req: UserRequest,
|
|
274
274
|
res: Response
|
|
275
|
-
) {
|
|
275
|
+
) : Promise<any>{
|
|
276
276
|
try {
|
|
277
277
|
const { status, statusCode, data } = await getDefaultWorkflowFunction({
|
|
278
278
|
query: req?.query,
|
|
@@ -503,7 +503,7 @@ export async function updateWorkflowFunction(req: any, workflowId: any) {
|
|
|
503
503
|
export async function updateWorkFlowService(
|
|
504
504
|
req: UserRequest,
|
|
505
505
|
res: Response
|
|
506
|
-
): Promise<
|
|
506
|
+
): Promise<any> {
|
|
507
507
|
try {
|
|
508
508
|
const { id } = req.params;
|
|
509
509
|
const { status, statusCode, message } = await updateWorkflowFunction(
|
|
@@ -549,7 +549,7 @@ export async function getWorkflowFunctionService(req: any) {
|
|
|
549
549
|
export async function getallWorkFlowService(
|
|
550
550
|
req: UserRequest,
|
|
551
551
|
res: Response
|
|
552
|
-
): Promise<
|
|
552
|
+
): Promise<any> {
|
|
553
553
|
try {
|
|
554
554
|
const { status, statusCode, data } = await getWorkflowFunctionService({
|
|
555
555
|
query: req?.query,
|
|
@@ -586,7 +586,7 @@ export async function getUserWorkflowFunction(req: any) {
|
|
|
586
586
|
export async function getallUsersWorkFlowService(
|
|
587
587
|
req: UserRequest,
|
|
588
588
|
res: Response
|
|
589
|
-
): Promise<
|
|
589
|
+
): Promise<any> {
|
|
590
590
|
try {
|
|
591
591
|
const { status, statusCode, workflow } = await getUserWorkflowFunction({
|
|
592
592
|
user: req?.user,
|
|
@@ -632,7 +632,7 @@ export async function deleteWorkflowFunction(id: any) {
|
|
|
632
632
|
export async function deleteWorkflow(
|
|
633
633
|
req: Request,
|
|
634
634
|
res: Response
|
|
635
|
-
): Promise<
|
|
635
|
+
): Promise<any> {
|
|
636
636
|
const { id } = req.params;
|
|
637
637
|
try {
|
|
638
638
|
const { status, statusCode, message } = await deleteWorkflowFunction(id);
|
|
@@ -715,7 +715,7 @@ export async function updateWorkflowStatusFunction(id: any, req: any) {
|
|
|
715
715
|
export async function updateWorkFlowUserStatus(
|
|
716
716
|
req: UserRequest,
|
|
717
717
|
res: Response
|
|
718
|
-
) {
|
|
718
|
+
) : Promise<any>{
|
|
719
719
|
try {
|
|
720
720
|
const id = req?.params?.id;
|
|
721
721
|
const { status, statusCode, message } = await updateWorkflowStatusFunction(
|