This commit is contained in:
Marek Lenczewski
2026-04-06 10:42:29 +02:00
parent b6635a107d
commit 8ecef00d0a
14 changed files with 128 additions and 61 deletions

View File

@@ -8,10 +8,11 @@ def create_video(db: Session, video_data: VideoCreate) -> Video:
profile_id = video_data.profile_id
data = video_data.model_dump(exclude={"profile_id"})
video = Video(**data)
if profile_id:
profile = db.query(Profile).filter(Profile.id == profile_id).first()
if profile:
video.profiles.append(profile)
if not profile_id:
profile_id = 1
profile = db.query(Profile).filter(Profile.id == profile_id).first()
if profile:
video.profiles.append(profile)
db.add(video)
db.commit()
db.refresh(video)