Skip to content

Phase 49: Vetup horse-upserted producer emit (+ placeholder animal-to-vetup workflow)#269

Merged
RJK134 merged 2 commits into
mainfrom
feature/49-vetup-horse-emit
Jun 17, 2026
Merged

Phase 49: Vetup horse-upserted producer emit (+ placeholder animal-to-vetup workflow)#269
RJK134 merged 2 commits into
mainfrom
feature/49-vetup-horse-emit

Conversation

@RJK134

@RJK134 RJK134 commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Phase 49 — Vetup horse-upserted producer emit

Completes 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 emit customer-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) and app/api/horses/[id]/route.ts (PATCH) now fire emitN8nEvent('/horse-upserted', …) after the write — void, env-gated, failure-tolerant (a create still returns 201 if the emitter rejects), mirroring customer-upserted exactly.
  • Payload carries the Vetup linkage: 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.ts selects the owner's vetupOwnerId (one column) so the route can populate the link.
  • New n8n/14-animal-to-vetup.json — inactive placeholder consumer (webhook on /horse-upsertedBLOCKED-ON-VETUP-API noOp + placeholder Vetup HTTP node), mirroring n8n/10. Ready to wire the moment Vetup's API lands.

Scope / status

  • No schema change (Horse.vetupAnimalId/microchip/bornAt and Customer.vetupOwnerId all already exist) — git diff main -- prisma/ is empty.
  • Blocked parts untouched: no real Vetup HTTP client, no invented endpoints; consumers 10 + 14 ship inactive. KI-017 note updated (producer now covers customer and horse; consumers remain API-blocked).

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

claude added 2 commits June 17, 2026 21:42
…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

@RJK134 RJK134 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed

@RJK134 RJK134 merged commit d53176a into main Jun 17, 2026
7 of 8 checks passed
@RJK134 RJK134 deleted the feature/49-vetup-horse-emit branch June 17, 2026 21:46
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
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.

2 participants