Improve file listing and fix notification metadata field
Backend:
- Optimize file listing for non-superusers with dedicated CRUD methods
- Add get_visible_for_user and count_visible_for_user for efficient queries
- Move /allowed-types/ and /max-size/ routes before /{file_id} for proper matching
- Rename notification 'metadata' field to 'extra_data' for clarity
- Fix settings export to use get_value() method
Frontend:
- Update NotificationItem interface to use extra_data field
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,12 +23,12 @@ router = APIRouter()
|
||||
|
||||
def serialize_notification(db_obj) -> dict:
|
||||
"""Serialize notification for response."""
|
||||
metadata = None
|
||||
if db_obj.metadata:
|
||||
extra_data = None
|
||||
if db_obj.extra_data:
|
||||
try:
|
||||
metadata = json.loads(db_obj.metadata)
|
||||
extra_data = json.loads(db_obj.extra_data)
|
||||
except json.JSONDecodeError:
|
||||
metadata = None
|
||||
extra_data = None
|
||||
|
||||
return {
|
||||
"id": db_obj.id,
|
||||
@@ -37,7 +37,7 @@ def serialize_notification(db_obj) -> dict:
|
||||
"message": db_obj.message,
|
||||
"type": db_obj.type,
|
||||
"link": db_obj.link,
|
||||
"metadata": metadata,
|
||||
"extra_data": extra_data,
|
||||
"is_read": db_obj.is_read,
|
||||
"created_at": db_obj.created_at,
|
||||
"read_at": db_obj.read_at
|
||||
@@ -239,6 +239,6 @@ def broadcast_notification(
|
||||
message=notification_in.message,
|
||||
type=notification_in.type,
|
||||
link=notification_in.link,
|
||||
metadata=notification_in.metadata
|
||||
extra_data=notification_in.extra_data
|
||||
)
|
||||
return {"sent_to": count}
|
||||
|
||||
Reference in New Issue
Block a user