mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: remake content upload and diffusion
This commit is contained in:
parent
aea9da388f
commit
fd0b5494cf
29 changed files with 345 additions and 162 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from calendar import c
|
||||
import json
|
||||
from typing import List, Optional
|
||||
from uuid import uuid4
|
||||
|
|
@ -184,7 +185,9 @@ async def create_course(
|
|||
name_in_disk = (
|
||||
f"{course_id}_thumbnail_{uuid4()}.{thumbnail_file.filename.split('.')[-1]}"
|
||||
)
|
||||
await upload_thumbnail(thumbnail_file, name_in_disk)
|
||||
await upload_thumbnail(
|
||||
thumbnail_file, name_in_disk, course_object.org_id, course_id
|
||||
)
|
||||
course_object.thumbnail = name_in_disk
|
||||
|
||||
course = CourseInDB(
|
||||
|
|
@ -225,7 +228,9 @@ async def update_course_thumbnail(
|
|||
if thumbnail_file and thumbnail_file.filename:
|
||||
name_in_disk = f"{course_id}_thumbnail_{uuid4()}.{thumbnail_file.filename.split('.')[-1]}"
|
||||
course = Course(**course).copy(update={"thumbnail": name_in_disk})
|
||||
await upload_thumbnail(thumbnail_file, name_in_disk)
|
||||
await upload_thumbnail(
|
||||
thumbnail_file, name_in_disk, course.org_id, course_id
|
||||
)
|
||||
|
||||
updated_course = CourseInDB(
|
||||
course_id=course_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue