mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 16:51:15 +10:00
* feat: add readDropValidatedBody w/ special handler for ArkErrors * fix: lint
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { type } from "arktype";
|
||||
import { throwingArktype } from "~/server/arktype";
|
||||
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
@ -14,7 +14,7 @@ export default defineEventHandler<{ body: typeof DeleteLibrarySource.infer }>(
|
||||
]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readValidatedBody(h3, DeleteLibrarySource);
|
||||
const body = await readDropValidatedBody(h3, DeleteLibrarySource);
|
||||
|
||||
return await prisma.library.delete({
|
||||
where: {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { type } from "arktype";
|
||||
import { throwingArktype } from "~/server/arktype";
|
||||
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import libraryManager from "~/server/internal/library";
|
||||
@ -19,7 +19,7 @@ export default defineEventHandler<{ body: typeof UpdateLibrarySource.infer }>(
|
||||
]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readValidatedBody(h3, UpdateLibrarySource);
|
||||
const body = await readDropValidatedBody(h3, UpdateLibrarySource);
|
||||
|
||||
const source = await prisma.library.findUnique({ where: { id: body.id } });
|
||||
if (!source)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { type } from "arktype";
|
||||
import { randomUUID } from "crypto";
|
||||
import { LibraryBackend } from "~/prisma/client";
|
||||
import { throwingArktype } from "~/server/arktype";
|
||||
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import libraryManager from "~/server/internal/library";
|
||||
@ -21,7 +21,7 @@ export default defineEventHandler<{ body: typeof CreateLibrarySource.infer }>(
|
||||
]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readValidatedBody(h3, CreateLibrarySource);
|
||||
const body = await readDropValidatedBody(h3, CreateLibrarySource);
|
||||
const backend = Object.values(LibraryBackend).find(
|
||||
(e) => e == body.backend,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user