refactor: updated schema to better reflect the models

This commit is contained in:
surtur 2020-08-07 01:54:22 +02:00
parent 35dbbffd49
commit 683586d6f0
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -5,41 +5,37 @@ from pydantic import BaseModel
class ServiceBase(BaseModel): class ServiceBase(BaseModel):
name: str name: str
owner_id: int
is_private: bool = True is_private: bool = True
description: Optional[str] = None description: Optional[str] = None
service_type: int service_type: int
url: str url: str
owner_id: Optional[int] = None
is_active: bool = True is_active: bool = True
updated_unix: float
class Service(BaseModel): class Service(BaseModel):
name: str
owner_id: int
is_active: bool = True
created_unix: float created_unix: float
updated_unix: float = None
class ServiceCreate(ServiceBase): class ServiceCreate(ServiceBase):
pass pass
class Service(ServiceBase): class Service(ServiceBase):
owner_id: int pass
class Config: class Config:
orm_mode = True orm_mode = True
class UserBase(BaseModel): class UserBase(BaseModel):
name: str name: str
full_name: Optional[str] = None full_name: Optional[str] = None
is_active: bool = True is_active: bool = True
class User(BaseModel): class User(BaseModel):
name: str
full_name: Optional[str] = None
is_active: bool = True
last_login_unix: float
created_unix: float created_unix: float
updated_unix: float = None
last_login_unix: float = None
class UserCreate(UserBase): class UserCreate(UserBase):
password: str password: str