Manim-Agent / backend /api /access.py
github-actions[bot]
[API] Cuong2004/Manim-Agent @ 1d7c417 (run 25583057312)
9bed109
raw
history blame contribute delete
627 Bytes
from __future__ import annotations
from uuid import UUID
from fastapi import HTTPException, status
from shared.schemas.project import Project
from backend.db.base import ContentStore
def project_readable_by_user(
store: ContentStore,
project_id: UUID,
user_id: UUID,
) -> Project:
"""Return the project if it exists and is owned by user_id; otherwise 404."""
project = store.get_project(project_id)
if project is None or project.user_id != user_id:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="Project not found",
)
return project