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.

831 B
Raw Blame
import { PluginController, PluginMethod } from '../../nest-rpc/rpc-kit/decorators';
import { str } from '../../nest-rpc/rpc-params';
import { ExchangeRatesService } from './exchange-rates.service';

/**
 * The exchange-rate surface a plugin may reach (#plugins). Tenant-free like
 * weather: a cached upstream feed with no user and no trip behind it, useful to any
 * plugin that shows or converts money.
 *
 * Note this is NOT gated on the Costs addon. It carries no budget data, and the
 * router never gated it either.
 */
@PluginController()
export class ExchangeRatesRpc {
  constructor(private readonly exchangeRates: ExchangeRatesService) {}

  @PluginMethod('rates.get', { permission: 'rates:read' })
  get(params: Record<string, unknown>): unknown {
    return this.exchangeRates.getRates(str(params.base, 'base'));
  }
}