mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
e40bc71e9f
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.
22 lines
831 B
TypeScript
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'));
|
|
}
|
|
}
|