feat: complete Git Repo Manager MVP implementation
Backend (Phase 1-6): - Pydantic schemas for request/response validation - Service layer (SSH Key, Server, Repo, Sync) - API routes with authentication - FastAPI main application with lifespan management - ORM models (SshKey, Server, Repo, SyncLog) Frontend (Phase 7): - Vue 3 + Element Plus + Pinia + Vue Router - API client with Axios and interceptors - State management stores - All page components (Dashboard, Servers, Repos, SyncLogs, SshKeys, Settings) Deployment (Phase 8): - README with quick start guide - Startup script (start.sh) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
55
backend/app/schemas/common.py
Normal file
55
backend/app/schemas/common.py
Normal file
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
Common Pydantic schemas for API responses.
|
||||
"""
|
||||
from typing import Generic, TypeVar, Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class SuccessResponse(BaseModel, Generic[T]):
|
||||
"""
|
||||
Standard success response wrapper.
|
||||
"""
|
||||
code: int = Field(default=0, description="Response code, 0 for success")
|
||||
data: T = Field(description="Response data")
|
||||
message: str = Field(default="success", description="Response message")
|
||||
|
||||
model_config = {
|
||||
"json_schema_extra": {
|
||||
"examples": [
|
||||
{
|
||||
"code": 0,
|
||||
"data": {},
|
||||
"message": "success"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ErrorResponse(BaseModel):
|
||||
"""
|
||||
Standard error response wrapper.
|
||||
"""
|
||||
code: int = Field(description="Error code, non-zero for errors")
|
||||
message: str = Field(description="Error message")
|
||||
data: Optional[dict] = Field(default=None, description="Additional error data")
|
||||
|
||||
model_config = {
|
||||
"json_schema_extra": {
|
||||
"examples": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Bad request",
|
||||
"data": None
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "Resource not found",
|
||||
"data": {"detail": "Item with id 123 not found"}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user