Journal dashboard widgets and quick-add; rich-text quick-add dialogs. Dashboard draft sync for live edit previews; assistant bubble + API tools. Journal UX: stress slider, mood grid, query cap fix.
27 lines
986 B
TypeScript
27 lines
986 B
TypeScript
import { z } from "zod";
|
|
import { apiJson, withApiHandler } from "@/lib/api-handler";
|
|
import {
|
|
deleteCareScheduleForScope,
|
|
toggleCareScheduleForScope,
|
|
} from "@/modules/garden/server/actions";
|
|
import { careScheduleToggleInput } from "@/modules/garden/server/schemas";
|
|
|
|
export async function PATCH(request: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params;
|
|
return withApiHandler(request, async (scope, req) => {
|
|
const body: unknown = await req.json();
|
|
const parsed = careScheduleToggleInput.parse({ ...(body as object), id });
|
|
await toggleCareScheduleForScope(scope, parsed);
|
|
return apiJson({ ok: true });
|
|
});
|
|
}
|
|
|
|
export async function DELETE(request: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params;
|
|
return withApiHandler(request, async (scope) => {
|
|
z.string().uuid().parse(id);
|
|
await deleteCareScheduleForScope(scope, { id });
|
|
return apiJson({ ok: true });
|
|
});
|
|
}
|