Created basic backend structure, auth and CRUD endpoints.
This commit is contained in:
59
data/schemas.py
Normal file
59
data/schemas.py
Normal file
@@ -0,0 +1,59 @@
|
||||
# schemas.py
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
from core.enums import ConnectionTypes, UserRole
|
||||
|
||||
|
||||
class ConnectionBase(BaseModel):
|
||||
db_name: str
|
||||
type: ConnectionTypes
|
||||
host: str
|
||||
port: int
|
||||
username: str
|
||||
password: str
|
||||
|
||||
|
||||
class ConnectionCreate(ConnectionBase):
|
||||
pass
|
||||
|
||||
|
||||
class ConnectionUpdate(ConnectionBase):
|
||||
pass
|
||||
|
||||
|
||||
class ConnectionInDBBase(ConnectionBase):
|
||||
id: int
|
||||
owner_id: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class Connection(ConnectionInDBBase):
|
||||
pass
|
||||
|
||||
|
||||
class UserBase(BaseModel):
|
||||
username: str
|
||||
|
||||
|
||||
class UserCreate(UserBase):
|
||||
role: UserRole
|
||||
|
||||
|
||||
class UserOut(UserBase):
|
||||
id: int
|
||||
role: UserRole
|
||||
|
||||
|
||||
class UserInDBBase(UserBase):
|
||||
id: int
|
||||
role: UserRole
|
||||
api_key: str
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class User(UserInDBBase):
|
||||
pass
|
||||
Reference in New Issue
Block a user