move kontor_model in kontor-api
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.db.models.bookshelf import BookshelfPublisher
|
||||
|
||||
|
||||
class PublisherResponse(BaseModel):
|
||||
id: str
|
||||
created_date: datetime
|
||||
last_modified_date: datetime
|
||||
version: int
|
||||
name: str
|
||||
|
||||
def to_response(publisher: BookshelfPublisher) -> PublisherResponse:
|
||||
response: PublisherResponse = PublisherResponse(
|
||||
id=publisher.id,
|
||||
created_date=publisher.created_date,
|
||||
last_modified_date=publisher.last_modified_date,
|
||||
version=publisher.version,
|
||||
name=str(publisher.name)
|
||||
)
|
||||
return response
|
||||
Reference in New Issue
Block a user