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.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
import { AdminGuard } from '../auth-core/admin.guard';
import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { PlaceShadowPickDto } from './place-shadow.dto';
import { PlaceShadowService } from './place-shadow.service';
import { Body, Controller, Delete, Get, HttpCode, Post, Query, UseGuards } from '@nestjs/common';
import type { PlaceShadowExportResult, PlaceShadowPickResult, PlaceShadowSummaryResult } from '@trek/shared';
/**
* /api/place-shadow — the local corpus of "what was searched, what was picked".
*
* Writing is open to any signed-in user because any signed-in user is the one
* doing the picking; reading is admin only, because the corpus is everybody's
* searches and the person entitled to see that is the person running the
* instance. Nothing here leaves the instance on its own.
*/
@Controller('api/place-shadow')
@UseGuards(JwtAuthGuard)
export class PlaceShadowController {
constructor(private readonly shadow: PlaceShadowService) {}
/**
* 200 with `{ recorded: false }` when the log is off, rather than a 403.
* The client posts this and moves on; a rejection would be a permanent error
* in the console of every install that never switched the log on.
*/
@Post('pick')
@HttpCode(200)
async pick(@Body() body: PlaceShadowPickDto): Promise<PlaceShadowPickResult> {
return { recorded: await this.shadow.record(body) };
}
@Get('summary')
@UseGuards(JwtAuthGuard, AdminGuard)
async summary(): Promise<PlaceShadowSummaryResult> {
return await this.shadow.summary();
}
@Get('export')
@UseGuards(JwtAuthGuard, AdminGuard)
async export(@Query('after') after?: string): Promise<PlaceShadowExportResult> {
const parsed = Number(after);
return await this.shadow.export(Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined);
}
@Delete()
@UseGuards(JwtAuthGuard, AdminGuard)
async clear(): Promise<{ removed: number }> {
return { removed: await this.shadow.clear() };
}
}