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

[core] return error message on invalid dob #8267

Closed
wants to merge 8 commits into from

Conversation

regisoc
Copy link
Contributor

@regisoc regisoc commented Dec 13, 2022

Brief summary of changes

When using /api/v0.0.3/candidates with an invalid date format, returns 400 Bad Requests/JSON errors.
This PR checks the date of birth and returns the correct format in the message ('yyyy-mm-dd').

Testing instructions (if applicable)

  1. Log into to get a token:
curl -v -k -X 'POST' \
  'https://<hostname>/api/v0.0.3/login' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "<username>",
  "password": "<password>"
}'
  1. Test for /api/v0.0.3/candidates endpoint:
curl -v -k -X POST 'https://<hostname>/api/v0.0.3/candidates' \
    -H "Authorization: Bearer <token>" \
    -d '{
        "Candidate": {
            "Project": "Rye",
            "Site": "Montreal",
            "DoB": "<a_date>",
            "Sex": "Female"
        }
    }'

Link(s) to related issue(s)

php/libraries/Candidate.class.inc Outdated Show resolved Hide resolved
php/libraries/Candidate.class.inc Outdated Show resolved Hide resolved
regisoc and others added 3 commits December 15, 2022 06:36
Co-authored-by: Xavier Lecours <xavier.lecours@mcin.ca>
php/libraries/Candidate.class.inc Outdated Show resolved Hide resolved
php/libraries/Candidate.class.inc Outdated Show resolved Hide resolved
@regisoc
Copy link
Contributor Author

regisoc commented Dec 15, 2022

@xlecours do I need a rebase to 24.1 for this PR? I am not entirely sure

@xlecours
Copy link
Contributor

@xlecours do I need a rebase to 24.1 for this PR? I am not entirely sure

I am not sure actually. I would say, send a PR to 24.1 as well.
@driusan ?

@driusan
Copy link
Collaborator

driusan commented Dec 15, 2022

Yes, 24.1 is the latest release, so it still gets bug fixes.

@regisoc
Copy link
Contributor Author

regisoc commented Dec 16, 2022

Duplicated to #8279 for 24.1 fix

@driusan
Copy link
Collaborator

driusan commented Dec 16, 2022

don't duplicate PRs, they'll get pulled forward eventually.. just rebase this one

@regisoc regisoc changed the base branch from main to 24.1-release December 16, 2022 20:56
@regisoc regisoc changed the base branch from 24.1-release to main December 16, 2022 20:57
@regisoc
Copy link
Contributor Author

regisoc commented Dec 18, 2022

There are lots of changes for the rebase.
If that is ok, I will close this PR and keep the other one, the branch is already up-to-date with 24.1 on the other one.

@regisoc regisoc closed this Dec 18, 2022
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

3 participants