feat: Implement granular API for video upload/update and attachment management with dedicated types and endpoints.

This commit is contained in:
JakkrapartXD 2026-01-26 17:23:26 +07:00
parent e082c77946
commit be7348c74d
4 changed files with 580 additions and 215 deletions

View file

@ -353,14 +353,85 @@ export interface UpdateLessonResponse {
data: LessonData;
}
export interface UpdateVideoLessonInput {
// ============================================
// Separate Video/Attachment API Types
// ============================================
/**
* Input for uploading video to a lesson
*/
export interface UploadVideoInput {
token: string;
course_id: number;
lesson_id: number;
video?: UploadedFileInfo;
attachments?: UploadedFileInfo[];
video: UploadedFileInfo;
}
/**
* Input for updating (replacing) video in a lesson
*/
export interface UpdateVideoInput {
token: string;
course_id: number;
lesson_id: number;
video: UploadedFileInfo;
}
/**
* Input for uploading a single attachment to a lesson
*/
export interface UploadAttachmentInput {
token: string;
course_id: number;
lesson_id: number;
attachment: UploadedFileInfo;
}
/**
* Input for deleting an attachment from a lesson
*/
export interface DeleteAttachmentInput {
token: string;
course_id: number;
lesson_id: number;
attachment_id: number;
}
/**
* Response for video operations
*/
export interface VideoOperationResponse {
code: number;
message: string;
data: {
lesson_id: number;
video_url: string | null;
file_name: string;
file_size: number;
mime_type: string;
};
}
/**
* Response for attachment operations
*/
export interface AttachmentOperationResponse {
code: number;
message: string;
data: LessonAttachmentData;
}
/**
* Response for delete attachment operation
*/
export interface DeleteAttachmentResponse {
code: number;
message: string;
}
export interface DeleteLessonResponse {
code: number;
message: string;
@ -386,20 +457,6 @@ export interface LessonWithDetailsResponse {
};
}
// ============================================
// Add Video/Quiz to Lesson Input Types
// ============================================
/**
* Input for adding video and attachments to an existing VIDEO lesson
*/
export interface AddVideoToLessonInput {
token: string;
course_id: number;
lesson_id: number;
video: UploadedFileInfo;
attachments?: UploadedFileInfo[];
}
/**
* Input for adding quiz to an existing QUIZ lesson
@ -430,7 +487,6 @@ export interface AddQuestionInput {
question: MultiLanguageText;
explanation?: MultiLanguageText;
question_type: 'MULTIPLE_CHOICE' | 'TRUE_FALSE' | 'SHORT_ANSWER';
score?: number;
sort_order?: number;
choices?: CreateQuizChoiceInput[];
}
@ -455,7 +511,6 @@ export interface UpdateQuestionInput {
question?: MultiLanguageText;
explanation?: MultiLanguageText;
question_type?: 'MULTIPLE_CHOICE' | 'TRUE_FALSE' | 'SHORT_ANSWER';
score?: number;
sort_order?: number;
choices?: CreateQuizChoiceInput[]; // Replace all choices if provided
}
@ -501,6 +556,31 @@ export interface DeleteQuestionResponse {
message: string;
}
/**
* Input for updating quiz settings
*/
export interface UpdateQuizInput {
token: string;
course_id: number;
lesson_id: number;
title?: MultiLanguageText;
description?: MultiLanguageText;
passing_score?: number;
time_limit?: number;
shuffle_questions?: boolean;
shuffle_choices?: boolean;
show_answers_after_completion?: boolean;
}
/**
* Response for updating quiz
*/
export interface UpdateQuizResponse {
code: number;
message: string;
data: QuizData;
}
// ============================================
// Controller Body Request Types
// ============================================
@ -550,7 +630,6 @@ export interface AddQuestionBody {
question: MultiLanguageText;
explanation?: MultiLanguageText;
question_type: 'MULTIPLE_CHOICE' | 'TRUE_FALSE' | 'SHORT_ANSWER';
score?: number;
sort_order?: number;
choices?: CreateQuizChoiceInput[];
}
@ -559,7 +638,16 @@ export interface UpdateQuestionBody {
question?: MultiLanguageText;
explanation?: MultiLanguageText;
question_type?: 'MULTIPLE_CHOICE' | 'TRUE_FALSE' | 'SHORT_ANSWER';
score?: number;
sort_order?: number;
choices?: CreateQuizChoiceInput[];
}
export interface UpdateQuizBody {
title?: MultiLanguageText;
description?: MultiLanguageText;
passing_score?: number;
time_limit?: number;
shuffle_questions?: boolean;
shuffle_choices?: boolean;
show_answers_after_completion?: boolean;
}