feat: 统一生产初始化流程并保护系统管理员
This commit is contained in:
@@ -107,6 +107,7 @@ async def delete(db: AsyncSession, study_id: uuid.UUID) -> None:
|
||||
from app.models.finance_contract import FinanceContract
|
||||
from app.models.finance_special import FinanceSpecial
|
||||
from app.models.contract_fee import ContractFee
|
||||
from app.models.contract_fee_payment import ContractFeePayment
|
||||
from app.models.special_expense import SpecialExpense
|
||||
from app.models.milestone import Milestone
|
||||
from app.models.document import Document
|
||||
@@ -157,6 +158,13 @@ async def delete(db: AsyncSession, study_id: uuid.UUID) -> None:
|
||||
|
||||
# 9. 删除财务相关
|
||||
await db.execute(sa_delete(SpecialExpense).where(SpecialExpense.project_id == study_id))
|
||||
await db.execute(
|
||||
sa_delete(ContractFeePayment).where(
|
||||
ContractFeePayment.contract_fee_id.in_(
|
||||
select(ContractFee.id).where(ContractFee.project_id == study_id)
|
||||
)
|
||||
)
|
||||
)
|
||||
await db.execute(sa_delete(ContractFee).where(ContractFee.project_id == study_id))
|
||||
await db.execute(sa_delete(FinanceSpecial).where(FinanceSpecial.study_id == study_id))
|
||||
await db.execute(sa_delete(FinanceContract).where(FinanceContract.study_id == study_id))
|
||||
|
||||
Reference in New Issue
Block a user