信息架构/菜单框架大重构-20260109
This commit is contained in:
@@ -57,12 +57,15 @@ async def list_subjects(
|
||||
study_id: uuid.UUID,
|
||||
site_id: uuid.UUID | None = None,
|
||||
status: str | None = None,
|
||||
subject_no: str | None = None,
|
||||
) -> Sequence[Subject]:
|
||||
stmt = select(Subject).where(Subject.study_id == study_id)
|
||||
if site_id:
|
||||
stmt = stmt.where(Subject.site_id == site_id)
|
||||
if status:
|
||||
stmt = stmt.where(Subject.status == status)
|
||||
if subject_no:
|
||||
stmt = stmt.where(Subject.subject_no.ilike(f"%{subject_no}%"))
|
||||
result = await db.execute(stmt)
|
||||
return result.scalars().all()
|
||||
|
||||
@@ -102,3 +105,8 @@ async def update_subject(db: AsyncSession, subject: Subject, subject_in: Subject
|
||||
await db.commit()
|
||||
await db.refresh(subject)
|
||||
return subject
|
||||
|
||||
|
||||
async def delete_subject(db: AsyncSession, subject: Subject) -> None:
|
||||
await db.delete(subject)
|
||||
await db.commit()
|
||||
|
||||
Reference in New Issue
Block a user