bug fixes, and performance improvements, and drawer

This commit is contained in:
Zoe
2026-09-27 18:44:51 -05:00
parent d48d8163a7
commit 2b9f8d64d7
52 changed files with 4913 additions and 778 deletions
+13
View File
@@ -1,9 +1,22 @@
import { and, eq, isNull, lte, or } from "drizzle-orm";
import { topics } from "~~/drizzle/schema";
import { db } from "~~/server/lib/db";
export default defineEventHandler(async (event) => {
await protectRoute(event);
const userId = event.context.user!.id as string;
// Expired leases also recover jobs interrupted by a server restart.
await db.update(topics).set({
renaming: false,
renameAttemptId: null,
renameExpiresAt: null,
}).where(and(
eq(topics.userId, userId),
eq(topics.renaming, true),
or(isNull(topics.renameExpiresAt), lte(topics.renameExpiresAt, new Date())),
));
const agents = await db.query.agents.findMany({
where: {
userId,