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

psp-6887 add date and time aliases to frontend. Add model typing to backend. #3516

Closed
wants to merge 2 commits into from

Conversation

devinleighsmith
Copy link
Collaborator

time aliases for frontend/backend models.

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #3516 (e558d5c) into dev (5ca8e92) will decrease coverage by 0.02%.
The diff coverage is 85.84%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #3516      +/-   ##
==========================================
- Coverage   69.57%   69.56%   -0.02%     
==========================================
  Files        1371     1372       +1     
  Lines       33877    33895      +18     
  Branches     6299     6303       +4     
==========================================
+ Hits        23570    23579       +9     
- Misses      10053    10060       +7     
- Partials      254      256       +2     
Flag Coverage Δ
unittests 69.56% <85.84%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...backend/api/Areas/Leases/Models/Search/LeaseMap.cs 100.00% <100.00%> (ø)
...els/Concepts/AcquisitionFile/AcquisitionFileMap.cs 100.00% <100.00%> (ø)
...pi/Models/Concepts/AcquisitionFile/AgreementMap.cs 100.00% <100.00%> (ø)
...pensationRequisition/CompensationRequisitionMap.cs 100.00% <100.00%> (ø)
.../api/Models/Concepts/Deposit/SecurityDepositMap.cs 100.00% <100.00%> (ø)
...odels/Concepts/Deposit/SecurityDepositReturnMap.cs 100.00% <100.00%> (ø)
.../backend/api/Models/Concepts/Lease/InsuranceMap.cs 100.00% <100.00%> (ø)
...urce/backend/api/Models/Concepts/Lease/LeaseMap.cs 100.00% <100.00%> (ø)
.../backend/api/Models/Concepts/Lease/LeaseTermMap.cs 100.00% <100.00%> (ø)
...ce/backend/api/Models/Concepts/Lease/PaymentMap.cs 100.00% <100.00%> (ø)
... and 33 more

@devinleighsmith devinleighsmith changed the title add date and time aliases to frontend. Add model typing to backend. psp-6887 add date and time aliases to frontend. Add model typing to backend. Oct 26, 2023
@devinleighsmith devinleighsmith marked this pull request as draft October 27, 2023 17:08
@devinleighsmith
Copy link
Collaborator Author

converting to draft due to stability risk for a release sprint.

@devinleighsmith devinleighsmith force-pushed the psp-6887 branch 2 times, most recently from 3ffacc2 to e59956e Compare November 15, 2023 01:37
frontend/backend now use typings to better reflect desired use of field (id timestamp vs dateonly).
@devinleighsmith devinleighsmith marked this pull request as ready for review November 15, 2023 17:24
Copy link
Contributor

✅ No secrets were detected in the code.

@@ -6,6 +6,7 @@ import {
import { Api_CompensationRequisition } from '@/models/api/CompensationRequisition';
import { Api_Project } from '@/models/api/Project';
import Api_TypeCode from '@/models/api/TypeCode';
import { UtcIsoDateTime } from '@/models/api/UtcIsoDateTime';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the frontend nor the backend can guarantee that the date is in UTC. For that reason how about isoDateTime?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I mean guarantee as a type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by that logic there is no guarantee that the string is an iso formatted string either. I lean more towards leaving utc in as it describes the intended contents - in the same was as IsoDateTime does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FuriousLlama any thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do control that the backend will format the DateTime type to an iso string, we can't enforce that the date time being encoded will be in utc. In a nutshell, there is no DateTimeUTC on the backend we can rely on so we cannot make that assumption on the frontend either. Although I apreciate the intent of the utc on the name, it might lead to bugs or mistakes where the developer presumes that using that type guarantees utc-ness

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I get it sorry, we have complete control over the format the backend returns dates in, which means we can either implicitly or explicitly format all date strings as utc date strings, ie:
20120915T155300–0000

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more, I feel like we also want to keep utc in the name since we want to explicitly only send utc strings to the backend. In my mind, there is never a time we would want to send or receive a date that is not storing a utc date.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets discuss in dev meeting tmrw.

@devinleighsmith devinleighsmith marked this pull request as draft December 1, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Removing technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants