Skip to content

Commit

Permalink
couple of annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
ciur committed Oct 17, 2024
1 parent 7bacca0 commit b4f575e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions papermerge/core/routers/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Annotated

from celery.app import default_app as celery_app
from fastapi import APIRouter, Depends, HTTPException, Security, UploadFile
from fastapi import APIRouter, Depends, HTTPException, Query, Security, UploadFile
from pydantic import BaseModel
from sqlalchemy.exc import NoResultFound

Expand All @@ -14,6 +14,16 @@
from papermerge.core.models import Document
from papermerge.core.types import OrderEnum

OrderBy = Annotated[
str | None,
Query(
description="""
Name of custom field e.g. 'Total EUR' (without quotes). Note that
custom field name is case sensitive and may include spaces
"""
),
]

router = APIRouter(
prefix="/documents",
tags=["documents"],
Expand All @@ -32,7 +42,7 @@ def get_documents_by_type(
schemas.User, Security(get_current_user, scopes=[scopes.NODE_VIEW])
],
db_session: db.Session = Depends(db.get_session),
order_by: str | None = None,
order_by: OrderBy = None,
order: OrderEnum = OrderEnum.desc,
) -> list[schemas.DocumentCFV]:
"""
Expand Down

0 comments on commit b4f575e

Please sign in to comment.