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>
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
"""File storage model."""
|
|
|
|
import uuid
|
|
from sqlalchemy import Column, String, Boolean, DateTime, BigInteger, ForeignKey, Text
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base import Base
|
|
|
|
|
|
class StoredFile(Base):
|
|
"""Model for tracking uploaded files."""
|
|
|
|
__tablename__ = "stored_files"
|
|
|
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
|
|
# Original file info
|
|
original_filename = Column(String(255), nullable=False)
|
|
content_type = Column(String(100), nullable=True)
|
|
size_bytes = Column(BigInteger, nullable=False)
|
|
|
|
# Storage info
|
|
storage_path = Column(String(500), nullable=False) # Relative path in storage
|
|
storage_type = Column(String(20), default="local", nullable=False) # local, s3, etc.
|
|
|
|
# Metadata
|
|
description = Column(Text, nullable=True)
|
|
tags = Column(Text, nullable=True) # JSON array as text
|
|
|
|
# Access control
|
|
is_public = Column(Boolean, default=False, nullable=False)
|
|
uploaded_by = Column(String(36), ForeignKey("users.id", ondelete="SET NULL"), nullable=True)
|
|
|
|
# Hash for deduplication/integrity
|
|
file_hash = Column(String(64), nullable=True, index=True) # SHA-256
|
|
|
|
# Timestamps
|
|
created_at = Column(DateTime, server_default=func.now(), nullable=False)
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), nullable=False)
|
|
|
|
# Soft delete
|
|
is_deleted = Column(Boolean, default=False, nullable=False)
|
|
deleted_at = Column(DateTime, nullable=True)
|