Plandex / server /src /services /assets.ts
AUXteam's picture
Upload folder using huggingface_hub
cf9339a verified
raw
history blame
549 Bytes
import { eq } from "drizzle-orm";
import type { Db } from "@paperclipai/db";
import { assets } from "@paperclipai/db";
export function assetService(db: Db) {
return {
create: (companyId: string, data: Omit<typeof assets.$inferInsert, "companyId">) =>
db
.insert(assets)
.values({ ...data, companyId })
.returning()
.then((rows) => rows[0]),
getById: (id: string) =>
db
.select()
.from(assets)
.where(eq(assets.id, id))
.then((rows) => rows[0] ?? null),
};
}