-
Notifications
You must be signed in to change notification settings - Fork 52
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
Fix/plat 2584 #610
Conversation
There was a problem hiding this 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.
src/services/ChallengeService.js
Outdated
@@ -2282,6 +2282,9 @@ function sanitizeData(data, challenge) { | |||
*/ | |||
async function deleteChallenge(currentUser, challengeId) { | |||
const challenge = await challengeDomain.lookup(getLookupCriteria("id", challengeId)); |
There was a problem hiding this comment.
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
- id: challengeId
- status: New
We don't need to fetch a challenge that's not New.
src/services/ChallengeService.js
Outdated
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`); |
There was a problem hiding this comment.
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.
No description provided.