/* eslint-disable @typescript-eslint/no-explicit-any */ import type { BunSQLiteDatabase } from "drizzle-orm/bun-sqlite"; import type { z } from "zod"; interface RequestContext { user?: string; db: BunSQLiteDatabase; } export type Endpoint = { validate: z.ZodType; handler: (input: TInput, context: RequestContext) => Promise; }; export const createEndpoint = ( validate: z.ZodType, handler: (input: TInput, context: RequestContext) => Promise, ): Endpoint => { return { validate, handler }; }; export type Controller>> = TEndpoints; export const createController = < TEndpoints extends Record>, >( endpoints: TEndpoints, ): Controller => { return endpoints; };