feat: implement delete note endpoint in server

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Julien Calixte
2026-02-14 20:28:30 +01:00
parent 1534b1be4f
commit 51ea8a8f17

View File

@@ -1,5 +1,5 @@
import { Application, Router } from "@oak/oak"; import { Application, Router } from "@oak/oak";
import { getNotes, getNotesByDid } from "./src/data/db.ts"; import { deleteNote, getNotes, getNotesByDid } from "./src/data/db.ts";
const router = new Router(); const router = new Router();
@@ -20,6 +20,12 @@ router.get("/:did/notes", (ctx) => {
ctx.response.body = getNotesByDid(did, cursor, limit); ctx.response.body = getNotesByDid(did, cursor, limit);
}); });
router.delete("/:did/:rkey", (ctx) => {
const { did, rkey } = ctx.params;
deleteNote({ did, rkey });
ctx.response.status = 204;
})
const app = new Application(); const app = new Application();
app.use(async (ctx, next) => { app.use(async (ctx, next) => {