1
0
cvsa/packages/core/db/snapshots/getLatestSnapshot.ts
2025-10-06 17:04:16 +08:00

11 lines
377 B
TypeScript

import { dbMain } from "@core/drizzle";
import { latestVideoSnapshot } from "@core/drizzle/main/schema";
import { eq } from "drizzle-orm";
export const getLatestSnapshot = async (aid: number) =>{
const result = await dbMain.select().from(latestVideoSnapshot).where(eq(latestVideoSnapshot.aid, aid)).limit(1);
if (result.length === 0) {
return null;
}
return result[0];
}