26 lines
733 B
Python
26 lines
733 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from src.db.models.bookshelf import ArticleAuthor
|
|
|
|
|
|
class ArticleAuthorResponse(BaseModel):
|
|
id: str
|
|
created_date: datetime
|
|
last_modified_date: datetime
|
|
version: int
|
|
article_id: str
|
|
author_id: str
|
|
|
|
def to_response(articleauthor: ArticleAuthor) -> ArticleAuthorResponse:
|
|
response: ArticleAuthorResponse = ArticleAuthorResponse(
|
|
id=articleauthor.id,
|
|
created_date=articleauthor.created_date,
|
|
last_modified_date=articleauthor.last_modified_date,
|
|
version=articleauthor.version,
|
|
article_id=articleauthor.article_id,
|
|
author_id=articleauthor.author_id
|
|
)
|
|
return response
|