Compare commits

...

4 Commits

Author SHA1 Message Date
d7270f8696 Merge pull request 'docs' (#12) from docs into main
All checks were successful
Sync to GitHub / sync (push) Successful in 7s
Reviewed-on: #12
2026-02-06 22:30:22 +07:00
bd66705eae 📝 docs: add documentation for get all episodes controller
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 57s
2026-02-06 22:28:14 +07:00
7fb1d4f1f5 📝 docs: add documentation for get episode detail controller 2026-02-06 22:26:11 +07:00
7f129a1b55 📝 docs: add documentation for bulk update thumbnail controller 2026-02-06 22:22:49 +07:00
4 changed files with 101 additions and 1 deletions

View File

@ -3,6 +3,38 @@ import { mainErrorHandler } from "../../../helpers/error/handler";
import { returnReadResponse } from "../../../helpers/callback/httpResponse";
import { getAllEpisodeFromSpecificMediaService } from "../services/http/getAllEpisodeFromSpecificMedia.service";
/**
* @function getAllEpisodeFromSpecificMediaController
* @description Controller to handle fetching all episodes associated with a specific media slug.
*
* @param {Context & { params: { mediaSlug: string } }} ctx
* The context object containing the request body.
* The params must include:
* - mediaSlug: string - The slug of the media to which the episode belongs.
*
* @example
* Request route: GET /episodes/:mediaSlug
*
* @returns {Promise<Object>}
* A response object indicating success or failure.
* Return example:
* {
* success: true,
* status: 200,
* message: "Episodes fetched successfully.",
* data: { ...episodeDetails } // Data returned only if the env run on development mode
* }
*
* @throws {Object}
* An error response object if validation fails or an error occurs during bulk insert operation.
* Return example:
* {
* success: false,
* status: <Status Code>,
* message: "<Error Message>",
* error: { ...errorDetails } // Additional error details if available and the env run on development mode
* }
*/
export const getAllEpisodeFromSpecificMediaController = async (
ctx: Context & { params: { mediaSlug: string } },
) => {

View File

@ -8,6 +8,39 @@ export interface GetEpisodeDetailsParams {
episode?: string;
}
/**
* @function getEpisodeDetailsController
* @description Controller to handle fetching episode details based on provided parameters.
*
* @param {Context & { params: GetEpisodeDetailsParams }} ctx
* The context object containing the request body.
* The params must include:
* - mediaSlug?: string - The slug of the media to which the episode belongs.
* - episode?: string - The identifier of the episode.
*
* @example
* Request route: GET /episodes/:mediaSlug/:episode
*
* @returns {Promise<Object>}
* A response object indicating success or failure.
* Return example:
* {
* success: true,
* status: 200,
* message: "Episode details fetched successfully.",
* data: { ...episodeDetails } // Data returned only if the env run on development mode
* }
*
* @throws {Object}
* An error response object if validation fails or an error occurs during bulk insert operation.
* Return example:
* {
* success: false,
* status: <Status Code>,
* message: "<Error Message>",
* error: { ...errorDetails } // Additional error details if available and the env run on development mode
* }
*/
export const getEpisodeDetailsController = async (
ctx: Context & { params: GetEpisodeDetailsParams },
) => {

View File

@ -3,6 +3,41 @@ import { mainErrorHandler } from "../../../helpers/error/handler";
import { returnWriteResponse } from "../../../helpers/callback/httpResponse";
import { updateAllEpisodeThumbnailService } from "../services/http/updateAllEpisodeThumbnail.service";
/**
* @function updateAllEpisodeThumbnailController
* @description Controller to handle the bulk updating of episode thumbnails for all episodes associated with a specific service reference ID.
*
* @param {Context & { body: { service_reference_id: string } }} ctx
* The context object containing the request body.
* The body must include:
* - service_reference_id: string - The ID of the service to which the episodes belong.
*
* @example
* Request route: PUT /internal/episode/update-thumbnails
* Request body:
* {
* "service_reference_id": "019c0df6-f8fe-7565-82cd-9c29b20232ab"
* },
*
* @returns {Promise<Object>}
* A response object indicating success or failure.
* Return example:
* {
* success: true,
* status: 204,
* message: "Updating {newEpisodeThumbnailsCount} episode thumbnails successfully.",
* }
*
* @throws {Object}
* An error response object if validation fails or an error occurs during bulk insert operation.
* Return example:
* {
* success: false,
* status: <Status Code>,
* message: "<Error Message>",
* error: { ...errorDetails } // Additional error details if available and the env run on development mode
* }
*/
export const updateAllEpisodeThumbnailController = async (
ctx: Context & { body: { service_reference_id: string } },
) => {

View File

@ -8,6 +8,6 @@ import { updateAllEpisodeThumbnailController } from "./controllers/updateAllEpis
export const internalModule = new Elysia({ prefix: "/internal" })
.post("/media/bulk-insert", bulkInsertMediaController)
.post("/episode/bulk-insert", bulkInsertEpisodeController)
.post("/episode/update-thumbnails", updateAllEpisodeThumbnailController)
.put("/episode/update-thumbnails", updateAllEpisodeThumbnailController)
.post("/video/bulk-insert", bulkInsertVideoController)
.post("/video-service", createVideoServiceInternalController);