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

Fixes last_audit_date not being stored via API correctly #14486

Merged
merged 2 commits into from Mar 25, 2024

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR updates the StoreAssetRequest to put last_audit_date in a state that is valid for saving. The docs say that last_audit_date can be passed as a date but under the hood it needs to be stored as a datetime (#14472 introduced that validation).

If last_audit_date is provided, this PR uses Carbon to parse it and format it with a timestamp (always 00:00:00 even if the user provided a full datetime since that is the behavior we had previously) so it is savable.

Fixes the failing test that was introduced in #14472

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@marcusmoore marcusmoore requested a review from snipe as a code owner March 25, 2024 19:48
Copy link

This pull request has been linked to Shortcut Story #25139: Fix last audit date test failure.

Copy link

what-the-diff bot commented Mar 25, 2024

PR Summary

  • Refinement to StoreAssetRequest
    In the file named StoreAssetRequest.php, we've added functionality to automatically set the last_audit_date field (should it exist in the data being processed), and convert it to a standard date/time format for consistency.

  • Alterations to AssetStoreTest
    Within the AssetStoreTest.php file, several changes were made to the testing of our asset storage:

    • The assertion for $asset->last_audit_date now ensures that this date is logged in a 'YYYY-MM-DD HH:MM:SS' format where 'HH:MM:SS' is always '00:00:00', signifying midnight.

    • Addition of testSetsLastAuditDateToMidnightOfProvidedDate method which verifies that when a last_audit_date is provided in the data, it's automatically set to the midnight of said date.

    • Addition of testLastAuditDateCanBeNull method to ensure that if the last_audit_date is not provided in the data, it should remain null in our database, avoiding incorrect data entries.

@snipe snipe merged commit 83ef7c6 into snipe:develop Mar 25, 2024
8 checks passed
@marcusmoore marcusmoore deleted the bug/sc-25139 branch March 25, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants