Merged
Conversation
Member
Author
|
Closes #72 |
perkynades
reviewed
Feb 15, 2021
spiftire
reviewed
Feb 15, 2021
| const ballotSerivce = new BallotService(database, new ElectionService(database)) | ||
| const id = Number.parseInt(request.params.id) | ||
| const ballot = await ballotSerivce.get(id) | ||
| return ballot instanceof Ballot ? response.send(ballot) : response.status(StatusCodes.NOT_FOUND).send() |
Contributor
There was a problem hiding this comment.
can it be any other Type except undefined or null?
Member
Author
There was a problem hiding this comment.
? it can be Ballot or undefined/null , if it is typeof ballot return the ballot else 404
Contributor
There was a problem hiding this comment.
but ballotServise.get(id) will retur Ballot or undefined so return satment could be
Suggested change
| return ballot instanceof Ballot ? response.send(ballot) : response.status(StatusCodes.NOT_FOUND).send() | |
| return ballot ? response.send(ballot) : response.status(StatusCodes.NOT_FOUND).send() |
Co-authored-by: spiftire <44159536+spiftire@users.noreply.github.com>
Co-authored-by: spiftire <44159536+spiftire@users.noreply.github.com>
spiftire
approved these changes
Feb 16, 2021
sanderhurlen
approved these changes
Feb 16, 2021
Co-authored-by: Sander Hurlen <sander.hurlen@icloud.com>
Co-authored-by: Sander Hurlen <sander.hurlen@icloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.