Skip to content

Fix/plat 2584 #610

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

Merged
merged 6 commits into from
Apr 3, 2023
Merged

Fix/plat 2584 #610

merged 6 commits into from
Apr 3, 2023

Conversation

ThomasKranitsas
Copy link
Contributor

No description provided.

Copy link
Contributor

@rakibansary rakibansary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we don't take the response of the domainChallenge.delete() method - the response from the domain must be positive before we go ahead with deleting from ES. If there's an error from domain-challenge, it should be posted back to the user as an API response.

@@ -2282,6 +2282,9 @@ function sanitizeData(data, challenge) {
*/
async function deleteChallenge(currentUser, challengeId) {
const challenge = await challengeDomain.lookup(getLookupCriteria("id", challengeId));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a scanCriteria here with

  1. id: challengeId
  2. status: New

We don't need to fetch a challenge that's not New.

await challengeDomain.delete(getLookupCriteria("id", challengeId));
const { items: deletedItems } = await challengeDomain.delete(getLookupCriteria("id", challengeId));
if (!_.find(deletedItems, { id: challengeId })) {
throw new errors.Internal(`There was an error deleting the challenge with id: ${challengeId} from dynamo`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to specifically mention dynamo. Just that there was an error deleting the challenge with id ${challengeId} is fine.

@ThomasKranitsas ThomasKranitsas merged commit 6f2442e into dev Apr 3, 2023
@rakibansary rakibansary deleted the fix/PLAT-2584 branch April 11, 2023 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants