feat(backend): notes list across chats with the message and chat they belong to, filter by tag, tag counts

This commit is contained in:
hh committed 2026-10-19 05:25:44 +00:00
1 parent 97f9082f5e
commit a0e134756c
2 files changed
+93 -2

No files matched your search

+21 -1
View File
@@ -6,7 +6,7 @@ from fastapi import APIRouter, HTTPException, Query
from pydantic import BaseModel
from utils.read import annotations
from utils.read.models import DEFAULT_LIMIT, AnnotationView, Page
from utils.read.models import DEFAULT_LIMIT, AnnotationView, NoteTag, NoteView, Page
router = APIRouter(
prefix="/api/annotations", tags=["annotations"], route_class=DishkaRoute
@@ -42,6 +42,26 @@ async def list_annotations(
)
@router.get("/notes")
async def list_notes(
pool: FromDishka[asyncpg.Pool],
account_id: Annotated[int, Query()],
tag: Annotated[str | None, Query()] = None,
limit: Annotated[int, Query()] = DEFAULT_LIMIT,
offset: Annotated[int, Query()] = 0,
) -> list[NoteView]:
return await annotations.list_notes(
pool, account_id, Page(limit=limit, offset=offset), tag=tag
)
@router.get("/tags")
async def list_tags(
pool: FromDishka[asyncpg.Pool], account_id: Annotated[int, Query()]
) -> list[NoteTag]:
return await annotations.list_tags(pool, account_id)
@router.post("", status_code=201)
async def create_annotation(
pool: FromDishka[asyncpg.Pool], body: AnnotationCreate