Skip to content

Use Cases of Editing Guestbook#456

Merged
ekraffmiller merged 5 commits into
developfrom
454-use-cases-of-editing-guestbooks-and-including-inherited-guestbooks
Jun 29, 2026
Merged

Use Cases of Editing Guestbook#456
ekraffmiller merged 5 commits into
developfrom
454-use-cases-of-editing-guestbooks-and-including-inherited-guestbooks

Conversation

@ChengShi-1

@ChengShi-1 ChengShi-1 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

This API allows the user to make edits to an existing Guestbook, including adding and removing Custom Guestbook Questions.
curl -PUT -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/guestbooks/{ID}" -d "$JSON"

When editing, the whole payload should be provided as json format

Which issue(s) this PR closes:

Related Dataverse PRs:

Special notes for your reviewer:

Suggestions on how to test this:

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

yes

Additional documentation:

@ChengShi-1 ChengShi-1 linked an issue Jun 11, 2026 that may be closed by this pull request
@ChengShi-1 ChengShi-1 added the Size: 3 A percentage of a sprint. 2.1 hours. label Jun 11, 2026
@github-actions github-actions Bot added the FY26 Sprint 25 FY26 Sprint 25 (2026-06-03 - 2026-06-17) label Jun 11, 2026
@ChengShi-1 ChengShi-1 added the GREI Re-arch GREI re-architecture-related label Jun 11, 2026
@ChengShi-1 ChengShi-1 self-assigned this Jun 11, 2026
@ChengShi-1 ChengShi-1 moved this to In Progress 💻 in IQSS Dataverse Project Jun 11, 2026
@ChengShi-1 ChengShi-1 moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Jun 12, 2026
@ChengShi-1 ChengShi-1 removed their assignment Jun 12, 2026
@ChengShi-1 ChengShi-1 marked this pull request as ready for review June 17, 2026 05:34
Copilot AI review requested due to automatic review settings June 17, 2026 05:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support in the JavaScript Dataverse client for editing existing Guestbooks (including custom question updates/removals), aligning with Dataverse backend support for PUT /api/guestbooks/{id}.

Changes:

  • Added editGuestbook repository method, use case, and module exports.
  • Introduced EditGuestbookDTO and expanded Guestbook model types to allow optional IDs on nested question/option objects.
  • Added/updated unit + integration tests and updated docs/changelog entries.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/unit/guestbooks/GuestbooksRepository.test.ts Adds unit coverage for inherited guestbook listing params and editGuestbook request behavior.
test/unit/guestbooks/EditGuestbook.test.ts Adds unit tests for the new EditGuestbook use case behavior and error propagation.
test/integration/guestbooks/GuestbooksRepository.test.ts Adds integration coverage for editing guestbooks, including custom question update/replace/remove scenarios.
src/guestbooks/infra/repositories/GuestbooksRepository.ts Implements editGuestbook via PUT /guestbooks/{id} and supports includeInherited query param for listing.
src/guestbooks/index.ts Wires and exports the new editGuestbook use case and DTO exports.
src/guestbooks/domain/useCases/EditGuestbook.ts Adds the EditGuestbook use case wrapper over the repository method.
src/guestbooks/domain/repositories/IGuestbooksRepository.ts Extends repository contract to include editGuestbook.
src/guestbooks/domain/models/Guestbook.ts Makes nested id fields optional for custom questions/options.
src/guestbooks/domain/dtos/EditGuestbookDTO.ts Introduces the DTO types for guestbook edit payloads.
docs/useCases.md Documents includeInherited and adds an Edit a Guestbook use case section.
CHANGELOG.md Adds an unreleased entry for the new editGuestbook use case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/guestbooks/domain/dtos/EditGuestbookDTO.ts
Comment thread docs/useCases.md
Comment thread CHANGELOG.md Outdated
Comment thread src/guestbooks/infra/repositories/GuestbooksRepository.ts
@cmbz cmbz added the FY26 Sprint 26 FY26 Sprint 26 (2026-06-17 - 2026-07-01) label Jun 18, 2026
@ChengShi-1 ChengShi-1 self-assigned this Jun 22, 2026
@ChengShi-1 ChengShi-1 moved this from Ready for Review ⏩ to In Progress 💻 in IQSS Dataverse Project Jun 22, 2026
@ChengShi-1 ChengShi-1 removed their assignment Jun 23, 2026
@ChengShi-1 ChengShi-1 moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Jun 23, 2026
@ekraffmiller ekraffmiller self-assigned this Jun 26, 2026
@ekraffmiller ekraffmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jun 26, 2026

@ekraffmiller ekraffmiller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Cheng, it looks good! I just have questions about the data sent to the API.

}

export interface EditGuestbookDTO {
id?: number

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be good to remove the id from EditGuestbookDTO, since the API endpoint has the id in the URL, and this is duplicate info. Also it removes the possibility that the id in the DTO might not match the id in the url. What do you think?

nameRequired: boolean
institutionRequired: boolean
positionRequired: boolean
customQuestions: GuestbookCustomQuestion[]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since customQuestions are optional in the API, can we make this property optional too?

@ekraffmiller ekraffmiller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for changes, looks good!

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Jun 29, 2026
@ekraffmiller

Copy link
Copy Markdown
Contributor

tests are passing, ready to merge

@ekraffmiller ekraffmiller merged commit ec54a6b into develop Jun 29, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for QA ⏩ to Merged 🚀 in IQSS Dataverse Project Jun 29, 2026
@pdurbin pdurbin moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 25 FY26 Sprint 25 (2026-06-03 - 2026-06-17) FY26 Sprint 26 FY26 Sprint 26 (2026-06-17 - 2026-07-01) GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

Use Cases of Editing Guestbooks

5 participants