Files
buzz/app/(ui)/rubgram/admin/@modal/manual/api.ts
T
dmgnr a83015384c
Build and Push Image / build-backend (push) Successful in 1m17s
Build and Push Image / build-frontend (push) Successful in 3m15s
Build and Push Image / push (push) Successful in 53s
feat(db): add read replicas
2026-08-30 16:19:13 +00:00

32 lines
726 B
TypeScript

"use server";
import { db } from "@/lib/db";
import type { TAccessKey } from "@/lib/db/schema";
import { slipSync } from "@/lib/db/schema";
import { eq } from "drizzle-orm";
export async function startMobileUpload() {
return await db
.insert(slipSync)
.values({})
.returning()
.then((r) => r.pop()!);
}
export async function retrieveMobileUpload(accessKey: TAccessKey) {
const object = await db
.delete(slipSync)
.where(eq(slipSync.accessKey, accessKey))
.returning()
.then((r) => r.pop()!);
const fd = new FormData();
fd.set(
"file",
new File([Buffer.from(object.data!)], object.name!, {
type: object.type!,
}),
);
fd.set("name", object.name!);
return fd;
}