feat: add POST /notes/feed endpoint for multi-DID filtering
This commit is contained in:
12
server.ts
12
server.ts
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user