Vier-Crate-Workspace mit:
- Domain: Account, Car, Tour, Delivery, DeliveryItem, DeliveryNote, Customer,
Article, Warehouse, ScanState, AuditAction — alle mit serde + feature-gated
utoipa::ToSchema.
- Application: Ports (TourRepository, DeliveryRepository, ScanRepository,
DeliveryNoteRepository, CarRepository, AuthService) und Use Cases.
- Infrastructure: Postgres-Adapter via sqlx (PgTourRepository etc.) +
Keycloak-AuthService mit JWKS-Cache + OIDC-Discovery.
- API: Axum 0.8, utoipa-OpenAPI + Swagger-UI, JWT-Bearer-Middleware,
AuthenticatedUser-Extractor.
Endpoints:
- GET /me/tours/today, /tours/{id}, /accounts/{pn}, /me/cars, /health
- POST /sync/tour, /scans (bulk + idempotent via clientScanId),
/deliveries/{id}/{hold,resume,cancel,complete,notes}, /me/cars
- PUT /tours/{id}/delivery-order, /deliveries/{id}/assigned-car, /me/cars/{id}
- PATCH /me/cars/{id}
Datenmodell:
- 6 Migrationen (accounts, tours/deliveries/items + Stammdaten,
scan_audit mit clientScanId-UNIQUE, state_reason refactor,
delivery_notes, cars + FKs nachziehen).
- Business-stabile Beleg-Keys (belegart_id, belegnummer) für ERP-Sync.
- Append-only scan_audit + embedded scan_state als doppelte Wahrheit.
Dev-Setup:
- docker-compose mit Postgres 17 + Keycloak 26
- Keycloak-Realm 'holzleitner' mit Public-Client (PKCE), Testfahrer
(PN 1001) + Audience-/Personalnummer-Mapper
48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
# Lokales Entwicklungs-Setup für das Holzleitner-Backend.
|
|
# Startbefehl: docker compose up -d
|
|
#
|
|
# Postgres-Daten landen im benannten Volume `postgres-data` und überleben
|
|
# Container-Neustarts. Keycloak nutzt bewusst keinen persistenten Volume —
|
|
# der Realm wird bei jedem Start frisch aus `keycloak/import/` importiert,
|
|
# damit die Quellen-of-truth Versionierte Dateien bleiben.
|
|
# Komplettes Reset: `docker compose down -v`.
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
container_name: holzleitner-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: holzleitner
|
|
POSTGRES_USER: holzleitner
|
|
POSTGRES_PASSWORD: holzleitner_dev
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U holzleitner -d holzleitner"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
keycloak:
|
|
image: quay.io/keycloak/keycloak:26.0
|
|
container_name: holzleitner-keycloak
|
|
restart: unless-stopped
|
|
command: ["start-dev", "--import-realm"]
|
|
environment:
|
|
# Bootstrap-Admin (Keycloak 26+ neue Env-Vars).
|
|
# Admin-Console: http://localhost:8080/admin/ (admin / admin)
|
|
KC_BOOTSTRAP_ADMIN_USERNAME: admin
|
|
KC_BOOTSTRAP_ADMIN_PASSWORD: admin
|
|
# Health-Endpoints für externe Checks aktivieren.
|
|
KC_HEALTH_ENABLED: "true"
|
|
ports:
|
|
- "8080:8080"
|
|
volumes:
|
|
- ./keycloak/import:/opt/keycloak/data/import:ro
|
|
|
|
volumes:
|
|
postgres-data:
|