Files
Holzleitner---Backend--aktu…/.env.example
Dennis Nemec 438040acce Initial: Rust-Backend mit Clean Architecture (domain/application/infrastructure/api)
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
2026-05-14 22:28:31 +02:00

25 lines
1.1 KiB
Plaintext

# Vorlage für lokale Entwicklung — kopieren nach `.env` und nach Bedarf anpassen.
# Die `.env` selbst gehört nicht in Git.
# --- HTTP-Server ----------------------------------------------------------
SERVER_HOST=127.0.0.1
SERVER_PORT=3000
# --- Postgres -------------------------------------------------------------
# Passt zur docker-compose.yml (Service `postgres`).
DATABASE_URL=postgres://holzleitner:holzleitner_dev@localhost:5432/holzleitner
DATABASE_MAX_CONNECTIONS=10
# --- Keycloak (OIDC) ------------------------------------------------------
# Passt zur docker-compose.yml (Service `keycloak`).
# Admin-UI: http://localhost:8080/admin/ (admin / admin)
# Realm: holzleitner
# Test-User: testfahrer / test (Personalnummer 1001, Rolle "driver")
KEYCLOAK_ISSUER_URL=http://localhost:8080/realms/holzleitner
KEYCLOAK_AUDIENCE=holzleitner-api
KEYCLOAK_JWKS_CACHE_TTL_SECONDS=3600
# --- Logging --------------------------------------------------------------
# Standard-Filter; siehe tracing_subscriber::EnvFilter-Doku.
RUST_LOG=holzleitner_api=info,holzleitner_infrastructure=info,tower_http=info