All checks were successful
Deploy / deploy (push) Successful in 3m58s
- Extract world-parse + packet capture into @albion/shared (reused by server and a new standalone agent workspace). - Migrate the data layer from SQLite/better-sqlite3 to shared Postgres (async pg with a ?->$n helper; economy engine preloads the item/recipe graph so its sync recursion still works). - API-key auth (ALBION_API_KEY) on all /api routes except health; web UI sends it via a fetch wrapper + key-entry gate; server serves the built UI with a path-traversal-safe static handler (drops @fastify/static). - Windows companion agent: pushes world map + captured market orders to /api/ingest/*; runs on the gaming PC where the game traffic lives. - Docker + docker-compose (external proxy + backend networks for Nginx Proxy Manager and shared Postgres) and a Forgejo deploy workflow. - Validated end-to-end against Postgres 16 and a full compose run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
20 lines
892 B
TypeScript
20 lines
892 B
TypeScript
import type { FastifyInstance } from 'fastify';
|
|
import { getEconomyConfig, setEconomyConfig, type EconomyConfig } from '../economy/config.js';
|
|
import { rankOpportunities, type RankRequest } from '../economy/service.js';
|
|
|
|
export async function economyRoutes(app: FastifyInstance): Promise<void> {
|
|
app.get('/api/economy/config', async () => getEconomyConfig());
|
|
|
|
app.put('/api/economy/config', async (req) => {
|
|
await setEconomyConfig((req.body ?? {}) as Partial<EconomyConfig>);
|
|
return { ok: true, config: await getEconomyConfig() };
|
|
});
|
|
|
|
app.post('/api/economy/opportunities', async (req, reply) => {
|
|
const body = (req.body ?? {}) as RankRequest;
|
|
if (!body.city) return reply.code(400).send({ error: 'city is required' });
|
|
const started = Date.now();
|
|
const result = await rankOpportunities(body);
|
|
return { ...result, tookMs: Date.now() - started };
|
|
});
|
|
}
|