aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api/configuration/+server.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-03 09:04:44 -0800
committerFuwn <[email protected]>2026-03-03 09:08:43 -0800
commit6a44eac70c41bb1343a20ddf3ce775e416214d75 (patch)
treec5128228834222a1a6f0cc93869215a806bd9a0a /src/routes/api/configuration/+server.ts
parentrefactor(effect): migrate api auth cookie decoding (diff)
downloaddue.moe-6a44eac70c41bb1343a20ddf3ce775e416214d75.tar.xz
due.moe-6a44eac70c41bb1343a20ddf3ce775e416214d75.zip
refactor(effect): add request body schema decoders to api routes
Diffstat (limited to 'src/routes/api/configuration/+server.ts')
-rw-r--r--src/routes/api/configuration/+server.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/routes/api/configuration/+server.ts b/src/routes/api/configuration/+server.ts
index 033e8dea..14c49766 100644
--- a/src/routes/api/configuration/+server.ts
+++ b/src/routes/api/configuration/+server.ts
@@ -1,10 +1,12 @@
import { userIdentity } from "$lib/Data/AniList/identity";
import { decodeAuthCookieOrThrow } from "$lib/Effect/authCookie";
+import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody";
import {
deleteUserConfiguration,
getUserConfiguration,
setUserConfiguration,
} from "$lib/Database/SB/User/configuration";
+import { Schema } from "effect";
const unauthorised = new Response("Unauthorised", { status: 401 });
@@ -27,7 +29,10 @@ export const PUT = async ({ cookies, request }) => {
return Response.json(
await setUserConfiguration((await userIdentity(user)).id, {
- configuration: await request.json(),
+ configuration: await decodeRequestJsonOrThrow(
+ request,
+ Schema.Record(Schema.String, Schema.Unknown),
+ ),
}),
{
headers: {