diff --git a/client/src/api/client.ts b/client/src/api/client.ts index 762a293..2508a47 100644 --- a/client/src/api/client.ts +++ b/client/src/api/client.ts @@ -155,7 +155,7 @@ export const sessions = { export const scenarios = { list(page = 1, limit = 50): Promise> { - return request(`/scenarios?page=${page}&limit=${limit}`); + return request(`/scenarios?page=${page}&limit=${limit}&orderBy=updatedAt&orderDir=DESC`); }, get(id: string): Promise { return request(`/scenarios/${id}`); diff --git a/server/src/scenario/scenario.service.ts b/server/src/scenario/scenario.service.ts index 4c7acf3..b8eb9c5 100644 --- a/server/src/scenario/scenario.service.ts +++ b/server/src/scenario/scenario.service.ts @@ -218,7 +218,7 @@ export class ScenarioService { const [data, total] = await this.runRepo.findAndCount({ where, relations: ["stepRuns"], - order: { id: "DESC", stepRuns: { order: "ASC" } }, + order: { createdAt: "DESC" }, skip: (page - 1) * limit, take: limit, }); @@ -235,7 +235,7 @@ export class ScenarioService { const [data, total] = await this.runRepo.findAndCount({ where, relations: ["stepRuns", "scenario"], - order: { id: "DESC", stepRuns: { order: "ASC" } }, + order: { createdAt: "DESC" }, skip: (page - 1) * limit, take: limit, });