icefoganalytics / travel-authorization

0 stars 0 forks source link

Setting dateBackToWork on Travel Authorization Causes a 500 in Travel Desk Travel Request Serializer #233

Closed klondikemarlen closed 1 month ago

klondikemarlen commented 1 month ago

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.

image

To Reproduce Steps to reproduce the behavior:

  1. From the Dashboard page, select "My Travel Requests" from the top dropdown nav.
  2. Create a travel authorization via the "+ Travel Authorization" button.
  3. Create a travel request between Vancouver and Whitehorse.
  4. Pick the travel dates as a short window of 3 days.
  5. Generate the estimate.
  6. Submit the travel authorization to your email as the supervisor.
  7. From the top dropdown nav, select "Manager View".
  8. Find your request in the "Pending Approval" card.
  9. Approve the request.
  10. Return to the "My Travel Requests" page via the top dropdown nav.
  11. 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)