mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +10:00
finished object endpoints
Added writing (tested) and deleting (untested) endpoints
This commit is contained in:
9
server/api/v1/object/[id]/index.delete.ts
Normal file
9
server/api/v1/object/[id]/index.delete.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const id = getRouterParam(h3, "id");
|
||||
if (!id) throw createError({ statusCode: 400, statusMessage: "Invalid ID" });
|
||||
|
||||
const userId = await h3.context.session.getUserId(h3);
|
||||
|
||||
const result = await h3.context.objects.deleteWithPermission(id, userId);
|
||||
return { success: result };
|
||||
});
|
||||
Reference in New Issue
Block a user