Backend: - Add 2FA authentication with TOTP support - Add API keys management system - Add audit logging for security events - Add file upload/management system - Add notifications system with preferences - Add session management - Add webhooks integration - Add analytics endpoints - Add export functionality - Add password policy enforcement - Add new database migrations for core tables Frontend: - Add module position system (top/bottom sidebar sections) - Add search and notifications module configuration tabs - Add mobile logo replacing hamburger menu - Center page title absolutely when no tabs present - Align sidebar footer toggles with navigation items - Add lighter icon color in dark theme for mobile - Add API keys management page - Add notifications page with context - Add admin analytics and audit logs pages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
88 lines
1.9 KiB
Python
88 lines
1.9 KiB
Python
"""File storage schemas."""
|
|
|
|
from datetime import datetime
|
|
from typing import Optional, List
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class FileBase(BaseModel):
|
|
"""Base file schema."""
|
|
description: Optional[str] = None
|
|
tags: Optional[List[str]] = None
|
|
is_public: bool = False
|
|
|
|
|
|
class FileCreate(FileBase):
|
|
"""Schema for file upload metadata."""
|
|
pass
|
|
|
|
|
|
class FileUpdate(BaseModel):
|
|
"""Schema for updating file metadata."""
|
|
description: Optional[str] = None
|
|
tags: Optional[List[str]] = None
|
|
is_public: Optional[bool] = None
|
|
|
|
|
|
class StoredFile(FileBase):
|
|
"""File response schema."""
|
|
id: str
|
|
original_filename: str
|
|
content_type: Optional[str] = None
|
|
size_bytes: int
|
|
storage_type: str
|
|
uploaded_by: Optional[str] = None
|
|
file_hash: Optional[str] = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class FileUploadResponse(BaseModel):
|
|
"""Response after successful file upload."""
|
|
id: str
|
|
original_filename: str
|
|
content_type: Optional[str] = None
|
|
size_bytes: int
|
|
download_url: str
|
|
|
|
|
|
class FileListResponse(BaseModel):
|
|
"""Response for file listing."""
|
|
files: List[StoredFile]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
|
|
|
|
# Allowed file types for upload
|
|
ALLOWED_CONTENT_TYPES = [
|
|
# Images
|
|
"image/jpeg",
|
|
"image/png",
|
|
"image/gif",
|
|
"image/webp",
|
|
"image/svg+xml",
|
|
# Documents
|
|
"application/pdf",
|
|
"application/msword",
|
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
"application/vnd.ms-excel",
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"text/plain",
|
|
"text/csv",
|
|
# Archives
|
|
"application/zip",
|
|
"application/x-tar",
|
|
"application/gzip",
|
|
# JSON/XML
|
|
"application/json",
|
|
"application/xml",
|
|
"text/xml",
|
|
]
|
|
|
|
# Maximum file size (10 MB by default)
|
|
MAX_FILE_SIZE = 10 * 1024 * 1024
|