update
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user