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.

1.3 KB
Raw Blame
import { ADDON_IDS } from '../../addons';
import { RequireAddon } from '../addons/require-addon.decorator';
import { TripAddonGuard } from '../addons/trip-addon.guard';
import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { ResponseContract } from '../common/response-contract';
import { TripAccessGuard } from '../permissions/trip-access.guard';
import { TourPoiSearchDto } from './dto/tour-poi-search.dto';
import { TourPoiSearchService } from './tour-poi-search.service';
import { Body, Controller, HttpCode, Post, UseGuards } from '@nestjs/common';
import { tourPoiSearchResponseSchema } from '@trek/shared';

/**
 * PLN-02 POST /api/trips/:tripId/tours/poi-search: places along the line of
 * the tour being planned. A read, so anyone who sees the trip may ask; the
 * line comes in the body because the draft may not be saved yet.
 */
@Controller('api/trips/:tripId/tours')
@UseGuards(JwtAuthGuard, TripAccessGuard, TripAddonGuard)
@RequireAddon(ADDON_IDS.TOURS, 'Tours')
export class TourPoiSearchController {
  constructor(private readonly search: TourPoiSearchService) {}

  @Post('poi-search')
  @HttpCode(200)
  @ResponseContract(tourPoiSearchResponseSchema)
  async searchAlong(@Body() body: TourPoiSearchDto) {
    return await this.search.search(body);
  }
}