43 lines
759 B
Python
43 lines
759 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
from pydantic.datetime_parse import datetime
|
|
|
|
|
|
class MatchBase(BaseModel):
|
|
day: Optional[datetime] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
# Properties to receive on match creation
|
|
class MatchCreate(MatchBase):
|
|
title: str
|
|
|
|
|
|
# Properties to receive on match update
|
|
class MatchUpdate(MatchBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
class MatchInDBBase(MatchBase):
|
|
id: int
|
|
title: str
|
|
owner_id: int
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
# Properties to return to client
|
|
class Match(MatchInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties properties stored in DB
|
|
class MatchInDB(MatchInDBBase):
|
|
pass
|