diff --git a/apps/backend/app/main.py b/apps/backend/app/main.py index ebf4bce3..1a2c6343 100644 --- a/apps/backend/app/main.py +++ b/apps/backend/app/main.py @@ -250,10 +250,10 @@ def root() -> HTMLResponse:
-

Minimal, production-ready API starter.

+

Auth-only backend.

- This service exposes health and auth helpers and includes task/project/bookmark modules - designed to mirror the existing Firebase payload shape in your web app. + This service exposes health and authentication helpers. All tool data lives + on the user's device — the desktop app stores it locally, so there are no CRUD endpoints here.

@@ -264,15 +264,15 @@ def root() -> HTMLResponse:

Auth

-

Verify Firebase ID tokens and fetch current user profile.

+

Verify Firebase ID tokens and fetch the current user profile.

-

Tasks

-

Paginated list, status updates, and export/import parity.

+

Passkeys

+

WebAuthn register/login and credential management.

-

Bookmarks

-

Folders + bookmarks with upsert import and move/delete actions.

+

Health

+

Liveness probe at /api/v1/health.

diff --git a/apps/backend/app/utils/collection_name.py b/apps/backend/app/utils/collection_name.py index 3168dbe3..15e8328d 100644 --- a/apps/backend/app/utils/collection_name.py +++ b/apps/backend/app/utils/collection_name.py @@ -1,28 +1,3 @@ USERS = "users" -TASKS = "tasks" -PROJECTS = "projects" -BOOKMARKS = "bookmarks" -BOOKMARK_FOLDERS = "bookmark_folders" -PASSWORD_VAULTS = "password_Vaults" -PASSWORD_ENTRIES = "password_entries" -ENV_MANAGER_ENTRIES = "environment_manager_entries" -API_KEY_VAULT_ENTRIES = "api_key_vault_entries" -NOTES = "notes" -NOSQL_CONNECTIONS = "mongodb_connections" -USER_PREFERENCES = "user_preferences" -NOSQL_QUERY_HISTORY = "nosql_query_history" -API_CLIENT_COLLECTIONS = "api_client_collections" -API_CLIENT_ENVIRONMENTS = "api_client_environments" -API_CLIENT_HISTORY = "api_client_history" -API_CLIENT_PUBLIC_MOCKS = "api_client_public_mocks" -API_CLIENT_WORKSPACES = "api_client_workspaces" -JSON_FORMATTER_DOCUMENTS = "json_formatter_documents" -CODE_SNIPPETS = "code_snippets" -SQL_CONNECTIONS = "sql_connections" -S3_CONNECTIONS = "s3_connections" -FEEDBACK = "feedback" -REDIS_CONNECTIONS = "redis_connections" AUDIT_LOG = "audit_log" WEBAUTHN_CHALLENGES = "webauthn_challenges" -WORKSPACES = "workspaces" -WORKSPACE_MEMBERSHIPS = "workspace_memberships" diff --git a/apps/backend/app/utils/crud.py b/apps/backend/app/utils/crud.py deleted file mode 100644 index a8d0fad5..00000000 --- a/apps/backend/app/utils/crud.py +++ /dev/null @@ -1,74 +0,0 @@ -"""Tiny CRUD helpers shared by route services. - -Each service still owns its own `_doc_to_out` mapper and cache decorators; these -helpers only collapse the repeating try/except/HTTPException boilerplate around -insert/update/delete. Keeps services readable instead of forcing a generic -base class with many hooks. -""" -from typing import Any - -from fastapi import HTTPException, status -from pymongo import ReturnDocument -from pymongo.errors import PyMongoError - -from app.database import db_manager -from app.utils.utils import is_duplicate_key_error - - -async def safe_insert(collection: str, doc: dict[str, Any], *, name: str) -> None: - """Insert; map duplicate-key → 409, other Mongo errors → 500.""" - try: - await db_manager.insert_one(collection, doc) - except PyMongoError as exc: - if is_duplicate_key_error(exc): - raise HTTPException( - status_code=status.HTTP_409_CONFLICT, - detail=f"{name} id already exists.", - ) from exc - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail=f"Failed to create {name.lower()}.", - ) from exc - - -async def safe_update_one( - collection: str, - query: dict[str, Any], - patch: dict[str, Any], - *, - name: str, -) -> dict[str, Any]: - """Atomic find-and-set; map Mongo errors → 500, missing → 404.""" - try: - doc = await db_manager.find_one_and_update( - collection, - query, - {"$set": patch}, - return_document=ReturnDocument.AFTER, - ) - except PyMongoError as exc: - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail=f"Failed to update {name.lower()}.", - ) from exc - if not doc: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail=f"{name} not found.", - ) - return doc - - -async def safe_delete_one( - collection: str, - query: dict[str, Any], - *, - name: str, -) -> None: - """Delete one; missing → 404.""" - result = await db_manager.delete_one(collection, query) - if result.deleted_count == 0: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail=f"{name} not found.", - )