mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
feat(reservations): native booking-confirmation import via KDE KItinerary (#1102)
* feat(reservations): native booking-confirmation import via KDE KItinerary
Adds a two-step preview → confirm flow for importing booking emails,
PDFs, PKPass and HTML confirmations. The server invokes the KDE
kitinerary-extractor binary, maps JSON-LD schema.org output to TREK
reservation shapes, and persists via the existing createReservation
pipeline (accommodations, budget, places, WebSocket broadcasts).
- NestJS BookingImportModule: preview + confirm endpoints under
/api/trips/:tripId/reservations/import/booking{,/confirm}
- KitineraryExtractorService: spawns the binary, filters stderr noise,
handles QDateTime (@value) timezone-aware datetimes
- kitinerary-mapper: FlightReservation, TrainReservation, BusReservation,
BoatReservation, LodgingReservation, FoodEstablishmentReservation,
RentalCarReservation, EventReservation → typed preview items
- BookingImportService: auto-creates place rows; geocodes venues without
coordinates via Nominatim (name+address → address → name fallback);
resolves day IDs for accommodation linking
- BookingImportModal: drag-and-drop multi-file upload, preview cards
with type icons, per-item exclude toggle, confirm step
- Shared Zod contracts: BookingImportPreviewItem, PreviewResponse,
ConfirmRequest, ConfirmResponse — consumed by controller, service,
API client and modal
- Dockerfile: node:24-trixie-slim runtime; amd64 downloads KDE static
binary + locales; arm64 installs libkitinerary-bin + symlinks to
fixed path; ENV KITINERARY_EXTRACTOR_PATH set for both arches
- /api/health/features exposes { bookingImport: boolean } so the UI
hides the Import button when the binary is absent
- i18n keys (English), wiki docs, API.md, README one-liner
* i18n: add booking import translations for all 19 non-English locales
Adds 17 reservations.import.* keys and undo.importBooking to ar, br, cs,
de, es, fr, gr, hu, id, it, ja, ko, nl, pl, ru, tr, uk, zh, zh-TW.
* chore: enforce i18n parity
* docs(wiki): add KItinerary local setup instructions to dev environment guide
This commit is contained in:
@@ -84,7 +84,48 @@ npm i
|
||||
|
||||
---
|
||||
|
||||
## 6. Available Scripts
|
||||
## 6. Optional: KItinerary (Booking Import)
|
||||
|
||||
The booking-confirmation import feature uses [KDE KItinerary](https://apps.kde.org/itinerary/) to parse travel documents. The server works without it, but the import endpoint will be non-functional.
|
||||
|
||||
### Linux — amd64
|
||||
|
||||
Download the static binary from the KDE CDN and verify the checksum:
|
||||
|
||||
```bash
|
||||
wget -qO /tmp/ki.tgz https://cdn.kde.org/ci-builds/pim/kitinerary/release-26.04/linux/kitinerary-extractor-x86_64-26.04.0.tgz
|
||||
echo "b7058d98990053c7b61847fef0c21e02d59b60e323e2b171ca210b682334e801 /tmp/ki.tgz" | sha256sum -c
|
||||
sudo tar -xz -C /usr/local -f /tmp/ki.tgz bin/kitinerary-extractor share/locale
|
||||
rm /tmp/ki.tgz
|
||||
```
|
||||
|
||||
### Linux — arm64
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y libkitinerary-bin
|
||||
sudo ln -sf "$(find /usr/lib -name kitinerary-extractor -type f | head -1)" /usr/local/bin/kitinerary-extractor
|
||||
```
|
||||
|
||||
### Environment variables
|
||||
|
||||
Add these to your local `.env` (or export them before starting the server):
|
||||
|
||||
```bash
|
||||
# Required: path to the extractor binary
|
||||
KITINERARY_EXTRACTOR_PATH=/usr/local/bin/kitinerary-extractor
|
||||
|
||||
# Prevent Qt from probing for a display in headless/server environments
|
||||
QT_QPA_PLATFORM=offscreen
|
||||
|
||||
# KDE cache directory (avoids writing to $HOME)
|
||||
XDG_CACHE_HOME=/tmp/kf6-cache
|
||||
```
|
||||
|
||||
You can override `KITINERARY_EXTRACTOR_PATH` if you installed the binary to a different location.
|
||||
|
||||
---
|
||||
|
||||
## 7. Available Scripts
|
||||
|
||||
### Server (`/server`)
|
||||
|
||||
@@ -114,7 +155,7 @@ npm i
|
||||
|
||||
---
|
||||
|
||||
## 7. Commit & Push Your Changes
|
||||
## 8. Commit & Push Your Changes
|
||||
|
||||
```bash
|
||||
git add .
|
||||
|
||||
Reference in New Issue
Block a user