Skip to content

Use Cases of Editing Guestbook#456

Open
ChengShi-1 wants to merge 3 commits into
developfrom
454-use-cases-of-editing-guestbooks-and-including-inherited-guestbooks
Open

Use Cases of Editing Guestbook#456
ChengShi-1 wants to merge 3 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 on lines +19 to +29
export interface EditGuestbookDTO {
id?: number
name: string
enabled: boolean
emailRequired: boolean
nameRequired: boolean
institutionRequired: boolean
positionRequired: boolean
createTime: string
customQuestions?: EditGuestbookCustomQuestionDTO[]
}
Comment thread docs/useCases.md
Comment on lines +3305 to +3308
const guestbookId = 123
const guestbook: EditGuestbookDTO = {
name: 'new name'
}
Comment thread CHANGELOG.md

### Added

- Guestbooke: Added `editGuestbook` use case.
Comment on lines +28 to +37
public async editGuestbook(guestbookId: number, guestbook: EditGuestbookDTO): Promise<void> {
return this.doPut(
this.buildApiEndpoint(this.guestbooksResourceName, undefined, guestbookId),
guestbook
)
.then(() => undefined)
.catch((error) => {
throw error
})
}
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) GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

Use Cases of Editing Guestbooks

2 participants