feat(digital): 接入角色世界书与账号实验服务
- digital: 新增私有会话、DeepSeek流式生成、停止与分支、世界书和预设编排 - experiments: 新增账号稳定分组、人工指定、生命周期、预设快照及实验漏斗审计 - migrations/data: 初始化20位成年角色、4本世界书与3种叙事预设 - tests/docs: 补充11项核心回归、市场参考和部署说明
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
/** 现有账号登录与密码接口,数字人入口同时接受管理员与员工。 */
|
||||
import { authRepository } from "./auth.repository";
|
||||
import type { FastifyInstance } from "fastify";
|
||||
import { env } from "../../config/env";
|
||||
import { ok } from "../../shared/response";
|
||||
@@ -5,7 +7,22 @@ import { authGuard } from "./auth.guard";
|
||||
import { loginBodySchema, updateOwnPasswordBodySchema } from "./auth.schema";
|
||||
import { authService } from "./auth.service";
|
||||
|
||||
/** 账号登录、当前用户与本人改密接口。 */
|
||||
export async function authRoutes(app: FastifyInstance): Promise<void> {
|
||||
app.post("/auth/digital/login", async (request) => {
|
||||
const body = loginBodySchema.parse(request.body);
|
||||
const admin = await authRepository.findByUsername(body.username);
|
||||
const { user, payload } = admin
|
||||
? await authService.loginManagement(body)
|
||||
: await authService.loginEmployee(body);
|
||||
return ok({
|
||||
token: app.jwt.sign(payload),
|
||||
tokenType: "Bearer",
|
||||
expiresIn: env.JWT_EXPIRES_IN,
|
||||
user,
|
||||
});
|
||||
});
|
||||
|
||||
app.post("/auth/login", async (request) => {
|
||||
const body = loginBodySchema.parse(request.body);
|
||||
const { user, payload } = await authService.loginManagement(body);
|
||||
|
||||
Reference in New Issue
Block a user