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,25 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.db.models.bookshelf import Author
|
||||
|
||||
|
||||
class AuthorResponse(BaseModel):
|
||||
id: str
|
||||
created_date: datetime
|
||||
last_modified_date: datetime
|
||||
version: int
|
||||
first_name: str
|
||||
last_name: str
|
||||
|
||||
def to_response(author: Author) -> AuthorResponse:
|
||||
response: AuthorResponse = AuthorResponse(
|
||||
id=author.id,
|
||||
created_date=author.created_date,
|
||||
last_modified_date=author.last_modified_date,
|
||||
version=author.version,
|
||||
first_name=str(author.first_name),
|
||||
last_name=str(author.last_name)
|
||||
)
|
||||
return response
|
||||
Reference in New Issue
Block a user