40 lines
706 B
Python
40 lines
706 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class MatchBase(BaseModel):
|
|
title: Optional[str] = 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
|