Skip to content

feat(server): webhook Q&A models (WebhookQuestion/WebhookAnswer)#230

Merged
GerardPaligot merged 5 commits into
mainfrom
feature/webhook-questions
Jun 2, 2026
Merged

feat(server): webhook Q&A models (WebhookQuestion/WebhookAnswer)#230
GerardPaligot merged 5 commits into
mainfrom
feature/webhook-questions

Conversation

@GerardPaligot

Copy link
Copy Markdown
Contributor

Summary

Gives the outbound webhook its own Q&A contract, decoupled from the internal QandaQuestion domain model.

  • Adds WebhookQuestion / WebhookAnswer domain models (webhooks/domain) with an explicit order. order and is_correct are required (no Kotlin defaults) so kotlinx.serialization always emits them on the wire — even at 0 / false.
  • Adds QandaQuestionEntity.toWebhookQuestion(order) mapper (webhooks/application/mappers) deriving order from list position; answers are indexed by their collection position.
  • Retypes WebhookPayload.questions from List<QandaQuestion>List<WebhookQuestion>, dropping the internal partnership_id / created_at from the wire format.
  • HttpWebhookGateway now fetches questions ordered by created_at ASC (consistent with QandaRepositoryExposed; previously unordered) and assigns order via mapIndexed.

No DB migration, no OpenAPI change, no front-end change, and the partnership Q&A REST API is untouched.

Known limitation

Answer order reflects the entity collection's read position, not the partner's authored order — answers have no timestamp/order column and update() recreates them with random UUID PKs. Persisting true order was intentionally out of scope.

Test Plan

  • WebhookQuestionTest — serialization keeps order and is_correct even at 0 / false; answers defaults to empty list
  • QandaWebhookMapperTest — DB-backed: maps fields, indexes answers 0,1,2, preserves is_correct
  • Full gate green: ./gradlew ktlintCheck detekt test build — 667 tests, 0 failures/errors

Note: the branch also commits the design + implementation plan under docs/superpowers/. Drop those commits if your repo prefers specs under server/specs/.

🤖 Generated with Claude Code

GerardPaligot and others added 5 commits June 2, 2026 21:32
…nswer)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@GerardPaligot GerardPaligot merged commit 9f3ef8c into main Jun 2, 2026
1 check passed
@GerardPaligot GerardPaligot deleted the feature/webhook-questions branch June 2, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant