feat(scenarios): link scenarios to a default environment

- add optional ManyToOne relation from scenario to environment entity
- expose environmentId in create/update DTOs, service, and MCP tools
- pre-select linked environment in run modals on detail and list pages
- add environment selector to create/edit scenario forms
- show linked environment as a navigable link on scenario detail page
This commit is contained in:
ars9 committed 2026-04-15 00:05:55 +03:00
1 parent e6aacc899d
commit a779ab4667
12 files changed
+109 -19

No files matched your search

+10
View File
@@ -2,10 +2,13 @@ import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from "typeorm";
import { EnvironmentEntity } from "../environment/environment.entity";
import { ScenarioCredentialEntity } from "./scenario-credential.entity";
import { ScenarioStepEntity } from "./scenario-step.entity";
@@ -20,6 +23,13 @@ export class ScenarioEntity {
@Column("text", { nullable: true })
description: string | null;
@Column({ nullable: true, type: "text" })
environmentId: string | null;
@ManyToOne(() => EnvironmentEntity, { nullable: true, onDelete: "SET NULL", eager: false })
@JoinColumn({ name: "environmentId" })
environment: EnvironmentEntity | null;
@OneToMany(() => ScenarioStepEntity, (step) => step.scenario, {
cascade: true,
eager: false,