Files
TREK/server/src/nest/budget/exchange-rates.rpc.ts
T
Maurice e40bc71e9f refactor(plugins): the plugin RPC kit moves out of the plugins domain into src/nest-rpc
Every domain's *.rpc.ts was written against rpc-kit, rpc-params, rpc-errors
and PluginGuards, and every domain module imported PluginGuardsModule, all
of it inside src/nest/plugins, while PluginsRuntimeModule imports those same
domains so their handlers exist at boot. That made the plugins domain part
of every cycle. The kit imports no domain but the protocol tables and
permissions/addons for the guards, so it moves to src/nest-rpc beside
src/nest-mcp, with its tests, its README and its extraction rule; the
runtime module keeps its domain imports, which the boot-time coverage check
of the wire surface needs in any subset app.
2026-10-10 20:15:58 +02:00

22 lines
831 B
TypeScript

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'));
}
}