bug fixes, and performance improvements, and drawer
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user