mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
56655d53b4
* feat(admin): register AirTrail as an integration addon
Off by default; toggle lives in Admin -> Addons with a Plane icon. The
per-user connection (URL + API key) follows in integration settings.
* feat(integrations): add per-user AirTrail connection
Settings -> Integrations gains an AirTrail section: instance URL + Bearer
API key (encrypted at rest via apiKeyCrypto), a self-signed-TLS opt-in and
a test-connection check. Served by a small Nest controller under
/api/integrations/airtrail, gated on the airtrail addon and SSRF-guarded.
The key is per-user, so it only ever returns that user's own flights.
* feat(transport): import flights from AirTrail
Adds an AirTrail Import button next to Manual Transport that lists the
user's AirTrail flights and highlights the ones inside the trip dates.
Selected flights become reservations linked to their AirTrail origin
(external_* columns), deduped against flights already in the trip, then
broadcast to every member. The mapping resolves airports, airport-local
times and flight metadata; the linkage is what the two-way sync rides on.
* feat(transport): badge AirTrail-linked flights as synced
Linked reservations show an 'AirTrail synced' badge, or 'no longer
synced' once the flight is gone from AirTrail.
* feat(transport): keep TREK and AirTrail flights in sync both ways
A scheduled poll reconciles each connected owner's flights: field edits
(detected by snapshot hash, since AirTrail has no updated_at) flow into
the linked reservation and broadcast live; a flight deleted in AirTrail
keeps the TREK row but stops syncing. Editing a linked flight in TREK
pushes back to AirTrail under the importer's credentials, preserving the
existing seat manifest; if the owner disconnected the link detaches so the
poll can't revert the local edit. Deleting in TREK never touches AirTrail.
* i18n(airtrail): add AirTrail strings across all locales
* test(airtrail): cover flight mapping, timezones and snapshot hashing
* fix(airtrail): reduce airline/aircraft objects to codes
The flight list/get response returns airline and aircraft as joined
objects ({icao, iata, name, ...}), not bare codes. Mapping them straight
through produced '[object Object]' titles and stored objects in metadata,
which crashed reservation rendering. Extract the ICAO/IATA code instead,
and title flights by their flight number.
* fix(airtrail): clear error on non-JSON responses, tolerate /api in URL
A misconfigured instance URL made AirTrail serve its SPA/login HTML, and
the raw JSON.parse failure surfaced as 'Unexpected token <'. Surface an
actionable message instead, and strip a pasted trailing /api so the base
URL still resolves.
* feat(transport): sync AirTrail edits on trip open, not just on the poll
Add a per-user on-demand sync (POST /integrations/airtrail/sync) triggered
when a connected user opens a trip, so AirTrail-side edits appear right away
instead of waiting up to a full poll cycle. Lower the background poll from 15
to 5 minutes as a safety net.
* fix(transport): refresh imported AirTrail flights without a reload
loadTrip doesn't fetch reservations, so a freshly imported flight only
appeared after a full page reload — use loadReservations instead. Also show
flight dates in the user's locale format (e.g. 13.06.2026) rather than the
raw ISO string.
* style(settings): align AirTrail connection with the photo-provider layout
Match the Immich section: stacked URL/key fields, a ToggleSwitch for
self-signed TLS, and a Save / Test-connection row with a status badge.
* feat(transport): add a seat field when editing flights
The transport editor only offered a seat field for trains; flights had
none even though imports store metadata.seat. Show and persist a seat for
flights too.
* style(transport): match the AirTrail button height to Manual Transport
* feat(transport): put the flight seat next to flight number and sync it to AirTrail
Move the seat from a standalone row to the per-leg flight details (beside
the flight number), stored per leg in metadata.legs[].seat with the first
leg mirrored to metadata.seat. On push, set the seat number on the user's
own AirTrail seat (the one with a userId), leaving co-passengers untouched;
import/poll read that same seat back.
* refactor(planner): move the AirTrail trip-open sync into useTripPlanner
Page containers must not own state/effects (lint:pages). Same logic,
relocated from the page into its data hook.
* test(db): pin the region-reconciliation test to its schema version
The test re-ran 'the last migration' assuming the reconciliation is last;
it no longer is once later migrations are appended. Pin to version 135 and
re-run from there (the appended migrations are idempotent).
66 lines
3.8 KiB
TypeScript
66 lines
3.8 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { APP_FILTER, APP_INTERCEPTOR } from '@nestjs/core';
|
|
import { DatabaseModule } from './database/database.module';
|
|
import { HealthController } from './health/health.controller';
|
|
import { HealthService } from './health/health.service';
|
|
import { WeatherModule } from './weather/weather.module';
|
|
import { AirportsModule } from './airports/airports.module';
|
|
import { ConfigModule } from './config/config.module';
|
|
import { SystemNoticesModule } from './system-notices/system-notices.module';
|
|
import { MapsModule } from './maps/maps.module';
|
|
import { CategoriesModule } from './categories/categories.module';
|
|
import { TagsModule } from './tags/tags.module';
|
|
import { NotificationsModule } from './notifications/notifications.module';
|
|
import { AtlasModule } from './atlas/atlas.module';
|
|
import { VacayModule } from './vacay/vacay.module';
|
|
import { PackingModule } from './packing/packing.module';
|
|
import { BudgetModule } from './budget/budget.module';
|
|
import { ReservationsModule } from './reservations/reservations.module';
|
|
import { DaysModule } from './days/days.module';
|
|
import { AssignmentsModule } from './assignments/assignments.module';
|
|
import { PlacesModule } from './places/places.module';
|
|
import { TripsModule } from './trips/trips.module';
|
|
import { TodoModule } from './todo/todo.module';
|
|
import { CollabModule } from './collab/collab.module';
|
|
import { FilesModule } from './files/files.module';
|
|
import { PhotosModule } from './photos/photos.module';
|
|
import { MemoriesModule } from './memories/memories.module';
|
|
import { AirtrailModule } from './integrations/airtrail.module';
|
|
import { JourneyModule } from './journey/journey.module';
|
|
import { ShareModule } from './share/share.module';
|
|
import { SettingsModule } from './settings/settings.module';
|
|
import { BackupModule } from './backup/backup.module';
|
|
import { BookingImportModule } from './booking-import/booking-import.module';
|
|
import { AuthModule } from './auth/auth.module';
|
|
import { OidcModule } from './oidc/oidc.module';
|
|
import { OauthModule } from './oauth/oauth.module';
|
|
import { AdminModule } from './admin/admin.module';
|
|
import { AddonsModule } from './addons/addons.module';
|
|
import { TrekExceptionFilter } from './common/trek-exception.filter';
|
|
import { SpaFallbackFilter } from './platform/spa-fallback.filter';
|
|
import { IdempotencyInterceptor } from './common/idempotency.interceptor';
|
|
|
|
/**
|
|
* Root NestJS module for the incremental migration. Domain modules
|
|
* (weather, notifications, integrations, ...) get registered here as they are
|
|
* migrated.
|
|
*/
|
|
@Module({
|
|
imports: [DatabaseModule, WeatherModule, AirportsModule, ConfigModule, SystemNoticesModule, MapsModule, CategoriesModule, TagsModule, NotificationsModule, AtlasModule, VacayModule, PackingModule, TodoModule, BudgetModule, ReservationsModule, DaysModule, AssignmentsModule, PlacesModule, TripsModule, CollabModule, FilesModule, PhotosModule, MemoriesModule, AirtrailModule, JourneyModule, ShareModule, SettingsModule, BackupModule, AuthModule, OidcModule, OauthModule, AdminModule, AddonsModule, BookingImportModule],
|
|
controllers: [HealthController],
|
|
providers: [
|
|
HealthService,
|
|
// Global error-envelope normaliser (DI-registered so it also catches
|
|
// framework-level exceptions like the not-found handler).
|
|
{ provide: APP_FILTER, useClass: TrekExceptionFilter },
|
|
// SPA fallback: serves index.html for unmatched GETs in production (the Nest
|
|
// equivalent of the legacy Express app.get('*') catch-all). @Catch(NotFoundException)
|
|
// is more specific than TrekExceptionFilter, so Nest routes 404s here.
|
|
{ provide: APP_FILTER, useClass: SpaFallbackFilter },
|
|
// Replays the X-Idempotency-Key the client sends on every write, matching
|
|
// the legacy applyIdempotency middleware so retried mutations don't double-apply.
|
|
{ provide: APP_INTERCEPTOR, useClass: IdempotencyInterceptor },
|
|
],
|
|
})
|
|
export class AppModule {}
|