feat: 接入真实登录与成员权限

- auth/members/messages: 新增超级管理员登录、成员权限和密码消息流程
- agent-config/agent: 支持服务端保存 Agent 配置并取消未配置 mock 成功结果
- projects/deploy-runs/settings: 按当前用户权限保护真实接口
- prisma: 新增用户、项目权限和平台消息表结构
This commit is contained in:
湛兮
2026-06-12 00:38:23 +08:00
parent cf1bebf625
commit bc3aa31289
83 changed files with 3844 additions and 378 deletions
+11 -5
View File
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Post } from '@nestjs/common';
import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common';
import {
ApiBody,
ApiCreatedResponse,
@@ -6,6 +6,10 @@ import {
ApiTags,
} from '@nestjs/swagger';
import { ZodValidationPipe } from '../common/pipes/zod-validation.pipe';
import { AuthGuard } from '../auth/auth.guard';
import { AuthenticatedUser } from '../auth/auth.types';
import { CurrentUser } from '../auth/current-user.decorator';
import { PasswordChangeGuard } from '../auth/password-change.guard';
import { AgentInvocation } from './agent.types';
import { AgentService } from './agent.service';
import {
@@ -14,24 +18,26 @@ import {
createAgentInvocationSchema,
} from './create-agent-invocation.dto';
@ApiTags('agent')
@ApiTags('Agent 调用')
@Controller('agent/invocations')
@UseGuards(AuthGuard, PasswordChangeGuard)
export class AgentController {
constructor(private readonly agentService: AgentService) {}
@Get()
@ApiOkResponse({ description: 'Agent invocation audit list.' })
@ApiOkResponse({ description: '查询 Agent 调用记录。' })
listInvocations(): AgentInvocation[] {
return this.agentService.listInvocations();
}
@Post()
@ApiBody({ type: CreateAgentInvocationDto })
@ApiCreatedResponse({ description: 'Create a DevOps-scoped agent invocation.' })
@ApiCreatedResponse({ description: '创建 DevOps 工作流范围内的 Agent 调用。' })
async createInvocation(
@CurrentUser() user: AuthenticatedUser,
@Body(new ZodValidationPipe(createAgentInvocationSchema))
body: CreateAgentInvocationInput,
): Promise<AgentInvocation> {
return this.agentService.createInvocation(body);
return this.agentService.createInvocation(body, user);
}
}