Extend get guestbooks use case with stats#449
Open
ChengShi-1 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional guestbook usage/response statistics support to the “get guestbooks by collection” flow, aligning the client with the Dataverse API enhancement needed for the Manage Guestbooks UI.
Changes:
- Extended
getGuestbooksByCollectionIdto accept an optionalincludeStatsflag and send it as a query parameter when enabled. - Updated the
Guestbookdomain model to optionally exposeusageCountandresponseCount. - Added/updated unit + integration tests, plus documentation and changelog entries.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/unit/guestbooks/GuestbooksRepository.test.ts | New unit coverage for repository query param behavior and error handling. |
| test/unit/guestbooks/GetGuestbooksByCollectionId.test.ts | Adds unit coverage for the use case passing includeStats. |
| test/integration/guestbooks/GuestbooksRepository.test.ts | Adds integration coverage for listing stats and verifying count changes via assignment + guest response submission. |
| src/guestbooks/infra/repositories/GuestbooksRepository.ts | Adds includeStats param and forwards it as query params when true. |
| src/guestbooks/domain/useCases/GetGuestbooksByCollectionId.ts | Extends use case API to accept includeStats. |
| src/guestbooks/domain/repositories/IGuestbooksRepository.ts | Updates repository interface to include optional includeStats. |
| src/guestbooks/domain/models/Guestbook.ts | Adds optional usageCount and responseCount fields. |
| docs/useCases.md | Documents the new includeStats parameter and updates example usage. |
| CHANGELOG.md | Adds an Unreleased entry describing the new includeStats support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+19
| if (!includeStats) { | ||
| return await this.guestbooksRepository.getGuestbooksByCollectionId(collectionIdOrAlias) | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Get Guestbooks By Collection Id: Added optional
includeStatssupport togetGuestbooksByCollectionId, returningusageCountandresponseCountwhen requested.Which issue(s) this PR closes:
Related Dataverse PRs:
Special notes for your reviewer:
Test failed about storage drive, waiting for this PR to be merged
https://github.com/IQSS/dataverse-client-javascript/pull/431/changes#diff-edac108c1a43d5773116d19797d04ecdf890fc97b5cf83ce2d56d38b9a7aca18
Suggestions on how to test this:
Is there a release notes or changelog update needed for this change?:
Additional documentation: