feat: Initial commit - Task Reporter incident response system

Complete implementation of the production line incident response system (生產線異常即時反應系統) including:

Backend (FastAPI):
- User authentication with AD integration and session management
- Chat room management (create, list, update, members, roles)
- Real-time messaging via WebSocket (typing indicators, reactions)
- File storage with MinIO (upload, download, image preview)

Frontend (React + Vite):
- Authentication flow with token management
- Room list with filtering, search, and pagination
- Real-time chat interface with WebSocket
- File upload with drag-and-drop and image preview
- Member management and room settings
- Breadcrumb navigation
- 53 unit tests (Vitest)

Specifications:
- authentication: AD auth, sessions, JWT tokens
- chat-room: rooms, members, templates
- realtime-messaging: WebSocket, messages, reactions
- file-storage: MinIO integration, file management
- frontend-core: React SPA structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-01 17:42:52 +08:00
commit c8966477b9
135 changed files with 23269 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
"""Pydantic schemas for file storage operations"""
from pydantic import BaseModel, Field, field_validator
from typing import Optional, List
from datetime import datetime
from enum import Enum
class FileType(str, Enum):
"""File type enumeration"""
IMAGE = "image"
DOCUMENT = "document"
LOG = "log"
class FileUploadResponse(BaseModel):
"""Response after successful file upload"""
file_id: str
filename: str
file_type: FileType
file_size: int
mime_type: str
download_url: str # Presigned URL
uploaded_at: datetime
uploader_id: str
class Config:
from_attributes = True
class FileMetadata(BaseModel):
"""File metadata response"""
file_id: str
room_id: str
filename: str
file_type: FileType
mime_type: str
file_size: int
minio_bucket: str
minio_object_path: str
uploaded_at: datetime
uploader_id: str
deleted_at: Optional[datetime] = None
download_url: Optional[str] = None # Presigned URL (only when requested)
class Config:
from_attributes = True
@field_validator("file_size")
@classmethod
def validate_file_size(cls, v):
"""Validate file size is positive"""
if v <= 0:
raise ValueError("File size must be positive")
return v
class FileListResponse(BaseModel):
"""Paginated file list response"""
files: List[FileMetadata]
total: int
limit: int
offset: int
has_more: bool
class Config:
from_attributes = True
class FileUploadParams(BaseModel):
"""Parameters for file upload (optional description)"""
description: Optional[str] = Field(None, max_length=500)
class Config:
from_attributes = True