feat: add POST /notes/feed endpoint for multi-DID filtering

This commit is contained in:
Julien Calixte
2026-03-10 15:51:10 +01:00
parent 425dd96872
commit 06ac3142a8
2 changed files with 29 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import {
deleteWebhooksByDid,
getNotes,
getNotesByDid,
getNotesByDids,
} from "./src/data/db.ts";
import { log } from "./src/log.ts";
@@ -28,6 +29,17 @@ router.get("/:did/notes", (ctx) => {
ctx.response.body = getNotesByDid(did, cursor, limit);
});
router.post("/notes/feed", async (ctx) => {
const body = await ctx.request.body.json();
const { dids, cursor, limit } = body ?? {};
if (!Array.isArray(dids) || dids.length === 0) {
ctx.response.status = 400;
ctx.response.body = { error: "dids must be a non-empty array" };
return;
}
ctx.response.body = getNotesByDids(dids, cursor, Number(limit) || PAGINATION);
});
router.post("/:did/webhooks", async (ctx) => {
const { did } = ctx.params;
const body = await ctx.request.body.json();