Phase 1 Backend Implementation: - ✅ MongoDB data models (Keyword, Pipeline, User, Application) - ✅ Pydantic schemas for all models with validation - ✅ KeywordService: Full CRUD, filtering, pagination, stats, toggle status - ✅ PipelineService: Full CRUD, start/stop/restart, logs, config management - ✅ Keywords API: 8 endpoints with complete functionality - ✅ Pipelines API: 11 endpoints with complete functionality - ✅ Updated TODO.md to reflect completion Key Features: - Async MongoDB operations with Motor - Comprehensive filtering and pagination support - Pipeline logging system - Statistics tracking for keywords and pipelines - Proper error handling with HTTP status codes - Type-safe request/response models Files Added: - models/: 4 data models with PyObjectId support - schemas/: 4 schema modules with Create/Update/Response patterns - services/: KeywordService (234 lines) + PipelineService (332 lines) Files Modified: - api/keywords.py: 40 → 212 lines (complete implementation) - api/pipelines.py: 25 → 300 lines (complete implementation) - TODO.md: Updated checklist with completed items Next Steps: - UserService with authentication - ApplicationService for OAuth2 - MonitoringService - Redis integration - Frontend implementation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
from datetime import datetime
|
|
from typing import Optional, List
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ApplicationBase(BaseModel):
|
|
"""Base application schema"""
|
|
name: str = Field(..., min_length=1, max_length=100)
|
|
redirect_uris: List[str] = Field(default_factory=list)
|
|
grant_types: List[str] = Field(
|
|
default_factory=lambda: ["authorization_code", "refresh_token"]
|
|
)
|
|
scopes: List[str] = Field(default_factory=lambda: ["read", "write"])
|
|
|
|
|
|
class ApplicationCreate(ApplicationBase):
|
|
"""Schema for creating a new application"""
|
|
pass
|
|
|
|
|
|
class ApplicationUpdate(BaseModel):
|
|
"""Schema for updating an application (all fields optional)"""
|
|
name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
redirect_uris: Optional[List[str]] = None
|
|
grant_types: Optional[List[str]] = None
|
|
scopes: Optional[List[str]] = None
|
|
|
|
|
|
class ApplicationResponse(ApplicationBase):
|
|
"""Schema for application response"""
|
|
id: str = Field(..., alias="_id")
|
|
client_id: str
|
|
owner_id: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
populate_by_name = True
|
|
from_attributes = True
|
|
|
|
|
|
class ApplicationWithSecret(ApplicationResponse):
|
|
"""Schema for application response with client secret (only on creation)"""
|
|
client_secret: str = Field(..., description="Plain text client secret (only shown once)")
|