From 2e629f8423a815632d57551a72a445ef1b652ec9 Mon Sep 17 00:00:00 2001 From: charles-gauthereau Date: Sun, 7 Jun 2026 17:33:47 +0200 Subject: [PATCH] fix: refactoring and ordering data on agent and project page --- .../dashboard/(organization)/projects/[projectId]/page.tsx | 4 +++- src/features/agents/agent-content.tsx | 4 +++- src/features/agents/agents.action.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx b/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx index da10f070..8f3b6c2c 100644 --- a/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx +++ b/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx @@ -85,7 +85,9 @@ export default async function RoutePage(props: PageParams<{ {proj.databases.length > 0 ? ( + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + )} organizationSlug={organization.slug} // @ts-ignore cardItem={ProjectDatabaseCard} diff --git a/src/features/agents/agent-content.tsx b/src/features/agents/agent-content.tsx index 5d9d0c7d..6e6fe392 100644 --- a/src/features/agents/agent-content.tsx +++ b/src/features/agents/agent-content.tsx @@ -117,7 +117,9 @@ export const AgentContentPage = ({edgeKey, agent: initialAgent}: AgentContentPag + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + )} cardItem={AgentDatabaseCard} /> diff --git a/src/features/agents/agents.action.ts b/src/features/agents/agents.action.ts index 4af5d5cc..e22dbce4 100644 --- a/src/features/agents/agents.action.ts +++ b/src/features/agents/agents.action.ts @@ -2,7 +2,7 @@ import {action, ActionError, userAction} from "@/lib/safe-actions/actions"; import {AgentSchema} from "@/features/agents/agents.schema"; import {z} from "zod"; -import {eq, and, ne, count} from "drizzle-orm"; +import {eq, and, ne, count, desc} from "drizzle-orm"; import {db} from "@/db"; import * as drizzleDb from "@/db"; import {slugify} from "@/utils/slugify";