my-typescript-library-rahul52us 2.2.7 → 2.3.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.
@@ -86,7 +86,7 @@ export async function findOneAndDeleteDocument(req: any, res: any) {
86
86
 
87
87
  export async function createPendingApprovalFunction(req: any) {
88
88
  try {
89
- let { values, file, tags, type, approval, originalValues, isUpperApproval, domain, mailDetails } = req.body;
89
+ let { values, file, tags, type, approval, originalValues, isUpperApproval, domain, mailDetails, sendUserMail = true } = req.body;
90
90
  const userID = req.user?._id;
91
91
  const organisationId = req.body.organisationId
92
92
  const isguaranteed = req?.body?.fields?.Threshold_Value_Check === "True" ? true : false
@@ -371,7 +371,7 @@ export async function createPendingApprovalFunction(req: any) {
371
371
  );
372
372
 
373
373
 
374
- if (filterNotify && filterNotify.length > 0) {
374
+ if (sendUserMail && filterNotify && filterNotify.length > 0) {
375
375
  const emailResults = [];
376
376
  const smsResults = [];
377
377
  const notificationResults = [];
@@ -679,7 +679,6 @@ export async function getAllDocumentFunction(req: any) {
679
679
  const differentiateFirstLevel = data?.values?.differentiateFirstLevel;
680
680
 
681
681
  const documents = await getAllDocument(
682
- data,
683
682
  Number(totalLevel),
684
683
  req.body.activeWorkflow || defaultWorkflow,
685
684
  value,
@@ -1039,13 +1038,14 @@ export async function updateDocumentFunction(req: any, docId: any) {
1039
1038
  await createNotificationsService(userData);
1040
1039
 
1041
1040
  let temp : any = null
1041
+ let planningGroup : any = null;
1042
1042
  if(process.env.domain === "indoco")
1043
1043
  {
1044
1044
 
1045
1045
  const organigation = mongoose.models['Organisation'];
1046
1046
  const orgs = await organigation.findOne({ onboardingId: docData?.documentId });
1047
1047
 
1048
-
1048
+ planningGroup = orgs?.accountSettingsDetails?.planningGroup
1049
1049
  const account = mongoose.models['Accounts']
1050
1050
  const details = await account.findOne({_id : orgs?.user_id})
1051
1051
  if(details){
@@ -1088,7 +1088,7 @@ export async function updateDocumentFunction(req: any, docId: any) {
1088
1088
 
1089
1089
  await sendMail(
1090
1090
  currentUserDetails[index].username,
1091
- process.env.domain === "indoco" ? (req.body.status === "rejected" ? "INDOCO REMEDIES LIMITED: Vendor Onboarding Request Rejected" : "INDOCO REMEDIES LIMITED: Vendor Onboarding Request") : "Review Documents",
1091
+ 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",
1092
1092
  template
1093
1093
  );
1094
1094
 
@@ -1119,15 +1119,16 @@ export async function updateDocumentFunction(req: any, docId: any) {
1119
1119
  if (triggerMailForLevel1 || (workflow?.values[0]?.reset_to_level_1 && req.body.status === "rejected")) {
1120
1120
 
1121
1121
  let temp : any = null
1122
+ let planningGroup : any = null
1122
1123
  if(process.env.domain === "indoco")
1123
1124
  {
1124
1125
  const organigation = mongoose.models['Organisation']
1125
1126
  const orgs = await organigation.findOne({onboardingId : docData?.documentId})
1126
1127
 
1127
-
1128
1128
  const account = mongoose.models['Accounts']
1129
1129
  const details = await account.findOne({_id : orgs?.user_id})
1130
1130
  if(details){
1131
+ planningGroup = details?.accountSettingsDetails?.planningGroup
1131
1132
  temp = {
1132
1133
  vendorName : orgs?.vendorName,
1133
1134
  email : details?.username,
@@ -1163,7 +1164,7 @@ export async function updateDocumentFunction(req: any, docId: any) {
1163
1164
 
1164
1165
  await sendMail(
1165
1166
  docData?.user?.username,
1166
- process.env.domain === "indoco" ? (req.body.status === "rejected" ? "INDOCO REMEDIES LIMITED: Vendor Onboarding Request Rejected" : "INDOCO REMEDIES LIMITED: Vendor Onboarding Request") :
1167
+ process.env.domain === "indoco" ? (req.body.status === "rejected" ? `INDOCO REMEDIES LIMITED: Vendor Onboarding Request Rejected - ${planningGroup}` : `INDOCO REMEDIES LIMITED: Vendor Onboarding Request - ${planningGroup}`) :
1167
1168
  createType === "reupload" || createType === "alternative"
1168
1169
  ? "Document Reuploaded Successfully."
1169
1170
  : "Status Updated",