```
refactor: 移除审批和回写功能模块 移除了整个审批(approvals)和官方回写(writebacks)功能模块, 包括相关模型、路由、服务和配置项。更新了数据库迁移文件, 删除了相关的审批请求表和官方回写运行表。同时从API路由器中 移除了相应的路由,并调整了安全常量和字段验证器以匹配变更。 ```
This commit is contained in:
@@ -4,10 +4,10 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.core.masking import mask_configured
|
||||
from app.core.security import ApiPrincipal, require_api_key
|
||||
from app.core.security import require_api_key
|
||||
from app.modules.business.constants import BusinessField, BusinessResponseKey
|
||||
from app.modules.business.registry import supported_domain_values
|
||||
from app.modules.business.schemas import DomainListRead, DomainRecordCreate, DomainRecordUpdate
|
||||
from app.modules.business.schemas import DomainListRead
|
||||
from app.modules.business.service import BusinessService
|
||||
|
||||
router = APIRouter(dependencies=[Depends(require_api_key)])
|
||||
@@ -53,49 +53,3 @@ def get_record(
|
||||
}
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=http_status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@router.post("/{domain}")
|
||||
def create_record(
|
||||
domain: str,
|
||||
payload: DomainRecordCreate,
|
||||
db: Session = Depends(get_db),
|
||||
principal: ApiPrincipal = Depends(require_api_key),
|
||||
) -> dict:
|
||||
try:
|
||||
data = BusinessService(db).create_record(
|
||||
domain,
|
||||
payload.data,
|
||||
principal.actor,
|
||||
payload.approval_ticket_id,
|
||||
)
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=http_status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
|
||||
return {
|
||||
BusinessResponseKey.DOMAIN: domain,
|
||||
BusinessResponseKey.DATA: mask_configured(data, domain=domain),
|
||||
}
|
||||
|
||||
|
||||
@router.patch("/{domain}/{record_id}")
|
||||
def update_record(
|
||||
domain: str,
|
||||
record_id: int,
|
||||
payload: DomainRecordUpdate,
|
||||
db: Session = Depends(get_db),
|
||||
principal: ApiPrincipal = Depends(require_api_key),
|
||||
) -> dict:
|
||||
try:
|
||||
data = BusinessService(db).update_record(
|
||||
domain,
|
||||
record_id,
|
||||
payload.data,
|
||||
actor=principal.actor,
|
||||
approval_ticket_id=payload.approval_ticket_id,
|
||||
)
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=http_status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
|
||||
return {
|
||||
BusinessResponseKey.DOMAIN: domain,
|
||||
BusinessResponseKey.DATA: mask_configured(data, domain=domain),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user