feat: add tests for /api/chat (#950)

This commit is contained in:
Jeremy 2025-04-22 18:55:17 -07:00 committed by GitHub
parent 4ca93aaf89
commit a159b77fcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 197 additions and 50 deletions

View file

@ -85,7 +85,11 @@ export async function deleteChatById({ id }: { id: string }) {
await db.delete(vote).where(eq(vote.chatId, id));
await db.delete(message).where(eq(message.chatId, id));
return await db.delete(chat).where(eq(chat.id, id));
const [chatsDeleted] = await db
.delete(chat)
.where(eq(chat.id, id))
.returning();
return chatsDeleted;
} catch (error) {
console.error('Failed to delete chat by id from database');
throw error;