Files
kontor/kontor-api/src/db/repository/media/video.py
T
Thomas Peetz c885f6cc02
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
add missing endpoints for creating items
2026-05-26 22:43:04 +02:00

24 lines
650 B
Python

from datetime import datetime
import uuid
from sqlalchemy.orm import Session
from src.db.models.media import MediaVideo
from src.webapps.media.forms import AddLinkForm
def create_new_video(video: AddLinkForm, db: Session) -> MediaVideo:
print(video.url)
media_video = MediaVideo()
media_video.id = str(uuid.uuid4())
media_video.url = str(video.url)
media_video.created_date = datetime.now()
media_video.last_modified_date = datetime.now()
media_video.review = True
media_video.should_download = True
db.add(media_video)
db.commit()
db.refresh(media_video)
print(media_video)
return media_video