move kontor_model in kontor-api (#98)
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de> Reviewed-on: #98
This commit was merged in pull request #98.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.db.models.media import MediaVideo
|
||||
|
||||
class MediaVideoResponse(BaseModel):
|
||||
id: str
|
||||
created_date: datetime
|
||||
last_modified_date: datetime
|
||||
version: int
|
||||
cloud_link: Optional[str] = None
|
||||
file_name: Optional[str] = None
|
||||
path: Optional[str] = None
|
||||
review: bool = False
|
||||
title: Optional[str] = None
|
||||
url: Optional[str] = None
|
||||
should_download: bool = False
|
||||
|
||||
class AddLink(BaseModel):
|
||||
url: str
|
||||
|
||||
def video_to_response(video: MediaVideo) -> MediaVideoResponse:
|
||||
response: MediaVideoResponse = MediaVideoResponse(
|
||||
id=video.id,
|
||||
created_date=video.created_date,
|
||||
last_modified_date=video.last_modified_date,
|
||||
version=video.version,
|
||||
cloud_link=str(video.cloud_link),
|
||||
file_name=str(video.file_name),
|
||||
path=str(video.path),
|
||||
review=bool(video.review),
|
||||
title=str(video.title),
|
||||
url=str(video.url),
|
||||
should_download=bool(video.should_download)
|
||||
)
|
||||
return response
|
||||
Reference in New Issue
Block a user