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>
65 lines
2.0 KiB
Python
65 lines
2.0 KiB
Python
"""
|
|
Repository Pydantic schemas.
|
|
"""
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class CommitInfo(BaseModel):
|
|
"""
|
|
Schema for commit information.
|
|
"""
|
|
hash: str = Field(description="Commit hash")
|
|
author: str = Field(description="Commit author")
|
|
message: str = Field(description="Commit message")
|
|
timestamp: int = Field(description="Commit timestamp (Unix timestamp)")
|
|
|
|
model_config = {
|
|
"json_schema_extra": {
|
|
"examples": [
|
|
{
|
|
"hash": "a1b2c3d4e5f6...",
|
|
"author": "John Doe <john@example.com>",
|
|
"message": "Add new feature",
|
|
"timestamp": 1711891200
|
|
}
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
class RepoResponse(BaseModel):
|
|
"""
|
|
Schema for repository response.
|
|
"""
|
|
id: int = Field(description="Repository ID")
|
|
server_id: int = Field(description="Server ID")
|
|
name: str = Field(description="Repository name")
|
|
full_name: str = Field(description="Repository full name (e.g., 'owner/repo')")
|
|
clone_url: str = Field(description="Git clone URL")
|
|
local_path: str = Field(description="Local storage path")
|
|
last_sync_at: Optional[int] = Field(
|
|
default=None,
|
|
description="Last sync timestamp (Unix timestamp)"
|
|
)
|
|
status: str = Field(description="Repository status")
|
|
created_at: int = Field(description="Creation timestamp (Unix timestamp)")
|
|
|
|
model_config = {
|
|
"json_schema_extra": {
|
|
"examples": [
|
|
{
|
|
"id": 1,
|
|
"server_id": 1,
|
|
"name": "my-repo",
|
|
"full_name": "myorg/my-repo",
|
|
"clone_url": "https://gitea.example.com/myorg/my-repo.git",
|
|
"local_path": "/data/gitea-mirror/myorg/my-repo",
|
|
"last_sync_at": 1711891200,
|
|
"status": "success",
|
|
"created_at": 1711804800
|
|
}
|
|
]
|
|
}
|
|
}
|