feat: Implement snapshot and export management, including API endpoints, database schema, and UI for listing, saving, loading, and deleting.

This commit is contained in:
Michael committed 2026-02-22 13:49:51 +01:00
1 parent 7288b3da72
commit a93b1b36fc
7 files changed
+48 -20

No files matched your search

+10 -3
View File
@@ -2,8 +2,15 @@
import { db } from "@/db";
import { sessionSnapshots } from "@/db/schema";
import { desc } from "drizzle-orm";
import { desc, eq } from "drizzle-orm";
export async function getSnapshots() {
return db.select().from(sessionSnapshots).orderBy(desc(sessionSnapshots.createdAt));
export async function getSnapshots(type?: "snapshot" | "export") {
let query = db.select().from(sessionSnapshots);
if (type) {
// @ts-ignore - type column added dynamically
return query.where(eq(sessionSnapshots.type, type)).orderBy(desc(sessionSnapshots.createdAt));
}
return query.orderBy(desc(sessionSnapshots.createdAt));
}