GenomicDataInfrastructure / gdi-userportal-dataset-discovery-service

0 stars 1 forks source link

fix: revert OffsetDateTime parsing #118

Closed brunopacheco1 closed 2 months ago

brunopacheco1 commented 2 months ago

Summary by Sourcery

Revert the parsing of date strings from OffsetDateTime to LocalDateTime across the codebase to fix issues with date handling, ensuring consistency with the expected date format.

Bug Fixes:

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request reverts the OffsetDateTime parsing to LocalDateTime parsing for date-time fields in the package show mapper and related classes. It also updates the date format pattern and modifies test data to match the new format.

File-Level Changes

Change Details Files
Reverted OffsetDateTime parsing to LocalDateTime parsing
  • Changed OffsetDateTime.parse() to LocalDateTime.parse()
  • Updated DATE_FORMATTER pattern to 'yyyy-MM-dd'T'HH:mm:ss.SSSSSS'
  • Modified parse method to use DATE_FORMATTER
  • Updated method return types from OffsetDateTime to LocalDateTime
src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/persistence/CkanDatasetsRepository.java
Updated test data to match new date-time format
  • Changed date-time strings to match the new format (e.g., '2024-03-19T13:37:05.472970')
  • Updated assertions to use the new DATE_FORMATTER
  • Added createdAt and modifiedAt fields to distribution in test data
src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java
Modified date-time field mappings in PackageShowMapper
  • Changed createdAt mapping from 'issued' to 'metadataCreated'
  • Changed modifiedAt mapping from 'modified' to 'metadataModified'
  • Added createdAt and modifiedAt mappings for distribution objects
src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
brunopacheco1 commented 2 months ago

@Markus92 I will revert these changes to temporarily fix the portal, as we have a demo to do.

@hcvdwerf we need to understand what needs to be done in CKAN to ensure we are getting the datetime correctly.