Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Already exsisting user enrichment #946

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions utilities/project-factory/src/server/api/campaignApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,18 @@ async function getUuidsError(request: any, response: any, mobileNumberRowNumberM
errors.push({ status: "INVALID", rowNumber: mobileNumberRowNumberMapping[user?.mobileNumber], errorDetails: `User with mobileNumber ${user?.mobileNumber} doesn't have username` })
count++;
}
else if (!user?.userDetails?.password) {
logger.info(`User with mobileNumber ${user?.mobileNumber} doesn't have password`)
errors.push({ status: "INVALID", rowNumber: mobileNumberRowNumberMapping[user?.mobileNumber], errorDetails: `User with mobileNumber ${user?.mobileNumber} doesn't have password` })
count++;
}
else if (!user?.userUuid) {
logger.info(`User with mobileNumber ${user?.mobileNumber} doesn't have userServiceUuid`)
errors.push({ status: "INVALID", rowNumber: mobileNumberRowNumberMapping[user?.mobileNumber], errorDetails: `User with mobileNumber ${user?.mobileNumber} doesn't have userServiceUuid` })
count++;
}
else {
request.body.mobileNumberUuidsMapping[user?.mobileNumber] = { userUuid: user?.id, code: user?.userDetails?.username, rowNumber: mobileNumberRowNumberMapping[user?.mobileNumber] }
request.body.mobileNumberUuidsMapping[user?.mobileNumber] = { userUuid: user?.id, code: user?.userDetails?.username, rowNumber: mobileNumberRowNumberMapping[user?.mobileNumber], password: user?.userDetails?.password, userServiceUuid: user?.userUuid }
}
}
if (count > 0) {
Expand Down Expand Up @@ -692,7 +702,8 @@ async function enrichAlreadyExsistingUser(request: any) {
employee.uuid = request?.body?.mobileNumberUuidsMapping[employee?.user?.mobileNumber].userUuid;
employee.code = request?.body?.mobileNumberUuidsMapping[employee?.user?.mobileNumber].code;
employee.user.userName = request?.body?.mobileNumberUuidsMapping[employee?.user?.mobileNumber].code;
employee.user.password = config.user.userDefaultPassword;
employee.user.password = request?.body?.mobileNumberUuidsMapping[employee?.user?.mobileNumber].password;
employee.user.userServiceUuid = request?.body?.mobileNumberUuidsMapping[employee?.user?.mobileNumber].userServiceUuid;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const getBoundaryDataService = async (
logger.info("RETURNS THE BOUNDARY RESPONSE");
return BoundaryFileDetails;
} catch (e: any) {
console.log(e)
logger.error(String(e))
// Handle errors and send error response
throw (e);
Expand Down
2 changes: 2 additions & 0 deletions utilities/project-factory/src/server/utils/genericUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ async function searchGeneratedResources(request: any) {
const queryResult = await executeQuery(queryString, queryValues);
return generatedResourceTransformer(queryResult?.rows);
} catch (error: any) {
console.log(error)
logger.error(`Error fetching data from the database: ${error.message}`);
throwError("COMMON", 500, "INTERNAL_SERVER_ERROR", error?.message);
return null; // Return null in case of an error
Expand Down Expand Up @@ -385,6 +386,7 @@ async function fullProcessFlowForNewEntry(newEntryResponse: any, generatedResour
request.body.generatedResource = finalResponse;
}
} catch (error: any) {
console.log(error)
handleGenerateError(newEntryResponse, generatedResource, error);
}
}
Expand Down
Loading