feat: Introduce DTOs for API validation and new deployment features, including a Git controller and UI components.

This commit is contained in:
2025-11-23 12:03:11 +08:00
parent 02b7c3edb2
commit 378070179f
24 changed files with 809 additions and 302 deletions

View File

@@ -3,6 +3,7 @@ import { Controller, Get, Post } from '../../decorators/route.ts';
import { prisma } from '../../libs/prisma.ts';
import { log } from '../../libs/logger.ts';
import { gitea } from '../../libs/gitea.ts';
import { loginSchema } from './dto.ts';
@Controller('/auth')
export class AuthController {
@@ -20,7 +21,7 @@ export class AuthController {
if (ctx.session.user) {
return ctx.session.user;
}
const { code } = ctx.request.body as LoginRequestBody;
const { code } = loginSchema.parse(ctx.request.body);
const { access_token, refresh_token, expires_in } =
await gitea.getToken(code);
const giteaAuth = {
@@ -81,7 +82,3 @@ export class AuthController {
return ctx.session?.user;
}
}
interface LoginRequestBody {
code: string;
}