Phase 49: Vetup horse-upserted producer emit (+ placeholder animal-to-vetup workflow)#269
Merged
Conversation
…Phase 49, KI-017)
Mirror the Phase 44 customer-upserted producer for horses: POST /api/horses
and PATCH /api/horses/[id] now fire a fire-and-forget, env-gated, failure-
tolerant horse-upserted event via emitN8nEvent after the successful write.
Payload { action, horseId, customerId, vetupOwnerId, vetupAnimalId, horseName,
microchip, bornAt } — vetupOwnerId ties the animal to its Vetup client,
vetupAnimalId round-trips Vetup's own key. horseRepository create/update now
include the owner's vetupOwnerId via a single selected relation column (no
over-fetch). No schema change.
Adds placeholder consumer n8n/14-animal-to-vetup.json (webhook on /horse-upserted
-> BLOCKED-ON-VETUP-API noOp + PLACEHOLDER Vetup HTTP node), shipped INACTIVE,
mirroring n8n/10-customer-to-vetup.json. The Vetup HTTP call stays blocked on
the unconfirmed Vetup API (KI-014/KI-017) and is left untouched.
Tests (+8): create/update emit the expected payload; no emit on validation/role
failure or a failed write; create still returns 201 when the emitter rejects.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
KI-017 now notes the producer side covers customer AND horse; consumer workflows 10 + 14 remain inactive (BLOCKED-ON-VETUP-API). Phase 49 entry added to BUILD_PLAN. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
This was referenced Jun 17, 2026
RJK134
pushed a commit
that referenced
this pull request
Jun 18, 2026
- CLAUDE.md current-state: add Phase 49 (vetup horse-emit, #269 merged) and an in-flight bullet for the open finance-extras PRs (Phase 48 refunds #271, Phase 50 recurring billing #273); bump phase history (0-49 merged, 48/50 open). - New docs/HANDOVER_2026-06-17.md: what shipped/in-flight, the #271/#273 merge + migration-order notes, remaining backlog (multi-currency declined; external blockers), and the env/merge gotchas. Docs only; no code/schema. Does not touch BUILD_PLAN/memory (the feature PRs carry their own entries) so it won't conflict with #271/#273. Merge left to Richard / Freddie. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
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.
Phase 49 — Vetup
horse-upsertedproducer emitCompletes the one genuine doable-now gap in the Vetup write-back integration. The plan (
CLIENT_PRESENTATION_HANDOVER.md§7) calls for "new client/horse → Vetup". Customer create/update already emitcustomer-upserted, but the horse routes emitted nothing — this closes that, symmetric with the existing pattern. Everything else Vetup remains correctly blocked on Vetup's API spec (untouched).What it does
app/api/horses/route.ts(POST) andapp/api/horses/[id]/route.ts(PATCH) now fireemitN8nEvent('/horse-upserted', …)after the write —void, env-gated, failure-tolerant (a create still returns 201 if the emitter rejects), mirroringcustomer-upsertedexactly.action,horseId,customerId,vetupOwnerId(owner's Vetup client code, so n8n can tie the animal to the right client),vetupAnimalId(round-trips on update),horseName,microchip,bornAt. No over-fetch.lib/repositories/horse.repository.tsselects the owner'svetupOwnerId(one column) so the route can populate the link.n8n/14-animal-to-vetup.json— inactive placeholder consumer (webhook on/horse-upserted→BLOCKED-ON-VETUP-APInoOp + placeholder Vetup HTTP node), mirroringn8n/10. Ready to wire the moment Vetup's API lands.Scope / status
Horse.vetupAnimalId/microchip/bornAtandCustomer.vetupOwnerIdall already exist) —git diff main -- prisma/is empty.Verification
lint ✓ · typecheck ✓ · prisma validate ✓ · build ✓ · unit suite 2,839 → 2,847 (+8) (create/update emit the expected payload; no emit on validation/role/write failure; fire-and-forget proven).
Final merge left to Richard / Freddie.
https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
Generated by Claude Code