Skip to content

Feature/crud ballot#72

Merged
freshfish70 merged 35 commits intodevelopfrom
feature/crud-ballot
Feb 16, 2021
Merged

Feature/crud ballot#72
freshfish70 merged 35 commits intodevelopfrom
feature/crud-ballot

Conversation

@freshfish70
Copy link
Copy Markdown
Member

No description provided.

@freshfish70 freshfish70 added feature A new feature we need to add infastructure Code, work, cloud infastructure related labels Feb 12, 2021
@freshfish70 freshfish70 added this to the Sprint 5 milestone Feb 12, 2021
@freshfish70
Copy link
Copy Markdown
Member Author

Closes #72

Comment thread src/api/routes/ballot/index.ts Outdated
Comment thread src/api/routes/ballot/index.ts Outdated
Comment thread src/api/routes/ballot/index.ts Outdated
Comment thread src/api/routes/ballot/index.ts Outdated
Comment thread src/services/BallotService.ts
Comment thread tests/helpers/seed/organizer.ts
Comment thread src/lib/Errors/UpdateError.ts Outdated
Comment thread src/models/Ballot/BallotEntity.ts
Comment thread src/services/BallotService.ts Outdated
Comment thread src/services/BallotService.ts Outdated
Comment thread tests/services/BallotService.test.ts
Comment thread tests/services/BallotService.test.ts Outdated
Comment thread src/api/routes/ballot/index.ts Outdated
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()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can it be any other Type except undefined or null?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

? it can be Ballot or undefined/null , if it is typeof ballot return the ballot else 404

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think...

Comment thread src/api/routes/ballot/index.ts
Co-authored-by: spiftire <44159536+spiftire@users.noreply.github.com>
Comment thread src/api/routes/elections/index.ts
Comment thread tests/helpers/seed/election.ts Outdated
Comment thread tests/services/BallotService.test.ts
freshfish70 and others added 4 commits February 16, 2021 14:06
Co-authored-by: Sander Hurlen <sander.hurlen@icloud.com>
Co-authored-by: Sander Hurlen <sander.hurlen@icloud.com>
@freshfish70 freshfish70 merged commit b26e71c into develop Feb 16, 2021
@freshfish70 freshfish70 deleted the feature/crud-ballot branch February 16, 2021 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature we need to add infastructure Code, work, cloud infastructure related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants