Files
kontor/kontor-api/src/schema/tysc/card.py
T
tpeetz d5705c3a28
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
move kontor_model in kontor-api (#98)
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de>
Reviewed-on: #98
2026-10-15 23:14:16 +00:00

32 lines
793 B
Python

from datetime import datetime
from pydantic import BaseModel
from src.db.models.tysc import Card
class CardResponse(BaseModel):
id: str
created_date: datetime
last_modified_date: datetime
version: int
card_number: int
year: int
card_set_id: str
rooster_id: str
vendor_id: str
def to_response(card: Card) -> CardResponse:
response: CardResponse = CardResponse(
id=card.id,
created_date=card.created_date,
last_modified_date=card.last_modified_date,
version=card.version,
card_number=card.card_number,
year=card.year,
card_set_id=str(card.card_set_id),
rooster_id=str(card.rooster_id),
vendor_id=str(card.vendor_id)
)
return response