aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/routers/apiKeys.ts
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2026-01-17 23:33:52 +0000
committerMohamed Bassem <me@mbassem.com>2026-01-18 14:37:24 +0000
commit7b5f63285a7952a57fcfc6bc349869752f689b82 (patch)
treefcce99d3edb1f4ac60f75e282abbda65fecaa34f /packages/trpc/routers/apiKeys.ts
parent6094d360cc64806c7e2544c51b6a1f5b1ef140f6 (diff)
downloadkarakeep-7b5f63285a7952a57fcfc6bc349869752f689b82.tar.zst
feat: track api key usage dates
Diffstat (limited to 'packages/trpc/routers/apiKeys.ts')
-rw-r--r--packages/trpc/routers/apiKeys.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/trpc/routers/apiKeys.ts b/packages/trpc/routers/apiKeys.ts
index 763bc23a..90de824a 100644
--- a/packages/trpc/routers/apiKeys.ts
+++ b/packages/trpc/routers/apiKeys.ts
@@ -1,5 +1,5 @@
import { TRPCError } from "@trpc/server";
-import { and, eq } from "drizzle-orm";
+import { and, desc, eq } from "drizzle-orm";
import { z } from "zod";
import { apiKeys } from "@karakeep/db/schema";
@@ -83,6 +83,7 @@ export const apiKeysAppRouter = router({
name: z.string(),
createdAt: z.date(),
keyId: z.string(),
+ lastUsedAt: z.date().nullish(),
}),
),
}),
@@ -94,8 +95,10 @@ export const apiKeysAppRouter = router({
id: true,
name: true,
createdAt: true,
+ lastUsedAt: true,
keyId: true,
},
+ orderBy: desc(apiKeys.createdAt),
});
return { keys: resp };
}),