Accommodation Extraction Package
Purpose
This document defines the minimum credible accommodation extraction package based on current code truth.
It does not claim accommodation is already extracted.
It distinguishes between:
- files that are good move-first extraction material
- shared shell pieces that should remain outside the runtime
- temporary hosting that still belongs to the current
svc-tendersshell - legacy compatibility residue
- unresolved mixed pieces
Move To Accommodation Runtime
| Path | Why it belongs in the extracted runtime | Notes |
| --- | --- | --- |
| services/svc-tenders/src/accommodation/contracts.ts | Accommodation-owned request/response/support contract surface | Route-facing types already live here. |
| services/svc-tenders/src/accommodation/validation.ts | Accommodation-owned payload validation | Draft/update/booking/quote validation is already domain-local. |
| services/svc-tenders/src/accommodation/domain.ts | Accommodation aggregate and mutation rules | Durable listing/booking lifecycle ownership is here. |
| services/svc-tenders/src/accommodation/projections.ts | Accommodation projection maintenance | Needed by write model and preferred reads. |
| services/svc-tenders/src/accommodation/commandHandlers.ts | Accommodation listing + booking write model | Real backend mutation surface. |
| services/svc-tenders/src/accommodation/readModel.ts | Preferred public/detail/booking read repository | Real active read path for listings, quote inputs, and bookings. |
| services/svc-tenders/src/accommodation/ownerReadRepository.ts | Preferred owner listing reads | Real owner-facing read path. |
| services/svc-tenders/src/accommodation/quote.ts | Accommodation-local quote logic | Active route behavior, not generic shell logic. |
| services/svc-tenders/src/routes/registerAccommodationRoutes.ts | Accommodation route registration | Already depends on accommodation-owned handlers/repositories. |
| services/svc-tenders/src/routes/support/accommodationRouteSupport.ts | Accommodation-local route support | Keeps mutation mapping and public payload shaping local. |
| services/svc-tenders/migrations/0041_accommodation_write_model.sql | Canonical write/projection schema start for real accommodation runtime | Strongest move-first migration. |
| services/svc-tenders/migrations/0044_add_details_json_to_views.sql | Accommodation view/read-model enrichment | Accommodation-specific follow-up migration. |
| services/svc-tenders/migrations/0045_change_accommodation_id_to_text.sql | Accommodation schema adjustment for listing/booking IDs | Accommodation-specific and needed by active runtime truth. |
Keep Shared With Kvary
| Path | Shared verdict | Notes |
| --- | --- | --- |
| services/api/src/routes/accommodationsServiceTarget.ts | keep shared | Gateway seam owner for ACCOMMODATIONS_SERVICE_URL ?? TENDERS_SERVICE_URL. |
| services/api/src/routes/accommodations.ts | keep shared | Public gateway proxy façade stays at API layer. |
| services/api/src/routes/accommodation-listings.ts | keep shared | Mutation gateway façade. |
| services/api/src/routes/accommodation-bookings.ts | keep shared | Booking gateway façade. |
| services/api/src/routes/my-accommodation-bookings.ts | keep shared | Authenticated booking-read gateway façade. |
| services/api/src/routes/owner-accommodation-listings.ts | keep shared | Owner-listing gateway façade. |
| services/api/src/routes/owner-accommodation-reservations.ts | keep shared | Owner-reservation gateway façade. |
| shared /auth/me principal resolution contract | keep shared | Shared auth/identity backbone dependency, not accommodation domain ownership. |
| bearer token verification + shared JWT secret contract | keep shared for now | Same extraction pattern as ICPI: shared ingress contract, copied runtime adapter if needed. |
Keep Temporarily In Current Host
| Path | Why it stays temporarily | Notes |
| --- | --- | --- |
| services/svc-tenders/src/server.ts accommodation wiring | current host remains active | Old host stays until copy-first runtime parity exists. |
| services/svc-tenders/src/routes/support/detailExtractionSupport.ts | still shared with vacancy support | Small helper can be copied into extracted runtime later, but it is not accommodation-only today. |
| services/svc-tenders/src/http/authTypes.ts | current type home is shell-local | A local runtime copy or narrower shared package can come later. |
| services/svc-tenders/src/repository.ts accommodation compatibility methods | older callers still hosted here | No active accommodation route depends on them, but root hosting still exists. |
| services/svc-tenders/migrations/0046_seed_accommodation_data.sql | dev/demo seed decision not yet separated from runtime ownership | Useful fixture, but not proof of canonical runtime migration ownership. |
Legacy / Compatibility Residue
| Path | Why it is residue | Notes |
| --- | --- | --- |
| services/svc-tenders/src/accommodation/compatibilityReadRepository.ts | legacy accommodations catalog compatibility path | Not the preferred route-time public read path anymore. |
| services/svc-tenders/migrations/0005_vacancies_accommodations.sql | mixed legacy vacancy + accommodation compatibility schema | Too mixed to treat as clean extracted accommodation ownership. |
| services/svc-tenders/migrations/0006_accommodations_detail_payload.sql | legacy compatibility catalog follow-up | Still tied to old accommodations truth. |
Unresolved / Mixed
| Path | Why it is unresolved | Notes |
| --- | --- | --- |
| services/svc-tenders/migrations/0042_vacancy_accommodation_context.sql | mixed vacancy + accommodation schema change | Cannot move cleanly with accommodation alone yet. |
| services/svc-tenders/migrations/0043_vacancy_accommodation_declaration_details.sql | mixed accommodation + declaration detail shape | Cross-domain ownership still mixed. |
| local outbox_events usage from services/svc-tenders/src/accommodation/commandHandlers.ts | event infrastructure still hosted in svc-tenders assumptions | Real, but not yet an extracted external event contract. |
| root compatibility hosting in services/svc-tenders/src/repository.ts | older accommodation callers still routed through mixed root repository | Needs caller reduction or explicit compatibility retention decision later. |
Main blockers before actual extraction execution
- legacy public accommodation compatibility reads still exist in
services/svc-tenders/src/accommodation/compatibilityReadRepository.ts - mixed migration ownership across
0005,0006,0042, and0043 detailExtractionSupport.tsstill serves both vacancy and accommodation route support- shared auth ingress is still shell-owned rather than copied into an accommodation runtime yet
- root compatibility hosting in
services/svc-tenders/src/repository.tsstill exists for older consumers
Safest extraction direction
- create a copy-first accommodation runtime
- move the accommodation-owned route, support, domain, validation, read, write, and quote modules there
- keep gateway seam unchanged
- keep old
svc-tendersaccommodation host as rollback until parity is proven - decide migration ownership only after copy-first runtime wiring is stable