// DELETE /cms/admin/posts/:id — delete a post (admin only). import "auth" as auth; let g = auth::guard(ctx, ["admin"]); if !g.ok { return g.response; } let id = ctx.request.params.id; let posts = docs::collection("posts"); let doc = posts.get(id); if doc == () { return #{ statusCode: 404, body: #{ error: "not found" } }; } let slug = doc.data.slug; posts.delete(id); kv::collection("slugs").delete("post:" + slug); #{ statusCode: 200, body: #{ ok: true } }