Add comprehensive backend features and mobile UI improvements
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>
This commit is contained in:
75
backend/app/schemas/notification.py
Normal file
75
backend/app/schemas/notification.py
Normal file
@@ -0,0 +1,75 @@
|
||||
"""Pydantic schemas for Notification API requests/responses."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional, List, Any
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class NotificationBase(BaseModel):
|
||||
"""Base notification schema."""
|
||||
title: str = Field(..., min_length=1, max_length=200)
|
||||
message: Optional[str] = None
|
||||
type: str = Field(default="info", pattern="^(info|success|warning|error|system)$")
|
||||
link: Optional[str] = Field(None, max_length=500)
|
||||
extra_data: Optional[dict] = None
|
||||
|
||||
|
||||
class NotificationCreate(NotificationBase):
|
||||
"""Schema for creating a notification."""
|
||||
user_id: str # Required for system/admin notifications
|
||||
|
||||
|
||||
class NotificationCreateForUser(NotificationBase):
|
||||
"""Schema for creating a notification for a specific user (admin use)."""
|
||||
pass
|
||||
|
||||
|
||||
class Notification(BaseModel):
|
||||
"""Schema for notification response."""
|
||||
id: str
|
||||
user_id: str
|
||||
title: str
|
||||
message: Optional[str] = None
|
||||
type: str
|
||||
link: Optional[str] = None
|
||||
extra_data: Optional[dict] = None
|
||||
is_read: bool
|
||||
created_at: datetime
|
||||
read_at: Optional[datetime] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class NotificationList(BaseModel):
|
||||
"""Schema for paginated notification list."""
|
||||
items: List[Notification]
|
||||
total: int
|
||||
unread_count: int
|
||||
|
||||
|
||||
class NotificationStats(BaseModel):
|
||||
"""Schema for notification statistics."""
|
||||
total: int
|
||||
unread: int
|
||||
by_type: dict[str, int]
|
||||
|
||||
|
||||
class NotificationBulkAction(BaseModel):
|
||||
"""Schema for bulk notification actions."""
|
||||
notification_ids: List[str]
|
||||
|
||||
|
||||
class NotificationPreferences(BaseModel):
|
||||
"""Schema for user notification preferences."""
|
||||
email_notifications: bool = True
|
||||
push_notifications: bool = True
|
||||
notification_types: dict[str, bool] = Field(
|
||||
default_factory=lambda: {
|
||||
"info": True,
|
||||
"success": True,
|
||||
"warning": True,
|
||||
"error": True,
|
||||
"system": True
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user