docs for memories
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-06-29 15:00:34 +01:00
parent 701d39982f
commit 421c96c814
14 changed files with 956 additions and 33 deletions

View File

@@ -0,0 +1,35 @@
import { handleApi } from "@/lib/api";
import { deleteResourceLink, updateResourceLink } from "@/lib/services/resource-links";
import { requireUser } from "@/lib/services/user";
export async function PATCH(
request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
const { id } = await params;
const body = await request.json();
return handleApi(async () => {
const { user } = await requireUser();
const link = await updateResourceLink({
userId: user.id,
id,
title: typeof body.title === "string" ? body.title : undefined,
url: typeof body.url === "string" ? body.url : undefined,
category: typeof body.category === "string" ? body.category : undefined,
notes: typeof body.notes === "string" || body.notes === null ? body.notes : undefined,
status: typeof body.status === "string" ? body.status : undefined,
});
return { link };
});
}
export async function DELETE(
_request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
const { id } = await params;
return handleApi(async () => {
const { user } = await requireUser();
return deleteResourceLink(user.id, id);
});
}