feat: add extensive test suite
This commit is contained in:
@@ -3,11 +3,14 @@
|
||||
import { adminCheck } from "@/lib/auth";
|
||||
import { db } from "@/lib/db";
|
||||
import { cdn } from "@/lib/db/schema";
|
||||
import { listFilesService } from "./service";
|
||||
|
||||
export async function listFiles() {
|
||||
if (!(await adminCheck())) throw "Unauthorized";
|
||||
|
||||
return await db
|
||||
.select({ id: cdn.id, name: cdn.name, size: cdn.size, type: cdn.type })
|
||||
.from(cdn);
|
||||
return listFilesService({
|
||||
adminCheck,
|
||||
list: () =>
|
||||
db
|
||||
.select({ id: cdn.id, name: cdn.name, size: cdn.size, type: cdn.type })
|
||||
.from(cdn),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user