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

validate team code #31

Merged
merged 2 commits into from
Apr 24, 2024
Merged

validate team code #31

merged 2 commits into from
Apr 24, 2024

Conversation

nishadipri
Copy link
Collaborator

Description

implemented team code validation

Fixes # (issue)

How to test?

Please provide a short summary how your changes can be tested?

Checklist

  • I have performed a self-review of my own code
  • I have followed the name conventions for CSS Classnames and filenames, Components names and filenames, Style filenames, if you are in doubt check the the project README.MD and here https://github.com/HackYourFuture-CPH/curriculum/blob/master/review/review-checklist.md
  • I have commented my code, particularly in hard-to-understand areas, if you code was simple enough mark the box anyway
  • I have made corresponding changes to the documentation, if you code was simple enough mark the box anyway
  • This PR is ready to be merged and not breaking any other functionality

@nishadipri nishadipri requested a review from a team as a code owner April 21, 2024 04:18
Copy link
Sponsor Contributor

@shpomp shpomp left a comment

Choose a reason for hiding this comment

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

const results = await knex('Teams').where({ team_code: teamCode });

if (results.length === 0) {
throw new Error('Team not found');
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Perhaps would be better to not throw an error, but to send a response with 404 code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Uploading Screenshot 2024-04-21 at 17.21.32.png…

Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

I cannot see the pic
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2024-04-21 at 17 21 32 we have something like this when user enter the wrong code

Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

I saw this, but I mean in terms of the API, it is perhaps not the best to throw an error here, because and error did not happen.
"The HTTP 404 Not Found response status code indicates that the server cannot find the requested resource."

@nishadipri nishadipri requested a review from shpomp April 22, 2024 04:07
const results = await knex('Teams').where({ team_code: teamCode });

if (results.length === 0) {
throw new Error('Team not found');
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

I saw this, but I mean in terms of the API, it is perhaps not the best to throw an error here, because and error did not happen.
"The HTTP 404 Not Found response status code indicates that the server cannot find the requested resource."

@nishadipri nishadipri merged commit a85d4a8 into main Apr 24, 2024
4 checks passed
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.

None yet

2 participants