全局中文化

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
+7 -7
View File
@@ -15,7 +15,7 @@ router = APIRouter()
async def _ensure_study_exists(db: AsyncSession, study_id: uuid.UUID):
study = await study_crud.get(db, study_id)
if not study:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Study not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="项目不存在")
return study
@@ -39,7 +39,7 @@ async def create_note(
entity_type="knowledge_note",
entity_id=note.id,
action="CREATE_KNOWLEDGE_NOTE",
detail=f"Knowledge note {note.title} created",
detail=f"注意事项 {note.title} 已创建",
operator_id=current_user.id,
operator_role=current_user.role,
)
@@ -77,7 +77,7 @@ async def get_note(
await _ensure_study_exists(db, study_id)
note = await note_crud.get_note(db, note_id)
if not note or note.study_id != study_id:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Note not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="注意事项不存在")
return KnowledgeNoteRead.model_validate(note)
@@ -96,7 +96,7 @@ async def update_note(
await _ensure_study_exists(db, study_id)
note = await note_crud.get_note(db, note_id)
if not note or note.study_id != study_id:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Note not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="注意事项不存在")
note = await note_crud.update_note(db, note, note_in)
await audit_crud.log_action(
db,
@@ -104,7 +104,7 @@ async def update_note(
entity_type="knowledge_note",
entity_id=note_id,
action="UPDATE_KNOWLEDGE_NOTE",
detail=f"Knowledge note {note_id} updated",
detail=f"注意事项 {note_id} 已更新",
operator_id=current_user.id,
operator_role=current_user.role,
)
@@ -125,7 +125,7 @@ async def delete_note(
await _ensure_study_exists(db, study_id)
note = await note_crud.get_note(db, note_id)
if not note or note.study_id != study_id:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Note not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="注意事项不存在")
await note_crud.delete_note(db, note)
await audit_crud.log_action(
db,
@@ -133,7 +133,7 @@ async def delete_note(
entity_type="knowledge_note",
entity_id=note_id,
action="DELETE_KNOWLEDGE_NOTE",
detail=f"Knowledge note {note_id} deleted",
detail=f"注意事项 {note_id} 已删除",
operator_id=current_user.id,
operator_role=current_user.role,
)