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.4 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 { TourTrailGradeDto } from './dto/tour-trail-grade.dto';
import { TourTrailGradeService } from './tour-trail-grade.service';
import { Body, Controller, HttpCode, Post, UseGuards } from '@nestjs/common';
import { tourTrailGradeResponseSchema } from '@trek/shared';

/**
 * BIK-05, MAP-03 and MAP-04 POST /api/trips/:tripId/tours/trail-grades: what
 * OpenStreetMap records for the ways a tour runs on, the mountain bike and SAC
 * grades, the surface and the kind of way alike. A read, so anyone who sees
 * the trip may ask; the ways come 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 TourTrailGradeController {
  constructor(private readonly trailGrades: TourTrailGradeService) {}

  @Post('trail-grades')
  @HttpCode(200)
  @ResponseContract(tourTrailGradeResponseSchema)
  async grades(@Body() body: TourTrailGradeDto) {
    return await this.trailGrades.grades(body);
  }
}