feat(server): webhook Q&A models (WebhookQuestion/WebhookAnswer)#230
Merged
Conversation
…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>
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.
Summary
Gives the outbound webhook its own Q&A contract, decoupled from the internal
QandaQuestiondomain model.WebhookQuestion/WebhookAnswerdomain models (webhooks/domain) with an explicitorder.orderandis_correctare required (no Kotlin defaults) so kotlinx.serialization always emits them on the wire — even at0/false.QandaQuestionEntity.toWebhookQuestion(order)mapper (webhooks/application/mappers) derivingorderfrom list position; answers are indexed by their collection position.WebhookPayload.questionsfromList<QandaQuestion>→List<WebhookQuestion>, dropping the internalpartnership_id/created_atfrom the wire format.HttpWebhookGatewaynow fetches questions ordered bycreated_at ASC(consistent withQandaRepositoryExposed; previously unordered) and assignsorderviamapIndexed.No DB migration, no OpenAPI change, no front-end change, and the partnership Q&A REST API is untouched.
Known limitation
Answer
orderreflects the entity collection's read position, not the partner's authored order — answers have no timestamp/order column andupdate()recreates them with random UUID PKs. Persisting true order was intentionally out of scope.Test Plan
WebhookQuestionTest— serialization keepsorderandis_correcteven at0/false;answersdefaults to empty listQandaWebhookMapperTest— DB-backed: maps fields, indexes answers0,1,2, preservesis_correct./gradlew ktlintCheck detekt test build— 667 tests, 0 failures/errors🤖 Generated with Claude Code