✨ feat: add delete endpoint to collection
Some checks failed
Integration Tests / integration-tests (pull_request) Failing after 1m24s
Some checks failed
Integration Tests / integration-tests (pull_request) Failing after 1m24s
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
import { Context, Static } from "elysia";
|
||||
import { mainErrorHandler } from "../../../helpers/error/handler";
|
||||
import { returnWriteResponse } from "../../../helpers/callback/httpResponse";
|
||||
import { removeItemFromCollectionBySystemService } from "../services/removeItemFromCollectionBySystem.service";
|
||||
import { removeItemFromCollectionBySytemSchema } from "../schemas/removeItemFromCollectionBySytem.schema";
|
||||
|
||||
export const removeItemFromCollectionBySytemController = async (ctx: {
|
||||
set: Context["set"];
|
||||
headers: Static<typeof removeItemFromCollectionBySytemSchema.headers>;
|
||||
body: Static<typeof removeItemFromCollectionBySytemSchema.body>;
|
||||
}) => {
|
||||
try {
|
||||
const removedItem = await removeItemFromCollectionBySystemService({
|
||||
cookie: ctx.headers.cookie,
|
||||
collectionName: ctx.body.name,
|
||||
mediaId: ctx.body.itemId,
|
||||
});
|
||||
return returnWriteResponse(ctx.set, 200, "Item removed from collection successfully", removedItem);
|
||||
} catch (error) {
|
||||
return mainErrorHandler(ctx.set, error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user