Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

978 B
Raw Blame
import type { User } from '../../types';
import { CurrentUser } from '../auth-core/current-user.decorator';
import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { ReservationsService } from './reservations.service';
import { Controller, Get, UseGuards } from '@nestjs/common';

/**
 * GET /api/reservations/upcoming — the cross-trip "upcoming reservations" feed
 * (dashboard widget). Byte-identical to the legacy inline handler in
 * server/src/app.ts (authenticate, returns { reservations: [...] }, limit 6).
 *
 * Separate from the trip-scoped ReservationsController
 * (/api/trips/:tripId/reservations) because the base path differs.
 */
@Controller('api/reservations')
@UseGuards(JwtAuthGuard)
export class UpcomingReservationsController {
  constructor(private readonly reservations: ReservationsService) {}

  @Get('upcoming')
  async upcoming(@CurrentUser() user: User) {
    return { reservations: await this.reservations.listUpcoming(user.id) };
  }
}