From 3d376c8d143a5d3b3b67b6a56c98fd33efffa73c Mon Sep 17 00:00:00 2001 From: Fred KISSIE Date: Thu, 30 Oct 2025 00:55:12 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20change=20default=20bluepri?= =?UTF-8?q?nt=20table=20ordering=20to=20`createdAt:=20desc`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/routers/blueprints/listBlueprints.ts | 4 ++-- src/components/BlueprintsTable.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/routers/blueprints/listBlueprints.ts b/server/routers/blueprints/listBlueprints.ts index 1b621e2b..5ae8b211 100644 --- a/server/routers/blueprints/listBlueprints.ts +++ b/server/routers/blueprints/listBlueprints.ts @@ -4,11 +4,10 @@ import { db, blueprints, orgs } from "@server/db"; import response from "@server/lib/response"; import HttpCode from "@server/types/HttpCode"; import createHttpError from "http-errors"; -import { sql, eq, or, inArray, and, count } from "drizzle-orm"; +import { sql, eq, desc } from "drizzle-orm"; import logger from "@server/logger"; import { fromZodError } from "zod-validation-error"; import { OpenAPITags, registry } from "@server/openApi"; -import { warn } from "console"; import { BlueprintData } from "./types"; const listBluePrintsParamsSchema = z @@ -47,6 +46,7 @@ async function queryBlueprints(orgId: string, limit: number, offset: number) { .from(blueprints) .leftJoin(orgs, eq(blueprints.orgId, orgs.orgId)) .where(eq(blueprints.orgId, orgId)) + .orderBy(desc(blueprints.createdAt)) .limit(limit) .offset(offset); return res; diff --git a/src/components/BlueprintsTable.tsx b/src/components/BlueprintsTable.tsx index 3400f88d..ee1dd095 100644 --- a/src/components/BlueprintsTable.tsx +++ b/src/components/BlueprintsTable.tsx @@ -198,8 +198,8 @@ export default function BlueprintsTable({ blueprints, orgId }: Props) { }} isRefreshing={isRefreshing} defaultSort={{ - id: "name", - desc: false + id: "createdAt", + desc: true }} /> );