mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
Add new API endpoints
This commit is contained in:
parent
95b46ba2e4
commit
1fb4600445
8 changed files with 96 additions and 14 deletions
|
|
@ -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",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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({});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue