feat: 接入真实登录与成员权限
- auth/members/messages: 新增超级管理员登录、成员权限和密码消息流程 - agent-config/agent: 支持服务端保存 Agent 配置并取消未配置 mock 成功结果 - projects/deploy-runs/settings: 按当前用户权限保护真实接口 - prisma: 新增用户、项目权限和平台消息表结构
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user