fix(api): 🏷️ Use context.body for 204 responses

This commit is contained in:
Jesse Wierzbinski 2024-12-30 16:18:28 +01:00
parent 6af6bde12a
commit a7b29d563e
No known key found for this signature in database
8 changed files with 17 additions and 13 deletions

View file

@ -146,7 +146,7 @@ export default apiRoute((app) => {
await role.linkUser(targetUser.id);
return context.text("", 204);
return context.body(null, 204);
});
app.openapi(routeDelete, async (context) => {
@ -186,6 +186,6 @@ export default apiRoute((app) => {
await role.unlinkUser(targetUser.id);
return context.text("", 204);
return context.body(null, 204);
});
});

View file

@ -362,6 +362,6 @@ export default apiRoute((app) => {
await db.delete(Emojis).where(eq(Emojis.id, id));
return context.text("", 204);
return context.body(null, 204);
});
});

View file

@ -52,7 +52,7 @@ const routePut = createRoute({
},
},
responses: {
204: {
200: {
description: "Media updated",
content: {
"application/json": {
@ -147,10 +147,10 @@ export default apiRoute((app) => {
thumbnailUrl,
});
return context.json(attachment.toApi(), 204);
return context.json(attachment.toApi(), 200);
}
return context.json(attachment.toApi(), 204);
return context.json(attachment.toApi(), 200);
});
app.openapi(routeGet, async (context) => {

View file

@ -226,7 +226,7 @@ export default apiRoute((app) => {
visible,
});
return context.text("", 204);
return context.body(null, 204);
});
app.openapi(routeDelete, async (context) => {
@ -261,6 +261,6 @@ export default apiRoute((app) => {
await role.delete();
return context.text("", 204);
return context.body(null, 204);
});
});

View file

@ -343,6 +343,6 @@ export default apiRoute((app) => {
.delete(Filters)
.where(and(eq(Filters.userId, user.id), eq(Filters.id, id)));
return context.text("", 204);
return context.body(null, 204);
});
});