✨ feat: add endpoint to get all episodes by media
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 57s
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 57s
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
import { Context } from "elysia";
|
||||
import { mainErrorHandler } from "../../../helpers/error/handler";
|
||||
import { returnReadResponse } from "../../../helpers/callback/httpResponse";
|
||||
import { getAllEpisodeFromSpecificMediaService } from "../services/http/getAllEpisodeFromSpecificMedia.service";
|
||||
|
||||
export const getAllEpisodeFromSpecificMediaController = async (
|
||||
ctx: Context & { params: { mediaSlug: string } },
|
||||
) => {
|
||||
try {
|
||||
const episodesData = await getAllEpisodeFromSpecificMediaService(
|
||||
ctx.params.mediaSlug,
|
||||
);
|
||||
return returnReadResponse(
|
||||
ctx.set,
|
||||
200,
|
||||
"Episodes fetched successfully",
|
||||
episodesData,
|
||||
);
|
||||
} catch (error) {
|
||||
return mainErrorHandler(ctx.set, error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user