Add organization and task queue features
- Introduced new models for `Organization` and `ReviewTask` to manage organizations and review tasks. - Implemented API endpoints for CRUD operations on organizations and tasks, including scanning organizations for repositories and PRs. - Developed a background worker for sequential processing of review tasks with priority handling and automatic retries. - Created frontend components for managing organizations and monitoring task queues, including real-time updates and filtering options. - Added comprehensive documentation for organization features and quick start guides. - Fixed UI issues and improved navigation for better user experience.
This commit is contained in:
60
backend/app/schemas/organization.py
Normal file
60
backend/app/schemas/organization.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""Organization schemas"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Dict, Any, List
|
||||
from datetime import datetime
|
||||
from app.models.organization import OrganizationPlatformEnum
|
||||
|
||||
|
||||
class OrganizationBase(BaseModel):
|
||||
"""Base organization schema"""
|
||||
name: str = Field(..., description="Organization name")
|
||||
platform: OrganizationPlatformEnum = Field(..., description="Git platform")
|
||||
base_url: str = Field(..., description="Base URL (e.g., https://git.example.com)")
|
||||
config: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Review configuration")
|
||||
|
||||
|
||||
class OrganizationCreate(OrganizationBase):
|
||||
"""Schema for creating organization"""
|
||||
api_token: Optional[str] = Field(None, description="API token (optional, uses master token if not set)")
|
||||
webhook_secret: Optional[str] = Field(None, description="Webhook secret (generated if not provided)")
|
||||
|
||||
|
||||
class OrganizationUpdate(BaseModel):
|
||||
"""Schema for updating organization"""
|
||||
name: Optional[str] = None
|
||||
base_url: Optional[str] = None
|
||||
api_token: Optional[str] = None
|
||||
webhook_secret: Optional[str] = None
|
||||
config: Optional[Dict[str, Any]] = None
|
||||
is_active: Optional[bool] = None
|
||||
|
||||
|
||||
class OrganizationResponse(OrganizationBase):
|
||||
"""Schema for organization response"""
|
||||
id: int
|
||||
is_active: bool
|
||||
last_scan_at: Optional[datetime]
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
webhook_url: str = Field(..., description="Webhook URL for this organization")
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class OrganizationList(BaseModel):
|
||||
"""Schema for organization list response"""
|
||||
items: List[OrganizationResponse]
|
||||
total: int
|
||||
|
||||
|
||||
class OrganizationScanResult(BaseModel):
|
||||
"""Schema for organization scan result"""
|
||||
organization_id: int
|
||||
repositories_found: int
|
||||
repositories_added: int
|
||||
pull_requests_found: int
|
||||
tasks_created: int
|
||||
errors: List[str] = []
|
||||
|
||||
Reference in New Issue
Block a user