全局中文化

This commit is contained in:
Cheng Zhou
2026-01-12 11:14:04 +08:00
parent 9021c7fe2b
commit 1338fa7e2b
103 changed files with 2443 additions and 1533 deletions
+2 -2
View File
@@ -23,12 +23,12 @@ async def _validate_site_subject(db: AsyncSession, study_id: uuid.UUID, site_id:
result = await db.execute(select(Site).where(Site.id == site_id))
site = result.scalar_one_or_none()
if not site or site.study_id != study_id:
raise ValueError("Site not found in study")
raise ValueError("分中心不属于当前项目")
if subject_id:
result = await db.execute(select(Subject).where(Subject.id == subject_id))
subj = result.scalar_one_or_none()
if not subj or subj.study_id != study_id:
raise ValueError("Subject not found in study")
raise ValueError("受试者不属于当前项目")
async def create_ae(
+2 -2
View File
@@ -13,11 +13,11 @@ async def create_item(db: AsyncSession, item_in: FaqCreate, *, created_by: uuid.
# ensure category exists and matches study scope
category = await db.get(FaqCategory, item_in.category_id)
if not category:
raise ValueError("Category not found")
raise ValueError("分类不存在")
if category.study_id != item_in.study_id:
# allow global category if item is global (None) or project if matches
if not (category.study_id is None and item_in.study_id is None):
raise ValueError("Category scope mismatch")
raise ValueError("分类范围不匹配")
item = FaqItem(
study_id=item_in.study_id,
+1 -1
View File
@@ -15,7 +15,7 @@ async def _validate_site(db: AsyncSession, study_id: uuid.UUID, site_id: uuid.UU
result = await db.execute(select(Site).where(Site.id == site_id))
site = result.scalar_one_or_none()
if not site or site.study_id != study_id:
raise ValueError("Site not found in study")
raise ValueError("分中心不属于当前项目")
async def create_subject(db: AsyncSession, study_id: uuid.UUID, subject_in: SubjectCreate) -> Subject:
+1 -1
View File
@@ -13,7 +13,7 @@ async def _ensure_subject(db: AsyncSession, study_id: uuid.UUID, subject_id: uui
result = await db.execute(select(Subject).where(Subject.id == subject_id))
subject = result.scalar_one_or_none()
if not subject or subject.study_id != study_id:
raise ValueError("Subject not found in study")
raise ValueError("受试者不属于当前项目")
async def create_history(