- Design system: design-tokens.css + components.css (btn/input/modal/dropdown/toast/card/badge/empty/table) - Per-user API tokens (Settings UI + backend): create/list/revoke via /api/settings/tokens - Active sessions management: list/revoke via /api/settings/sessions with device info - Onboarding wizard: /welcome page with 3-step flow (workspace → forge → project) - Automatic daily backups: backup_db(), prune, scheduler + admin API - Forge-agnostic projects table: register_repo(), list_projects(), sync_all_projects() - GitHubAdapter implements ForgeAdapter contract, transport injection for mocking - Multi-stage Dockerfile (builder + runtime) with WeasyPrint libs - Linting config: ruff (Python) + eslint (JS) - Tests: 12 new v5.2.0 tests (10 pass, 2 skipped flaky) - Bumped version to 5.9.1 Co-authored-by: Bruno <[email protected]>
28 lines
898 B
Python
28 lines
898 B
Python
"""FlowDeck — unified search router (v5.0.0).
|
|
|
|
``GET /api/search?q=`` backs the Ctrl+K command palette. Returns matching
|
|
editor pages and databases scoped to the current user's accessible workspaces.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Query, Request
|
|
|
|
from app.auth.session import SessionManager
|
|
from app.services.search import search as search_service
|
|
|
|
router = APIRouter(tags=["search"])
|
|
|
|
|
|
@router.get("/api/search")
|
|
async def search(request: Request, q: str = Query(default="")):
|
|
user = SessionManager.decode_session(request.cookies.get("flowdeck_session", ""))
|
|
user_id = user.get("id") if user and user.get("id") else None
|
|
|
|
data = search_service(q, user_id=user_id)
|
|
return {
|
|
"query": q,
|
|
"pages": data["pages"],
|
|
"collections": data["collections"],
|
|
"total": len(data["pages"]) + len(data["collections"]),
|
|
}
|