feat: auth middleware, brain data layer, Valkey queue (P1-002/003/004) (#71)

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #71.
This commit is contained in:
2026-03-13 02:37:56 +00:00
committed by jason.woltje
parent cbac5902db
commit 38897fe423
20 changed files with 2043 additions and 4290 deletions

View File

@@ -0,0 +1,20 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import { All, Controller, Inject, Req, Res } from '@nestjs/common';
import type { FastifyReply, FastifyRequest } from 'fastify';
import { toNodeHandler } from 'better-auth/node';
import type { Auth } from '@mosaic/auth';
import { AUTH } from './auth.module.js';
@Controller('api/auth')
export class AuthController {
private readonly handler: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
constructor(@Inject(AUTH) auth: Auth) {
this.handler = toNodeHandler(auth);
}
@All('*path')
async handleAuth(@Req() req: FastifyRequest, @Res() res: FastifyReply): Promise<void> {
await this.handler(req.raw, res.raw);
}
}