feat: 初始化DevOps平台后端
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { Body, Controller, Get, Post } from '@nestjs/common';
|
||||
import {
|
||||
ApiBody,
|
||||
ApiCreatedResponse,
|
||||
ApiOkResponse,
|
||||
ApiTags,
|
||||
} from '@nestjs/swagger';
|
||||
import { ZodValidationPipe } from '../common/pipes/zod-validation.pipe';
|
||||
import { AgentInvocation } from './agent.types';
|
||||
import { AgentService } from './agent.service';
|
||||
import {
|
||||
CreateAgentInvocationDto,
|
||||
CreateAgentInvocationInput,
|
||||
createAgentInvocationSchema,
|
||||
} from './create-agent-invocation.dto';
|
||||
|
||||
@ApiTags('agent')
|
||||
@Controller('agent/invocations')
|
||||
export class AgentController {
|
||||
constructor(private readonly agentService: AgentService) {}
|
||||
|
||||
@Get()
|
||||
@ApiOkResponse({ description: 'Agent invocation audit list.' })
|
||||
listInvocations(): AgentInvocation[] {
|
||||
return this.agentService.listInvocations();
|
||||
}
|
||||
|
||||
@Post()
|
||||
@ApiBody({ type: CreateAgentInvocationDto })
|
||||
@ApiCreatedResponse({ description: 'Create a DevOps-scoped agent invocation.' })
|
||||
async createInvocation(
|
||||
@Body(new ZodValidationPipe(createAgentInvocationSchema))
|
||||
body: CreateAgentInvocationInput,
|
||||
): Promise<AgentInvocation> {
|
||||
return this.agentService.createInvocation(body);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user