my-typescript-library-rahul52us 2.3.9 → 2.4.0

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.
@@ -49,14 +49,14 @@ function findOneAndDeleteDocument(req, res) {
49
49
  documentId: (_a = req.body) === null || _a === void 0 ? void 0 : _a.documentId,
50
50
  });
51
51
  res.status(200).send({
52
- status: 'success',
53
- data: 'Document has been successfully'
52
+ status: "success",
53
+ data: "Document has been successfully",
54
54
  });
55
55
  }
56
56
  catch (err) {
57
57
  res.status(500).send({
58
- status: 'error',
59
- data: err === null || err === void 0 ? void 0 : err.message
58
+ status: "error",
59
+ data: err === null || err === void 0 ? void 0 : err.message,
60
60
  });
61
61
  }
62
62
  });
@@ -66,7 +66,7 @@ function createPendingApprovalFunction(req) {
66
66
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
67
67
  return __awaiter(this, void 0, void 0, function* () {
68
68
  try {
69
- let { values, file, tags, type, approval, originalValues, isUpperApproval, domain, mailDetails, sendUserMail = true } = req.body;
69
+ let { values, file, tags, type, approval, originalValues, isUpperApproval, domain, mailDetails, sendUserMail = true, } = req.body;
70
70
  const userID = (_a = req.user) === null || _a === void 0 ? void 0 : _a._id;
71
71
  const organisationId = req.body.organisationId;
72
72
  const isguaranteed = ((_c = (_b = req === null || req === void 0 ? void 0 : req.body) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.Threshold_Value_Check) === "True" ? true : false;
@@ -121,7 +121,7 @@ function createPendingApprovalFunction(req) {
121
121
  name: approval.name || ((_e = req.user) === null || _e === void 0 ? void 0 : _e.username),
122
122
  level: approval.level,
123
123
  userId: userID,
124
- createdAt: new Date()
124
+ createdAt: new Date(),
125
125
  },
126
126
  ],
127
127
  helpInfo: req.body.helpInfo || {},
@@ -132,15 +132,19 @@ function createPendingApprovalFunction(req) {
132
132
  user: userID,
133
133
  company: company,
134
134
  workflow: req.body.activeWorkflow || req.user.defaultWorkflow,
135
- values: originalValues ? [{
135
+ values: originalValues
136
+ ? [
137
+ {
138
+ level: req.user.level,
139
+ values: values === null || values === void 0 ? void 0 : values.valuesData,
140
+ created_At: new Date(),
141
+ },
142
+ ]
143
+ : {
136
144
  level: req.user.level,
137
- values: values === null || values === void 0 ? void 0 : values.valuesData,
138
- created_At: new Date()
139
- }] : {
140
- level: req.user.level,
141
- values: values,
142
- created_At: new Date(),
143
- },
145
+ values: values,
146
+ created_At: new Date(),
147
+ },
144
148
  originalValues: originalValues || values.fields,
145
149
  tags: {
146
150
  extraction: {
@@ -167,33 +171,56 @@ function createPendingApprovalFunction(req) {
167
171
  isguaranteed: isguaranteed,
168
172
  organisationId: organisationId,
169
173
  workflow: req.body.activeWorkflow || req.user.defaultWorkflow,
170
- values: isUpperApproval ? [{
174
+ values: isUpperApproval
175
+ ? [
176
+ {
177
+ level: req.user.level,
178
+ values,
179
+ created_At: new Date(),
180
+ updated_At: new Date(),
181
+ },
182
+ ]
183
+ : {
171
184
  level: req.user.level,
172
185
  values,
173
186
  created_At: new Date(),
174
187
  updated_At: new Date(),
175
- }] : {
176
- level: req.user.level,
177
- values,
178
- created_At: new Date(),
179
- updated_At: new Date(),
180
- },
188
+ },
181
189
  originalValues: originalValues || values,
182
190
  file: (uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId) || undefined,
183
191
  tags: tags,
184
- approval: (approval === null || approval === void 0 ? void 0 : approval.length) > 0
185
- ? [
186
- {
187
- comment: approval[0].comment,
188
- type: approval[0].type,
189
- status: approval[0].status,
190
- name: approval[0].name || ((_f = req.user) === null || _f === void 0 ? void 0 : _f.username),
191
- level: approval[0].level,
192
- userId: userID,
193
- fileId: (uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId) || undefined,
194
- createdAt: new Date(),
195
- },
196
- ]
192
+ // approval:
193
+ // approval?.length > 0
194
+ // ? [
195
+ // {
196
+ // comment: approval[0].comment,
197
+ // type: approval[0].type,
198
+ // status: approval[0].status,
199
+ // name: approval[0].name || req.user?.username,
200
+ // level: approval[0].level,
201
+ // userId: userID,
202
+ // fileId: uploadedFile?.fileId || undefined,
203
+ // createdAt: new Date(),
204
+ // },
205
+ // ]
206
+ // : [],
207
+ approval: Array.isArray(approval)
208
+ ? approval.length > 1
209
+ ? approval.map((item) => (Object.assign(Object.assign({}, item), { fileId: uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId, createdAt: new Date() })))
210
+ : approval.length === 1
211
+ ? [
212
+ {
213
+ comment: approval[0].comment,
214
+ type: approval[0].type,
215
+ status: approval[0].status,
216
+ name: approval[0].name || ((_f = req.user) === null || _f === void 0 ? void 0 : _f.username),
217
+ level: approval[0].level,
218
+ userId: userID,
219
+ fileId: uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId,
220
+ createdAt: new Date(),
221
+ },
222
+ ]
223
+ : []
197
224
  : [],
198
225
  helpInfo: req.body.helpInfo || {},
199
226
  };
@@ -273,7 +300,7 @@ function createPendingApprovalFunction(req) {
273
300
  message: message,
274
301
  documentId: createdDocument === null || createdDocument === void 0 ? void 0 : createdDocument._id,
275
302
  type: req.body.type,
276
- workflow: workflowId
303
+ workflow: workflowId,
277
304
  };
278
305
  const notificationsPromises = currentUser.map((userId, index) => __awaiter(this, void 0, void 0, function* () {
279
306
  var _6, _7, _8, _9;
@@ -295,7 +322,8 @@ function createPendingApprovalFunction(req) {
295
322
  });
296
323
  }
297
324
  if (notifyItem.type.includes("email")) {
298
- const dt = mailDetails ? Object.assign(Object.assign({}, mailDetails), { editedValues: formattedValues, approver: currentUserDetails[index].username }) : {
325
+ const dt = mailDetails
326
+ ? Object.assign(Object.assign({}, mailDetails), { editedValues: formattedValues, approver: currentUserDetails[index].username }) : {
299
327
  username: (_6 = req.user) === null || _6 === void 0 ? void 0 : _6.username,
300
328
  approver: currentUserDetails[index].username,
301
329
  status: req.body.status,
@@ -304,11 +332,17 @@ function createPendingApprovalFunction(req) {
304
332
  comments: `${req.user.username} has uploaded the document. Kindly review it once`,
305
333
  subcomment: `Comment : ${req.body.comment}`,
306
334
  editedValues: formattedValues,
307
- logo: process.env.domain === "indoco" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png" : process.env.domain === "akums" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg" : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
335
+ logo: process.env.domain === "indoco"
336
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png"
337
+ : process.env.domain === "akums"
338
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg"
339
+ : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
308
340
  };
309
341
  const template = yield (0, compile_email_template_1.default)({
310
- fileName: domain === "indoco" ? "indocoRequest.mjml" : "workflowApproval.mjml",
311
- data: dt
342
+ fileName: domain === "indoco"
343
+ ? "indocoRequest.mjml"
344
+ : "workflowApproval.mjml",
345
+ data: dt,
312
346
  });
313
347
  // Send email
314
348
  yield (0, mail_1.default)(currentUserDetails[index].username, mailDetails ? mailDetails === null || mailDetails === void 0 ? void 0 : mailDetails.subject : "Review Documents", template);
@@ -336,7 +370,11 @@ function createPendingApprovalFunction(req) {
336
370
  documentUrl: process.env.FRONTEND_URL,
337
371
  comments: `You have successfully uploaded your document`,
338
372
  editedValues: formattedValues,
339
- logo: process.env.domain === "indoco" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png" : process.env.domain === "akums" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg" : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
373
+ logo: process.env.domain === "indoco"
374
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png"
375
+ : process.env.domain === "akums"
376
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg"
377
+ : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
340
378
  };
341
379
  const newTemplate = yield (0, compile_email_template_1.default)({
342
380
  fileName: "workflowApproval.mjml",
@@ -396,7 +434,7 @@ function createPendingApprovalFunction(req) {
396
434
  documentId: createdDocument.documentId,
397
435
  workflowId: createdDocument.workflow,
398
436
  values: req.body.values,
399
- file: file
437
+ file: file,
400
438
  },
401
439
  };
402
440
  }
@@ -413,7 +451,7 @@ function createPendingApprovalFunction(req) {
413
451
  return {
414
452
  status: "error",
415
453
  statusCode: 400,
416
- message: error === null || error === void 0 ? void 0 : error.message
454
+ message: error === null || error === void 0 ? void 0 : error.message,
417
455
  };
418
456
  }
419
457
  });
@@ -427,7 +465,7 @@ function createPendingApprovalService(req, res) {
427
465
  return res.status(statusCode).json({
428
466
  status: status,
429
467
  message: message,
430
- data: data
468
+ data: data,
431
469
  });
432
470
  }
433
471
  catch (error) {
@@ -682,14 +720,14 @@ function saveAsDraftService(req, res) {
682
720
  res.status(statusCode).send({
683
721
  status,
684
722
  message,
685
- data
723
+ data,
686
724
  });
687
725
  }
688
726
  catch (err) {
689
727
  res.status(500).send({
690
728
  message: err === null || err === void 0 ? void 0 : err.message,
691
729
  data: err === null || err === void 0 ? void 0 : err.message,
692
- statusCode: 500
730
+ statusCode: 500,
693
731
  });
694
732
  }
695
733
  });
@@ -743,7 +781,7 @@ function updateDocumentFunction(req, docId) {
743
781
  created_At: new Date(),
744
782
  };
745
783
  }
746
- let { currentUser, currentUserDetails, workflow, notifications, triggerMailForLevel1, triggers } = yield (0, workflow_service_1.getWorkflowLevelService)(updates.workflow, req.user.level, req.body.status);
784
+ let { currentUser, currentUserDetails, workflow, notifications, triggerMailForLevel1, triggers, } = yield (0, workflow_service_1.getWorkflowLevelService)(updates.workflow, req.user.level, req.body.status);
747
785
  let updatedDocuments = null;
748
786
  if (createType === "alternative") {
749
787
  updates.createdAt = new Date();
@@ -774,12 +812,14 @@ function updateDocumentFunction(req, docId) {
774
812
  message: message,
775
813
  documentId: id,
776
814
  type: req.body.type,
777
- workflow: updates.workflow
815
+ workflow: updates.workflow,
778
816
  };
779
- const account = mongoose_1.default.models['Organisation'];
780
- const details = yield account.findOne({ onboardingId: docData === null || docData === void 0 ? void 0 : docData.documentId });
817
+ const account = mongoose_1.default.models["Organisation"];
818
+ const details = yield account.findOne({
819
+ onboardingId: docData === null || docData === void 0 ? void 0 : docData.documentId,
820
+ });
781
821
  console.log(docData);
782
- console.log('the details are are', details);
822
+ console.log("the details are are", details);
783
823
  const notificationsPromises = currentUser.map((userId, index) => __awaiter(this, void 0, void 0, function* () {
784
824
  var _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
785
825
  const userData = Object.assign(Object.assign({}, data), { receiver: userId });
@@ -806,11 +846,15 @@ function updateDocumentFunction(req, docId) {
806
846
  let temp = null;
807
847
  let planningGroup = null;
808
848
  if (process.env.domain === "indoco") {
809
- const organigation = mongoose_1.default.models['Organisation'];
810
- const orgs = yield organigation.findOne({ onboardingId: docData === null || docData === void 0 ? void 0 : docData.documentId });
849
+ const organigation = mongoose_1.default.models["Organisation"];
850
+ const orgs = yield organigation.findOne({
851
+ onboardingId: docData === null || docData === void 0 ? void 0 : docData.documentId,
852
+ });
811
853
  planningGroup = (_3 = orgs === null || orgs === void 0 ? void 0 : orgs.accountSettingsDetails) === null || _3 === void 0 ? void 0 : _3.planningGroup;
812
- const account = mongoose_1.default.models['Accounts'];
813
- const details = yield account.findOne({ _id: orgs === null || orgs === void 0 ? void 0 : orgs.user_id });
854
+ const account = mongoose_1.default.models["Accounts"];
855
+ const details = yield account.findOne({
856
+ _id: orgs === null || orgs === void 0 ? void 0 : orgs.user_id,
857
+ });
814
858
  if (details) {
815
859
  temp = {
816
860
  vendorName: orgs === null || orgs === void 0 ? void 0 : orgs.vendorName,
@@ -822,7 +866,11 @@ function updateDocumentFunction(req, docId) {
822
866
  approver: currentUserDetails[index].username,
823
867
  comment: message,
824
868
  editedValues: formattedValues,
825
- logo: process.env.domain === "indoco" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png" : process.env.domain === "akums" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg" : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
869
+ logo: process.env.domain === "indoco"
870
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png"
871
+ : process.env.domain === "akums"
872
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg"
873
+ : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
826
874
  };
827
875
  }
828
876
  }
@@ -836,15 +884,27 @@ function updateDocumentFunction(req, docId) {
836
884
  ? `${((_8 = (_7 = req.user.username) === null || _7 === void 0 ? void 0 : _7.charAt(0)) === null || _8 === void 0 ? void 0 : _8.toUpperCase()) +
837
885
  ((_11 = (_10 = (_9 = req.user) === null || _9 === void 0 ? void 0 : _9.username) === null || _10 === void 0 ? void 0 : _10.slice(1)) === null || _11 === void 0 ? void 0 : _11.toLowerCase())} has reuploaded the document`
838
886
  : `${data.message}`,
839
- logo: process.env.domain === "indoco" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png" : process.env.domain === "akums" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg" : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
840
- editedValues: formattedValues
887
+ logo: process.env.domain === "indoco"
888
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png"
889
+ : process.env.domain === "akums"
890
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg"
891
+ : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
892
+ editedValues: formattedValues,
841
893
  };
842
894
  if (notifyItem.type.includes("email")) {
843
895
  const template = yield (0, compile_email_template_1.default)({
844
- fileName: process.env.domain === "indoco" ? (req.body.status === "rejected" ? "indocoRejectedRequest.mjml" : "indocoRequest.mjml") : "workflowApproval.mjml",
896
+ fileName: process.env.domain === "indoco"
897
+ ? req.body.status === "rejected"
898
+ ? "indocoRejectedRequest.mjml"
899
+ : "indocoRequest.mjml"
900
+ : "workflowApproval.mjml",
845
901
  data: dt,
846
902
  });
847
- yield (0, mail_1.default)(currentUserDetails[index].username, process.env.domain === "indoco" ? (req.body.status === "rejected" ? `INDOCO REMEDIES LIMITED: Vendor Onboarding Request Rejected - ${planningGroup}` : `INDOCO REMEDIES LIMITED: Vendor Onboarding Request ${planningGroup}`) : "Review Documents", template);
903
+ yield (0, mail_1.default)(currentUserDetails[index].username, process.env.domain === "indoco"
904
+ ? req.body.status === "rejected"
905
+ ? `INDOCO REMEDIES LIMITED: Vendor Onboarding Request Rejected - ${planningGroup}`
906
+ : `INDOCO REMEDIES LIMITED: Vendor Onboarding Request ${planningGroup}`
907
+ : "Review Documents", template);
848
908
  emailResults.push({
849
909
  status: "success",
850
910
  message: `Email sent to user ${userId}`,
@@ -868,13 +928,16 @@ function updateDocumentFunction(req, docId) {
868
928
  };
869
929
  }
870
930
  }));
871
- if (triggerMailForLevel1 || (((_r = workflow === null || workflow === void 0 ? void 0 : workflow.values[0]) === null || _r === void 0 ? void 0 : _r.reset_to_level_1) && req.body.status === "rejected")) {
931
+ if (triggerMailForLevel1 ||
932
+ (((_r = workflow === null || workflow === void 0 ? void 0 : workflow.values[0]) === null || _r === void 0 ? void 0 : _r.reset_to_level_1) && req.body.status === "rejected")) {
872
933
  let temp = null;
873
934
  let planningGroup = null;
874
935
  if (process.env.domain === "indoco") {
875
- const organigation = mongoose_1.default.models['Organisation'];
876
- const orgs = yield organigation.findOne({ onboardingId: docData === null || docData === void 0 ? void 0 : docData.documentId });
877
- const account = mongoose_1.default.models['Accounts'];
936
+ const organigation = mongoose_1.default.models["Organisation"];
937
+ const orgs = yield organigation.findOne({
938
+ onboardingId: docData === null || docData === void 0 ? void 0 : docData.documentId,
939
+ });
940
+ const account = mongoose_1.default.models["Accounts"];
878
941
  const details = yield account.findOne({ _id: orgs === null || orgs === void 0 ? void 0 : orgs.user_id });
879
942
  if (details) {
880
943
  planningGroup = (_s = details === null || details === void 0 ? void 0 : details.accountSettingsDetails) === null || _s === void 0 ? void 0 : _s.planningGroup;
@@ -888,7 +951,11 @@ function updateDocumentFunction(req, docId) {
888
951
  approver: docData === null || docData === void 0 ? void 0 : docData.user.username,
889
952
  comment: message,
890
953
  editedValues: formattedValues,
891
- logo: process.env.domain === "indoco" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png" : process.env.domain === "akums" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg" : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
954
+ logo: process.env.domain === "indoco"
955
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png"
956
+ : process.env.domain === "akums"
957
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg"
958
+ : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
892
959
  };
893
960
  }
894
961
  }
@@ -901,15 +968,26 @@ function updateDocumentFunction(req, docId) {
901
968
  comments: createType === "reupload" || createType === "alternative"
902
969
  ? `You have successfully uploaded your document`
903
970
  : `${data.message}`,
904
- logo: process.env.domain === "indoco" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png" : process.env.domain === "akums" ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg" : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
905
- editedValues: formattedValues
971
+ logo: process.env.domain === "indoco"
972
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745298991/taskManager/Indoco-logo-png-W200px.png"
973
+ : process.env.domain === "akums"
974
+ ? "https://res.cloudinary.com/dsckn1jjj/image/upload/v1745336631/taskManager/download.jpg"
975
+ : "https://www.sequelstring.com/_next/image?url=%2Fimages%2Flogo.webp&w=256&q=100",
976
+ editedValues: formattedValues,
906
977
  };
907
978
  const Mailtemplate = yield (0, compile_email_template_1.default)({
908
- fileName: process.env.domain === "indoco" ? (req.body.status === "rejected" ? "indocoRejectedRequest.mjml" : "indocoRequest.mjml") : "workflowApproval.mjml",
979
+ fileName: process.env.domain === "indoco"
980
+ ? req.body.status === "rejected"
981
+ ? "indocoRejectedRequest.mjml"
982
+ : "indocoRequest.mjml"
983
+ : "workflowApproval.mjml",
909
984
  data: Level1Mail,
910
985
  });
911
- yield (0, mail_1.default)((_w = docData === null || docData === void 0 ? void 0 : docData.user) === null || _w === void 0 ? void 0 : _w.username, process.env.domain === "indoco" ? (req.body.status === "rejected" ? `INDOCO REMEDIES LIMITED: Vendor Onboarding Request Rejected - ${planningGroup}` : `INDOCO REMEDIES LIMITED: Vendor Onboarding Request - ${planningGroup}`) :
912
- createType === "reupload" || createType === "alternative"
986
+ yield (0, mail_1.default)((_w = docData === null || docData === void 0 ? void 0 : docData.user) === null || _w === void 0 ? void 0 : _w.username, process.env.domain === "indoco"
987
+ ? req.body.status === "rejected"
988
+ ? `INDOCO REMEDIES LIMITED: Vendor Onboarding Request Rejected - ${planningGroup}`
989
+ : `INDOCO REMEDIES LIMITED: Vendor Onboarding Request - ${planningGroup}`
990
+ : createType === "reupload" || createType === "alternative"
913
991
  ? "Document Reuploaded Successfully."
914
992
  : "Status Updated", Mailtemplate);
915
993
  }
@@ -933,7 +1011,8 @@ function updateDocumentFunction(req, docId) {
933
1011
  for (const item of triggers) {
934
1012
  try {
935
1013
  if (Array.isArray(item.level)) {
936
- if ((item === null || item === void 0 ? void 0 : item.level.includes((_x = req.body) === null || _x === void 0 ? void 0 : _x.level)) && (item === null || item === void 0 ? void 0 : item.approval.includes(req.body.status))) {
1014
+ if ((item === null || item === void 0 ? void 0 : item.level.includes((_x = req.body) === null || _x === void 0 ? void 0 : _x.level)) &&
1015
+ (item === null || item === void 0 ? void 0 : item.approval.includes(req.body.status))) {
937
1016
  const helpInfo = (0, common_1.findTriggerValues)(((_y = docData === null || docData === void 0 ? void 0 : docData._doc) === null || _y === void 0 ? void 0 : _y.helpInfo) || {}, req.body.status);
938
1017
  if (item.action === "url") {
939
1018
  const docs = yield document_schema_1.default.findById(new mongoose_1.default.Types.ObjectId(id));
@@ -971,8 +1050,13 @@ exports.updateDocumentFunction = updateDocumentFunction;
971
1050
  function withdrawalApprovalService(req, res) {
972
1051
  return __awaiter(this, void 0, void 0, function* () {
973
1052
  try {
974
- const { status, statusCode, message, data } = yield (0, document_repository_1.withdrawalApprovalDocument)({ id: req.body.documentId, level: req.user.level });
975
- return res.status(statusCode).send({ status: status, message: message, data });
1053
+ const { status, statusCode, message, data } = yield (0, document_repository_1.withdrawalApprovalDocument)({
1054
+ id: req.body.documentId,
1055
+ level: req.user.level,
1056
+ });
1057
+ return res
1058
+ .status(statusCode)
1059
+ .send({ status: status, message: message, data });
976
1060
  }
977
1061
  catch (error) {
978
1062
  console.log(error);