init
This commit is contained in:
2
fuware/schemas/__init__.py
Normal file
2
fuware/schemas/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from .common import *
|
||||
from .user import *
|
8
fuware/schemas/common.py
Normal file
8
fuware/schemas/common.py
Normal file
@ -0,0 +1,8 @@
|
||||
from typing import Generic, TypeVar
|
||||
from pydantic import BaseModel
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
class ReturnValue(BaseModel, Generic[T]):
|
||||
status: int
|
||||
data: T
|
24
fuware/schemas/user.py
Normal file
24
fuware/schemas/user.py
Normal file
@ -0,0 +1,24 @@
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel
|
||||
from fastapi import Form
|
||||
|
||||
class UserBase(BaseModel):
|
||||
username: str = Form(...)
|
||||
|
||||
class UserRequest(UserBase):
|
||||
password: str = Form(...)
|
||||
|
||||
class UserCreate(UserRequest):
|
||||
password: str = Form(...)
|
||||
name: str
|
||||
|
||||
class User(UserBase):
|
||||
id: str
|
||||
name: str
|
||||
is_admin: bool
|
||||
is_lock: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
Reference in New Issue
Block a user