管理后台前后端逻辑、UI美化

This commit is contained in:
Cheng Zhou
2026-01-16 13:50:08 +08:00
parent 05c1f9579a
commit 7fdcfdaadd
82 changed files with 3210 additions and 549 deletions
+24
View File
@@ -115,3 +115,27 @@ def require_study_roles(roles: Iterable[str]):
return current_user
return dependency
def require_study_not_locked():
"""检查项目是否被锁定,如果锁定则拒绝所有修改请求"""
from app.crud import study as study_crud
async def dependency(
study_id: uuid.UUID,
db: AsyncSession = Depends(get_db_session),
):
study = await study_crud.get(db, study_id)
if not study:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="项目不存在",
)
if study.is_locked:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="项目已锁定,无法进行任何修改操作",
)
return study
return dependency