- add sortable column support to Table with asc/desc/unsorted icons - active sort icon uses --color-primary; no header background change - Table supports server-side mode via total/page/onPageChange props - wire server-side sort+pagination in ScenariosPage, AllRunsPage, RunsPage, SessionsPage - remove steps count column from run tables - fix server: RunsQueryDto now extends PaginationQueryDto with orderBy/orderDir - fix findAllRuns to use QueryBuilder; sort by scenario.name via JOIN - add per-resource typed query DTOs with @IsIn allowlist on orderBy - prevents SQL injection and returns 400 for unknown orderBy values
16 lines
602 B
TypeScript
16 lines
602 B
TypeScript
import { ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { IsIn, IsOptional } from "class-validator";
|
|
import { PaginationQueryDto } from "../../common/dto/pagination.dto";
|
|
import { ScenarioOrderBy } from "../scenario.service";
|
|
|
|
export { PaginationQueryDto } from "../../common/dto/pagination.dto";
|
|
|
|
const SCENARIO_ORDER_BY: ScenarioOrderBy[] = ["id", "name", "createdAt", "updatedAt"];
|
|
|
|
export class ScenarioQueryDto extends PaginationQueryDto<ScenarioOrderBy> {
|
|
@ApiPropertyOptional({ enum: SCENARIO_ORDER_BY })
|
|
@IsOptional()
|
|
@IsIn(SCENARIO_ORDER_BY)
|
|
declare orderBy?: ScenarioOrderBy;
|
|
}
|