anitab-org / anitab-org/bridge-in-tech-backend
Bug: Unhandled errors and bugs in program creation
- Vorherrschende Sprache
- Python
- Sterne
- 24
- Forks
- 80
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
### Describe the bug
There are a few scenarios where API throws unhandled errors when the request payload contains invalid data. Some examples are:
1. enum validations - e.g. `ContacType` and `Zone` are enums - if the data is not valid, unhandled error is thrown
2. integrity errors -> e.g. too many chars in some string (more than column can hold)
3. datetime format -> if the datetime format is not good
### To Reproduce
Steps to reproduce the behavior:
1. Go to `/organizations/{organization_id}/programs/program`
2. Populate fields of the body (use some invalid data from the description)
3. An error occurs (see some screenshots)
### Expected behavior
1. Add validations to enum fields - only acceptable values (`ContactType`, `Zone`, `ProgramStatus`)
2. Add support for currency - define a few mostly used currencies and/or add defense mechanisms for integrity errors with `try/except`
### Screenshots
Some of the examples:
- Bad date format

- Zone not valid

- Invalid currency provided (accepts up to 3 characters)
 -
- Returns success if `start_date > end_date`
### Desktop (please complete the following information):
- OS: elementary OS 5.1.7 Hera (built on Ubuntu)
- Browser: Google Chrome
- Version: 88.0.4324.182
### Additional context
Add tests to confirm solution to these use-cases. Subtasks:
- [ ] Add validation to enum values
- [ ] Add integrity errors handling
- [ ] Solve currency fields provision - enum or increase limit of the column
- [ ] Validate date format -> format and value (`start_date < end_date`)
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.