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>
This commit is contained in:
commit
439155c92e
290 files changed
+61950
No files matched your search
@@ -0,0 +1,52 @@
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Literal
|
||||
|
||||
|
||||
class TicketCreate(BaseModel):
|
||||
title: str = Field(..., min_length=5, max_length=200)
|
||||
db_type: Literal["mysql", "postgres", "redis", "mongo"]
|
||||
instance_id: int
|
||||
target_database: str = Field(..., min_length=1)
|
||||
sql_content: str = Field(..., min_length=1)
|
||||
rollback_sql: Optional[str] = None
|
||||
reason: str = Field(..., min_length=5)
|
||||
priority: Literal["high", "medium", "low"] = "medium"
|
||||
|
||||
|
||||
class TicketReview(BaseModel):
|
||||
action: Literal["approve", "reject"]
|
||||
comment: str = Field(default="", max_length=500)
|
||||
|
||||
|
||||
class TicketResponse(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
db_type: str
|
||||
instance_id: int
|
||||
target_database: str
|
||||
sql_content: str
|
||||
rollback_sql: Optional[str] = None
|
||||
status: str
|
||||
priority: str
|
||||
applicant_id: int
|
||||
applicant_name: Optional[str] = None
|
||||
approver_id: Optional[int] = None
|
||||
approver_name: Optional[str] = None
|
||||
reason: Optional[str] = None
|
||||
audit_result: Optional[str] = None
|
||||
execute_result: Optional[str] = None
|
||||
create_time: datetime
|
||||
review_time: Optional[datetime] = None
|
||||
execute_time: Optional[datetime] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class TicketListParams(BaseModel):
|
||||
page: int = 1
|
||||
page_size: int = 10
|
||||
status: Optional[str] = None
|
||||
db_type: Optional[str] = None
|
||||
keyword: Optional[str] = None
|
||||
Reference in new issue
Block a user