Skip to content

Conversation

@g-saracca
Copy link
Contributor

@g-saracca g-saracca commented Sep 25, 2025

What this PR does / why we need it:

Updates the use cases UpdateDatasetMetadata and UpdateFileMetadata to use sourceLastUpdateTime query parameter for optimistic concurrency control.

Which issue(s) this PR closes:

Suggestions on how to test this:

Check test are passing.

Is there a release notes or changelog update needed for this change?:

Yes, added.

@github-actions github-actions bot added FY26 Sprint 6 FY26 Sprint 6 (2025-09-10 - 2025-09-24) FY26 Sprint 7 FY26 Sprint 7 (2025-09-24 - 2025-10-08) GREI Re-arch GREI re-architecture-related SPA.Q3.2025 labels Sep 25, 2025
@g-saracca g-saracca marked this pull request as ready for review September 26, 2025 13:08
@g-saracca g-saracca requested a review from Copilot September 26, 2025 13:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends the file and dataset update functionality to use sourceLastUpdateTime for optimistic concurrency control, replacing the previous internalVersionNumber approach for datasets and adding time-based conflict detection for file metadata updates.

  • Replaces internalVersionNumber parameter with sourceLastUpdateTime for dataset updates
  • Adds lastUpdateTime field to file models and enables optimistic locking for file metadata updates
  • Updates all transformers to use string-based timestamps instead of Date objects for lastUpdateTime

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/datasets/domain/models/Dataset.ts Changes lastUpdateTime from Date to string type
src/datasets/domain/repositories/IDatasetsRepository.ts Replaces internalVersionNumber with sourceLastUpdateTime parameter
src/datasets/domain/useCases/UpdateDataset.ts Updates method signature and documentation for new timestamp-based approach
src/datasets/infra/repositories/DatasetsRepository.ts Implements sourceLastUpdateTime query parameter instead of sourceInternalVersionNumber
src/datasets/infra/repositories/transformers/datasetTransformers.ts Removes Date conversion for lastUpdateTime field
src/datasets/infra/repositories/transformers/datasetPreviewsTransformers.ts Removes Date conversion for lastUpdateTime field
src/files/domain/models/FileModel.ts Adds required lastUpdateTime field
src/files/domain/repositories/IFilesRepository.ts Adds optional sourceLastUpdateTime parameter
src/files/domain/useCases/UpdateFileMetadata.ts Adds sourceLastUpdateTime parameter with documentation
src/files/infra/repositories/FilesRepository.ts Implements conditional sourceLastUpdateTime query parameter
src/files/infra/repositories/transformers/FilePayload.ts Adds required lastUpdateTime field
src/files/infra/repositories/transformers/fileTransformers.ts Maps lastUpdateTime from payload to model
test/integration/datasets/DatasetsRepository.test.ts Updates test to use new timestamp-based conflict detection
test/integration/files/FilesRepository.test.ts Adds comprehensive test for file metadata optimistic locking
test/testHelpers/datasets/datasetHelper.ts Updates to use string instead of Date for lastUpdateTime
test/testHelpers/datasets/datasetPreviewHelper.ts Updates to use string instead of Date for lastUpdateTime
test/testHelpers/files/filesHelper.ts Adds lastUpdateTime field to test helpers
test/unit/files/UpdateFileMetadata.test.ts Updates test expectations to include new undefined parameter

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@g-saracca g-saracca changed the title 343 extend to use source last update time File and Dataset use case: use sourceLastUpdateTime Sep 26, 2025
@g-saracca g-saracca moved this to Ready for Review ⏩ in IQSS Dataverse Project Sep 26, 2025
@g-saracca g-saracca changed the title File and Dataset use case: use sourceLastUpdateTime UpdateDatasetMetadata and UpdateFileMetadata use cases: use sourceLastUpdateTime Sep 26, 2025
@ekraffmiller ekraffmiller self-assigned this Sep 29, 2025
@ekraffmiller ekraffmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Sep 29, 2025
Copy link
Contributor

@ekraffmiller ekraffmiller left a comment

Choose a reason for hiding this comment

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

looks good, approved

@github-project-automation github-project-automation bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Oct 2, 2025
@ofahimIQSS
Copy link
Contributor

Looks good, merging

@ofahimIQSS ofahimIQSS merged commit 0931fa8 into develop Oct 3, 2025
8 of 9 checks passed
@github-project-automation github-project-automation bot moved this from Ready for QA ⏩ to Merged 🚀 in IQSS Dataverse Project Oct 3, 2025
@ofahimIQSS ofahimIQSS deleted the 343-extend-to-use-sourceLastUpdateTime branch October 3, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 6 FY26 Sprint 6 (2025-09-10 - 2025-09-24) FY26 Sprint 7 FY26 Sprint 7 (2025-09-24 - 2025-10-08) GREI Re-arch GREI re-architecture-related SPA.Q3.2025

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

File and Dataset use cases: extend to use sourceLastUpdateTime

4 participants