From 5cb9b475bed55f51513c136981a347edae9586c8 Mon Sep 17 00:00:00 2001 From: Vivy Bot Date: Mon, 2 Feb 2026 08:26:29 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=92=A1=20docs:=20add=20documentation?= =?UTF-8?q?=20for=20bulk=20insert=20video=20controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/bulkInsertVideo.controller.ts | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/modules/internal/controllers/bulkInsertVideo.controller.ts b/src/modules/internal/controllers/bulkInsertVideo.controller.ts index d68450a..b2b3148 100644 --- a/src/modules/internal/controllers/bulkInsertVideo.controller.ts +++ b/src/modules/internal/controllers/bulkInsertVideo.controller.ts @@ -14,6 +14,67 @@ export interface BulkInsertVideoBodyRequest { }>; } +/** + * @function bulkInsertVideoController + * @description Perform bulk insert of videos for specific episodes of a media. This operation inserts multiple videos associated with different episodes into the database based on the provided data. + * + * @param {Context & { body: BulkInsertVideoBodyRequest }} ctx + * The context object containing the request body. + * The body must include: + * - media_id: string - The ID of the media for which episodes will be inserted. + * - data: Array - An array of episode data, each containing: + * - episode: number - The episode number. + * - videos: Array - An array of video data for the episode, each containing: + * - service_id: string - The ID of the video service. + * - code: string - The code of the video on the service. + * + * @example + * Request route: POST /internal/video/bulk-insert + * Request body: + * { + * "media_id": "019c064e-a03d-7cc3-b2ae-5d6850ea456b", + * "data": [ + * { + * "episode": 1, + * "videos": [ + * { + * "service_id": "019c0df6-f8fe-7565-82cd-9c29b20232ab", + * "code": "fzwu9n8ge2qt" + * } + * ] + * }, + * { + * "episode": 2, + * "videos": [ + * { + * "service_id": "019c0df6-f8fe-7565-82cd-9c29b20232ab", + * "code": "w2maywh53rt8" + * } + * ] + * } + * ] + * }, + * + * @returns {Promise} + * A response object indicating success or failure. + * Return example: + * { + * success: true, + * status: 201, + * message: "Videos inserted", + * data: { ...insertedVideos } // 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: , + * message: "", + * error: { ...errorDetails } // Additional error details if available and the env run on development mode + * } + */ export const bulkInsertVideoController = async ( ctx: Context & { body: BulkInsertVideoBodyRequest }, ) => { From 9e487297cd032c9f661bfc97d48c02610f0ae1d1 Mon Sep 17 00:00:00 2001 From: Vivy Bot Date: Mon, 2 Feb 2026 08:30:34 +0700 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=92=A1=20docs:=20add=20documentation?= =?UTF-8?q?=20to=20createVideoService=20controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../createVideoService.controller.ts | 52 ++++++++++++++++++- .../http/createVideoService.service.ts | 4 +- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/modules/internal/controllers/createVideoService.controller.ts b/src/modules/internal/controllers/createVideoService.controller.ts index 90f8d68..eda4863 100644 --- a/src/modules/internal/controllers/createVideoService.controller.ts +++ b/src/modules/internal/controllers/createVideoService.controller.ts @@ -3,7 +3,7 @@ import { mainErrorHandler } from "../../../helpers/error/handler"; import { returnWriteResponse } from "../../../helpers/callback/httpResponse"; import { createVideoServiceInternalService } from "../services/http/createVideoService.service"; -export interface CreateVideoServiceBodyRequest { +export interface CreateVideoServiceInternalBodyRequest { name: string; domain: string; logo: string; @@ -13,8 +13,56 @@ export interface CreateVideoServiceBodyRequest { endpointDownload?: string; } +/** + * @function createVideoServiceInternalController + * @description Perform creation of a new video service. This operation adds a new video service to the database based on the provided data. + * + * @param {Context & { body: CreateVideoServiceInternalBodyRequest }} ctx + * The context object containing the request body. + * The body must include: + * - name: string - The name of the video service. + * - domain: string - The domain of the video service. + * - logo: string - The logo URL of the video service. + * - hexColor: string - The hex color associated with the video service. + * - endpointVideo: string - The endpoint URL for video streaming. + * - endpointThumbnail: string - The endpoint URL for thumbnails. + * - endpointDownload?: string - (Optional) The endpoint URL for downloads. + * + * @example + * Request route: POST /internal/video-service + * Request body: + * { + * "name": "Example Video Service", + * "domain": "example.com", + * "logo": "https://example.com/logo.png", + * "hexColor": "#FF5733", + * "endpointVideo": "https://api.example.com/videos", + * "endpointThumbnail": "https://api.example.com/thumbnails", + * "endpointDownload": "https://api.example.com/downloads" + * }, + * + * @returns {Promise} + * A response object indicating success or failure. + * Return example: + * { + * success: true, + * status: 201, + * message: "Video service created", + * data: { ...createdVideoService } // 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: , + * message: "", + * error: { ...errorDetails } // Additional error details if available and the env run on development mode + * } + */ export const createVideoServiceInternalController = async ( - ctx: Context & { body: CreateVideoServiceBodyRequest }, + ctx: Context & { body: CreateVideoServiceInternalBodyRequest }, ) => { try { const createdVideoService = await createVideoServiceInternalService( diff --git a/src/modules/internal/services/http/createVideoService.service.ts b/src/modules/internal/services/http/createVideoService.service.ts index 47791bd..dd36a62 100644 --- a/src/modules/internal/services/http/createVideoService.service.ts +++ b/src/modules/internal/services/http/createVideoService.service.ts @@ -1,10 +1,10 @@ import { SystemAccountId } from "../../../../config/account/system"; import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder"; -import { CreateVideoServiceBodyRequest } from "../../controllers/createVideoService.controller"; +import { CreateVideoServiceInternalBodyRequest } from "../../controllers/createVideoService.controller"; import { createVideoServiceInternalRepository } from "../../repositories/createVideoService.repository"; export const createVideoServiceInternalService = async ( - body: CreateVideoServiceBodyRequest, + body: CreateVideoServiceInternalBodyRequest, ) => { try { return await createVideoServiceInternalRepository({