b0e987f790
- Add NotificationType and NotificationPreference models
- Add get_notification_types() to BasePlugin for plugin registration
- Add sync_notification_types() to PluginRegistry
- Update create_notification() to check user preferences (returns Notification|None)
- Add API endpoints: GET /types, GET /preferences, PATCH /preferences/{type_key}
- Add NotificationPreferenceUpdate schema
- Mail plugin registers 10 notification types with metadata
- Add Alembic migration 0017 for new tables + seed data
- Frontend: SettingsNotifications page with toggle switches
- Frontend: Settings tab, route, hooks for notification preferences
- i18n: notification settings keys (de/en)
56 lines
1.0 KiB
Python
56 lines
1.0 KiB
Python
"""Common schemas for pagination, errors, etc."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
detail: str
|
|
code: str | None = None
|
|
fields: dict[str, str] | None = None
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
status: str
|
|
version: str
|
|
|
|
|
|
class NotificationResponse(BaseModel):
|
|
id: str
|
|
type: str
|
|
title: str
|
|
body: str | None = None
|
|
read_at: str | None = None
|
|
created_at: str | None = None
|
|
|
|
|
|
class NotificationListResponse(BaseModel):
|
|
items: list[NotificationResponse]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
|
|
|
|
class UnreadCountResponse(BaseModel):
|
|
count: int
|
|
|
|
|
|
class NotificationPreferenceUpdate(BaseModel):
|
|
is_enabled: bool
|
|
|
|
|
|
class NotificationTypeResponse(BaseModel):
|
|
type_key: str
|
|
plugin_name: str
|
|
category: str
|
|
label: str
|
|
description: str | None = None
|
|
is_enabled_by_default: bool
|
|
is_enabled: bool
|
|
|
|
|
|
class NotificationPreferenceResponse(BaseModel):
|
|
type_key: str
|
|
is_enabled: bool
|