mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-19 05:06:56 +02:00
feat: Implement snapshot and export management, including API endpoints, database schema, and UI for listing, saving, loading, and deleting.
This commit is contained in:
1 parent
7288b3da72
commit
a93b1b36fc
7 files changed
+48
-20
No files matched your search
@@ -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));
|
||||
}
|
||||
Reference in new issue
Block a user