Created basic backend structure, auth and CRUD endpoints.

This commit is contained in:
2025-02-22 13:42:10 +03:00
parent ed5fac3432
commit cabcf837f9
14 changed files with 470 additions and 3 deletions

59
data/schemas.py Normal file
View 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