32 lines
815 B
Python
32 lines
815 B
Python
import uuid
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.core.deps import get_db_session, get_current_user, require_study_member
|
|
from app.schemas.notification import NotificationItem
|
|
from app.services import document_service
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get(
|
|
"/notifications",
|
|
response_model=list[NotificationItem],
|
|
dependencies=[Depends(require_study_member())],
|
|
)
|
|
async def list_notifications(
|
|
study_id: uuid.UUID,
|
|
skip: int = 0,
|
|
limit: int = 20,
|
|
db: AsyncSession = Depends(get_db_session),
|
|
current_user=Depends(get_current_user),
|
|
) -> list[NotificationItem]:
|
|
return await document_service.list_distribution_notifications(
|
|
db,
|
|
study_id,
|
|
current_user,
|
|
skip=skip,
|
|
limit=limit,
|
|
)
|