Describe the bug
When you set a date back to work for the travel authorization if 500s when you go to the Travel Auth -> Request tab due to a bug in the serializer.
To Reproduce
Steps to reproduce the behavior:
From the Dashboard page, select "My Travel Requests" from the top dropdown nav.
Create a travel authorization via the "+ Travel Authorization" button.
Create a travel request between Vancouver and Whitehorse.
Pick the travel dates as a short window of 3 days.
Generate the estimate.
Submit the travel authorization to your email as the supervisor.
From the top dropdown nav, select "Manager View".
Find your request in the "Pending Approval" card.
Approve the request.
Return to the "My Travel Requests" page via the top dropdown nav.
Find your approved request in the table, and click on the "Submit travel desk request" call-to-action button.
Expected behavior
Page should not 500.
Additional context
This bug is caused by a bug in Sequelize 6 where fields of type DATEONLY supposedly return js Date, but actually return "string".
This issue in a bunch of models, and will need to be fixed everywhere.
There will be a lot of type errors that will need to be handled after it gets fixed.
Error as text
App is running > Object
main.js:52
Failed to load resource: the server responded with a status of 500 ()
api/travel-desk-trav...%5D=237&perPage=1:1
Failed to fetch
use-travel-desk-travel-requests.js:60
travelDeskTravelRequests:
Error: Failed to retrieve travel desk requests: TypeError:
dateBackToWork.toISOString is not a function
at http-client.js:36:11
at async Le.request (Axios.js:40:7)
at async Object.list (travel-desk-travel-requests-api.js:91:13)
at async n (use-travel-desk-travel-requests.js:52:41)
at async deep (use-travel-desk-travel-requests.js:71:11)
vue.runtime.esm.js:3065
Error: Failed to retrieve travel desk requests: TypeError:
dateBackToWork.toISOString is not a function
at http-client.js:36:11
at async Le.request (Axios.js:40:7)
at async Object.list (travel-desk-travel-requests-api.js:91:13)
at async n (use-travel-desk-travel-requests.js:52:41)
at async deep (use-travel-desk-travel-requests.js:71:11)
Implementation
Fix types around Sequelize DATEONLY fields, now returns Date | string [| null]; This is an issue with Sequelize 6. The expected types should probably be string?
Use better error logging in controller that through the error before; All controllers should have a better way of logging errors.
Fixes https://github.com/icefoganalytics/travel-authorization/issues/233
Relates to:
Context
Describe the bug When you set a date back to work for the travel authorization if 500s when you go to the Travel Auth -> Request tab due to a bug in the serializer.
To Reproduce Steps to reproduce the behavior:
Expected behavior Page should not 500.
Additional context This bug is caused by a bug in Sequelize 6 where fields of type DATEONLY supposedly return js Date, but actually return "string".
This issue in a bunch of models, and will need to be fixed everywhere. There will be a lot of type errors that will need to be handled after it gets fixed.
Error as text
Implementation
Fix types around Sequelize DATEONLY fields, now returns Date | string [| null]; This is an issue with Sequelize 6. The expected types should probably be string? Use better error logging in controller that through the error before; All controllers should have a better way of logging errors.
Screenshots
Testing Instructions
dev test
(ordev test_api
)dev up