Files
liqa/server/src/scenario/scenario-run-step.entity.ts
T
ars9 ff83b6c7da feat(versioning): version scenarios and snippets, bump to 1.16.0
- snapshot scenario and snippet content into version tables on every
  content change; live tables keep holding the latest version
- record the scenario version on each run and copy its steps into the
  run steps, so runs execute and show the version they were created with
- keep run step history when a step is deleted (FK set null)
- pin a snippet version with runSnippet('alias@N')
- add version picker to the run modal and version info across the UI
- add version list/get endpoints and MCP tools
- include version in exports and require it on import, restoring the
  exact version by id + version
2026-09-30 15:24:44 +03:00

72 lines
1.7 KiB
TypeScript

import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from "typeorm";
import { ScenarioRunEntity } from "./scenario-run.entity";
import { ScenarioStepEntity } from "./scenario-step.entity";
export type RunStepStatus =
| "waiting"
| "pending"
| "in_progress"
| "pass"
| "fail"
| "cancelled";
@Entity("scenario_run_steps")
export class ScenarioRunStepEntity {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column("text")
runId: string;
@ManyToOne(() => ScenarioRunEntity, (run) => run.stepRuns, {
onDelete: "CASCADE",
})
@JoinColumn({ name: "runId" })
run: ScenarioRunEntity;
/** Live step this run step was created from; null once that step is deleted. */
@Column("text", { nullable: true })
scenarioStepId: string | null;
@ManyToOne(() => ScenarioStepEntity, { onDelete: "SET NULL", nullable: true })
@JoinColumn({ name: "scenarioStepId" })
scenarioStep: ScenarioStepEntity | null;
// Step content copied from the run's scenario version, so the run executes
// (and keeps showing) exactly what it was created with.
@Column({ type: "text", nullable: true })
title: string | null;
@Column({ type: "text", nullable: true })
execCode: string | null;
@Column({ type: "int", nullable: true })
timeoutSeconds: number | null;
@Column({ type: "text", default: "waiting" })
status: RunStepStatus;
@Column({ default: 0 })
order: number;
@Column({ type: "text", nullable: true })
description: string | null;
@Column({ type: "text", nullable: true })
output: string | null;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}