feat(scenarios): add step title, scenario credentials, and environment context in executor
- add nullable title column to scenario steps; exposed in create/edit forms and step table - add scenario-credential join (many-to-many with CredentialEntity) with CRUD endpoints - expose environment URLs in code executor helpers via helpers.env and helpers.getEnvUrl() - resolve and cache environment per run from the login step's environmentName in scheduler - add section spacing and step table title column to ScenarioDetailPage
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
HttpCode,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Patch,
|
||||
Post,
|
||||
Query,
|
||||
} from "@nestjs/common";
|
||||
import { ApiOperation, ApiResponse, ApiTags } from "@nestjs/swagger";
|
||||
import { CredentialService } from "./credential.service";
|
||||
import { CreateCredentialDto } from "./dto/create-credential.dto";
|
||||
import { UpdateCredentialDto } from "./dto/update-credential.dto";
|
||||
import { PaginationQueryDto } from "../common/dto/pagination.dto";
|
||||
import { CredentialOrderBy } from "./credential.service";
|
||||
|
||||
@ApiTags("credentials")
|
||||
@Controller("credentials")
|
||||
export class CredentialController {
|
||||
constructor(private readonly credentialService: CredentialService) {}
|
||||
|
||||
@Post()
|
||||
@ApiOperation({ summary: "Create a new credential" })
|
||||
@ApiResponse({ status: 201, description: "Credential created" })
|
||||
create(@Body() dto: CreateCredentialDto) {
|
||||
return this.credentialService.create(dto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: "List all credentials (paginated)" })
|
||||
@ApiResponse({ status: 200, description: "Paginated credentials" })
|
||||
findAll(@Query() query: PaginationQueryDto<CredentialOrderBy>) {
|
||||
return this.credentialService.findAll(query);
|
||||
}
|
||||
|
||||
@Get(":id")
|
||||
@ApiOperation({ summary: "Get credential by ID" })
|
||||
@ApiResponse({ status: 200, description: "Credential record" })
|
||||
@ApiResponse({ status: 404, description: "Credential not found" })
|
||||
findOne(@Param("id", ParseIntPipe) id: number) {
|
||||
return this.credentialService.findOne(id);
|
||||
}
|
||||
|
||||
@Patch(":id")
|
||||
@ApiOperation({ summary: "Update a credential" })
|
||||
@ApiResponse({ status: 200, description: "Credential updated" })
|
||||
@ApiResponse({ status: 404, description: "Credential not found" })
|
||||
update(
|
||||
@Param("id", ParseIntPipe) id: number,
|
||||
@Body() dto: UpdateCredentialDto,
|
||||
) {
|
||||
return this.credentialService.update(id, dto);
|
||||
}
|
||||
|
||||
@Delete(":id")
|
||||
@HttpCode(204)
|
||||
@ApiOperation({ summary: "Delete a credential" })
|
||||
@ApiResponse({ status: 204, description: "Credential deleted" })
|
||||
@ApiResponse({ status: 404, description: "Credential not found" })
|
||||
remove(@Param("id", ParseIntPipe) id: number) {
|
||||
return this.credentialService.remove(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user