DRY refactoring pass: shared mixins, route helpers, composables, CSS
Backend: - models/base.py: TimestampMixin + CreatedAtMixin; applied to all 10+ models - routes/utils.py: not_found() + parse_iso_date() helpers; used across all route files - routes/milestones.py: _milestone_dict() helper replaces 5 repeated to_dict + progress blocks Frontend: - 5 new composables: useAutoSave, useEditorGuards, useTagSuggestions, useFloatingAssist, useListKeyboardNavigation - ConfirmDialog.vue: reusable confirm modal replacing inline <teleport> blocks - editor-shared.css: sidebar CSS consolidated from both editor views - viewer-shared.css: context-bar/breadcrumb CSS consolidated from both viewer views - NoteEditorView + TaskEditorView: ~120 lines each replaced with composable calls; duplicate scoped sidebar CSS removed - NotesListView + TasksListView: inline keyboard-nav replaced with composable - NoteViewerView + TaskViewerView: duplicate context-bar CSS removed No behaviour changes. Net: -634 lines, +237 lines across 31 files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import logging
|
||||
from quart import Blueprint, jsonify, request
|
||||
|
||||
from fabledassistant.auth import login_required, get_current_user_id
|
||||
from fabledassistant.routes.utils import not_found
|
||||
from fabledassistant.services.milestones import list_milestones
|
||||
from fabledassistant.services.notes import list_notes
|
||||
from fabledassistant.services.projects import (
|
||||
@@ -52,7 +53,7 @@ async def get_project_route(project_id: int):
|
||||
uid = get_current_user_id()
|
||||
project = await get_project(uid, project_id)
|
||||
if project is None:
|
||||
return jsonify({"error": "Project not found"}), 404
|
||||
return not_found("Project")
|
||||
summary = await get_project_summary(uid, project_id)
|
||||
data = project.to_dict()
|
||||
data["summary"] = summary
|
||||
@@ -68,7 +69,7 @@ async def update_project_route(project_id: int):
|
||||
fields = {k: v for k, v in data.items() if k in allowed}
|
||||
project = await update_project(uid, project_id, **fields)
|
||||
if project is None:
|
||||
return jsonify({"error": "Project not found"}), 404
|
||||
return not_found("Project")
|
||||
return jsonify(project.to_dict())
|
||||
|
||||
|
||||
@@ -78,7 +79,7 @@ async def delete_project_route(project_id: int):
|
||||
uid = get_current_user_id()
|
||||
deleted = await delete_project(uid, project_id)
|
||||
if not deleted:
|
||||
return jsonify({"error": "Project not found"}), 404
|
||||
return not_found("Project")
|
||||
return "", 204
|
||||
|
||||
|
||||
@@ -88,7 +89,7 @@ async def get_project_notes_route(project_id: int):
|
||||
uid = get_current_user_id()
|
||||
project = await get_project(uid, project_id)
|
||||
if project is None:
|
||||
return jsonify({"error": "Project not found"}), 404
|
||||
return not_found("Project")
|
||||
|
||||
# type filter: "note", "task", or None (both)
|
||||
type_filter = request.args.get("type")
|
||||
|
||||
Reference in New Issue
Block a user