Add new API endpoints

This commit is contained in:
Jesse Wierzbinski 2023-09-27 08:45:07 -10:00
parent 95b46ba2e4
commit 1fb4600445
8 changed files with 96 additions and 14 deletions

View file

@ -41,7 +41,7 @@ export default async (
},
isReblog: exclude_reblogs ? true : undefined,
},
relations: ["account", "emojis", "announces", "likes"],
relations: ["account", "emojis", "announces", "likes", "object"],
order: {
created_at: "DESC",
},

View file

@ -37,10 +37,12 @@ export default async (
if (req.method === "GET") {
return jsonResponse(await foundStatus.toAPI());
} else if (req.method === "DELETE") {
if ((await foundStatus.toAPI()).account.id !== user?.id) {
if ((await foundStatus.toAPI()).account.id !== user?.actor.id) {
return errorResponse("Unauthorized", 401);
}
// TODO: Implement delete and redraft functionality
// Get associated Status object
const status = await Status.createQueryBuilder("status")
.leftJoinAndSelect("status.object", "object")
@ -54,7 +56,7 @@ export default async (
// Delete status and all associated objects
await status.object.remove();
return jsonResponse({});
return jsonResponse({}, 200);
}
return jsonResponse({});