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

server/csharp: Fix issues around last_updated field. #85

Merged
merged 1 commit into from
May 2, 2024

Conversation

philipaconrad
Copy link
Member

@philipaconrad philipaconrad commented May 2, 2024

What changed?

This PR fixes an issue where the UI would not display timestamps, or appear to visibly update them during ticket resolve/unresolve UI interactions, when using the csharp server profile.

The cause was the C# server's EF Core model expecting (and serializing) the field as lastUpdated instead of last_updated. By adding a few model annotations + UTC conversion logic in the controller, things seem to be back in working order.

curl /tickets before fix
$ curl --header 'Content-Type: application/json' --cookie 'user=acmecorp / bob' 'http://localhost:4000/api/tickets'
{"tickets":[{"id":11,"description":"Gibberish gibberish","lastUpdated":"2024-04-30T21:26:35.816112","resolved":true,"customer":"Globex","tenant":"acmecorp"},{"id":2,"description":"Flamethrower implementation is too heavyweight","lastUpdated":"2024-04-30T21:26:34.249131","resolved":true,"customer":"Globex","tenant":"acmecorp"},{"id":1,"description":"Dooms day device needs to be refactored","lastUpdated":"2024-04-30T21:26:34.249131","resolved":false,"customer":"Globex","tenant":"acmecorp"},{"id":4,"description":"Happy Vertical People Transporters need to be more efficient in determining destination floor","lastUpdated":"2024-04-30T21:26:34.249131","resolved":false,"customer":"Sirius Cybernetics Corp.","tenant":"acmecorp"},{"id":3,"description":"Latest android exhibit depression tendencies","lastUpdated":"2024-04-30T21:26:34.249131","resolved":false,"customer":"Sirius Cybernetics Corp.","tenant":"acmecorp"},{"id":6,"description":"Temporal dislocation field reacts with exposed metal","lastUpdated":"2024-04-30T21:26:34.249131","resolved":true,"customer":"Cyberdyne Systems Corp.","tenant":"acmecorp"},{"id":5,"description":"Mimetic polyalloy becomes brittle at low temperatures","lastUpdated":"2024-04-30T21:26:34.249131","resolved":false,"customer":"Cyberdyne Systems Corp.","tenant":"acmecorp"}]}
curl /tickets after fix
$ curl --header 'Content-Type: application/json' --cookie 'user=acmecorp / bob' 'http://localhost:4000/api/tickets'
{"tickets":[{"id":1,"description":"Dooms day device needs to be refactored","last_updated":"2024-05-02T19:52:31Z","resolved":false,"customer":"Globex","tenant":"acmecorp"},{"id":2,"description":"Flamethrower implementation is too heavyweight","last_updated":"2024-05-02T19:52:01Z","resolved":true,"customer":"Globex","tenant":"acmecorp"},{"id":4,"description":"Happy Vertical People Transporters need to be more efficient in determining destination floor","last_updated":"2024-05-02T19:52:01Z","resolved":false,"customer":"Sirius Cybernetics Corp.","tenant":"acmecorp"},{"id":3,"description":"Latest android exhibit depression tendencies","last_updated":"2024-05-02T19:52:01Z","resolved":false,"customer":"Sirius Cybernetics Corp.","tenant":"acmecorp"},{"id":6,"description":"Temporal dislocation field reacts with exposed metal","last_updated":"2024-05-02T19:52:01Z","resolved":true,"customer":"Cyberdyne Systems Corp.","tenant":"acmecorp"},{"id":5,"description":"Mimetic polyalloy becomes brittle at low temperatures","last_updated":"2024-05-02T19:52:01Z","resolved":false,"customer":"Cyberdyne Systems Corp.","tenant":"acmecorp"}]}

@philipaconrad philipaconrad added bug Something isn't working c# Pull requests that update C# code labels May 2, 2024
@philipaconrad philipaconrad requested a review from chendrix May 2, 2024 19:59
@philipaconrad philipaconrad self-assigned this May 2, 2024
@philipaconrad philipaconrad merged commit c4df58c into main May 2, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c# Pull requests that update C# code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants