feat: implement automation module
- Event-based triggers (Phase 1): - Trigger/TriggerLog models with field_change type - TriggerService for condition evaluation and action execution - Trigger CRUD API endpoints - Task integration (status, assignee, priority changes) - Frontend: TriggerList, TriggerForm components - Weekly reports (Phase 2): - ScheduledReport/ReportHistory models - ReportService for stats generation - APScheduler for Friday 16:00 job - Report preview/generate/history API - Frontend: WeeklyReportPreview, ReportHistory components - Tests: 23 new tests (14 triggers + 9 reports) - OpenSpec: add-automation change archived 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from app.middleware.audit import AuditMiddleware
|
||||
from app.core.scheduler import start_scheduler, shutdown_scheduler
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""Manage application lifespan events."""
|
||||
# Startup
|
||||
start_scheduler()
|
||||
yield
|
||||
# Shutdown
|
||||
shutdown_scheduler()
|
||||
from app.api.auth import router as auth_router
|
||||
from app.api.users import router as users_router
|
||||
from app.api.departments import router as departments_router
|
||||
@@ -15,12 +27,15 @@ from app.api.blockers import router as blockers_router
|
||||
from app.api.websocket import router as websocket_router
|
||||
from app.api.audit import router as audit_router
|
||||
from app.api.attachments import router as attachments_router
|
||||
from app.api.triggers import router as triggers_router
|
||||
from app.api.reports import router as reports_router
|
||||
from app.core.config import settings
|
||||
|
||||
app = FastAPI(
|
||||
title="Project Control API",
|
||||
description="Cross-departmental project management system API",
|
||||
version="0.1.0",
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
# CORS middleware
|
||||
@@ -49,6 +64,8 @@ app.include_router(blockers_router)
|
||||
app.include_router(websocket_router)
|
||||
app.include_router(audit_router)
|
||||
app.include_router(attachments_router)
|
||||
app.include_router(triggers_router)
|
||||
app.include_router(reports_router)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
|
||||
Reference in New Issue
Block a user