Files
opsxsql/backend/app/schemas/instance.py
T
loganandClaude Opus 4.7 439155c92e Initial commit: SQL audit platform v0.1.0
FastAPI backend with auth, user, instance, ticket, query, dashboard APIs.
React + TypeScript frontend with mock data UI (10 pages).
SQLite + async SQLAlchemy, JWT auth, role-based access control.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 11:11:57 +08:00

51 lines
1.4 KiB
Python

from datetime import datetime
from pydantic import BaseModel, Field
from typing import Optional, Literal
class InstanceCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=100)
db_type: Literal["mysql", "postgres", "redis", "mongo"]
host: str = Field(..., min_length=1)
port: int = Field(..., ge=1, le=65535)
username: str = Field(..., min_length=1)
password: str = Field(..., min_length=1)
database: Optional[str] = None
env: Literal["production", "staging", "development"] = "development"
description: Optional[str] = None
class InstanceUpdate(BaseModel):
name: Optional[str] = None
host: Optional[str] = None
port: Optional[int] = Field(default=None, ge=1, le=65535)
username: Optional[str] = None
password: Optional[str] = None
database: Optional[str] = None
env: Optional[Literal["production", "staging", "development"]] = None
description: Optional[str] = None
class InstanceResponse(BaseModel):
id: int
name: str
db_type: str
host: str
port: int
username: str
database: Optional[str] = None
env: str
description: Optional[str] = None
status: str
version: Optional[str] = None
created_at: datetime
class Config:
from_attributes = True
class ConnectionTestResult(BaseModel):
success: bool
message: str
version: Optional[str] = None