feat(scenario): add scenario and scenario step CRUD module

- add ScenarioEntity and ScenarioStepEntity with cascade delete
- step fields: type (login|exec), sessionName (required), execCode, validateCode
- login steps create a named session; exec steps consume it by sessionName
- full CRUD controller under /scenarios and /scenarios/:id/steps
- paginated GET /scenarios with page/limit query params returning { data, total, page, limit }
- register ScenarioModule and entities in AppModule
This commit is contained in:
2026-04-07 14:13:06 +03:00
parent 5ac26ecb3a
commit d669bf1c59
11 changed files with 396 additions and 1 deletions
+45
View File
@@ -0,0 +1,45 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
} from 'typeorm';
import { ScenarioEntity } from './scenario.entity';
export type StepType = 'login' | 'exec';
@Entity('scenario_steps')
export class ScenarioStepEntity {
@PrimaryGeneratedColumn()
id: number;
@Column()
scenarioId: number;
@ManyToOne(() => ScenarioEntity, (scenario) => scenario.steps, {
onDelete: 'CASCADE',
})
@JoinColumn({ name: 'scenarioId' })
scenario: ScenarioEntity;
@Column({ type: 'text' })
type: StepType;
@Column({ type: 'text' })
sessionName: string;
@Column({ type: 'text', nullable: true })
execCode: string | null;
@Column({ type: 'text', nullable: true })
validateCode: string | null;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}