feat: migrate backend foundation to NestJS

This commit is contained in:
2026-07-17 17:41:41 +08:00
parent 39f7332f33
commit f219eb0bf8
37 changed files with 2691 additions and 402 deletions

View File

@@ -0,0 +1,16 @@
import type { FastifyReply, FastifyRequest } from 'fastify';
import type { Handler } from '../core/http.js';
import { RequestContextFactory } from './request-context.factory.js';
export abstract class DomainRouteService {
protected constructor(
protected readonly contextFactory: RequestContextFactory,
private readonly handlers: Record<string, Handler>,
) {}
execute(name: string, request: FastifyRequest, reply: FastifyReply) {
const handler = this.handlers[name];
if (!handler) throw new Error(`Missing domain route handler: ${name}`);
return handler(this.contextFactory.create(request, reply));
}
}