<aside>

</aside>

Persistence

<aside>

Bảng files


Cột Kiểu Mô tả
id UUID PK Khóa chính
original_name VARCHAR Tên gốc file (vd: avatar.png)
key VARCHAR S3 key (vd: uploads/2025/06/18/uuid.png)
mime_type VARCHAR Loại MIME
size INT Kích thước (bytes), cập nhật khi upload hoàn tất
status ENUM pending/completed/failed
uploaded_by UUID (FK) ID người upload (nếu có xác thực)
created_at TIMESTAMP Khởi tạo
updated_at TIMESTAMP Cập nhật lần cuối
</aside>

<aside>

Bảng file_usages


Cột Kiểu Mô tả
id UUID PK Khóa chính
file_id UUID FK Tham chiếu tới files.id
target_id UUID ID đối tượng được gắn (userId, instructorId, courseId, paymentId…)
usage_type ENUM Mục đích upload:
created_at TIMESTAMP Thời điểm gắn usage
TYPE usage_type AS ENUM (
  'avatar',
  'instructor_cv',
  'instructor_certificate',
  'course_thumbnail',
  'course_video',
  'course_banner',
  'course_material',
  'payment_receipt',
  'invoice'
);

</aside>

Request Course Thumbnail Presign Upload Command

Complete Course Thumbnail Upload Command

Delete Course Thumbnail Command

Get Course Thumbnail Query

Request Course Video Presign Upload Command

Complete Course Video Upload Command

Delete Course Video Command

Get Course Video Query

List Course Videos Query

Request Course Banner Presign Upload Command

Complete Course Banner Upload Command

Delete Course Banner Command

Get Course Banner Query

Request Course Material Presign Upload Command

Complete Course Material Upload Command

Delete Course Material Command

List Course Materials Query

Get Course Material Query