refactor: remove db.commit() from business services, callers use UnitOfWork (Tier 3)
This commit is contained in:
@@ -10,6 +10,7 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.database import get_db
|
||||
from app.dependencies.auth import get_current_user, require_any_role
|
||||
from app.domain.unit_of_work import UnitOfWork
|
||||
from app.models.user import User
|
||||
from app.services.osint_enrichment_service import (
|
||||
enrich_technique_with_cves,
|
||||
@@ -82,12 +83,14 @@ def review_osint_item(
|
||||
user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Mark an OSINT item as reviewed."""
|
||||
item = mark_osint_reviewed(db, str(item_id))
|
||||
if not item:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="OSINT item not found",
|
||||
)
|
||||
with UnitOfWork(db) as uow:
|
||||
item = mark_osint_reviewed(db, str(item_id))
|
||||
if not item:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="OSINT item not found",
|
||||
)
|
||||
uow.commit()
|
||||
return {"id": str(item.id), "reviewed": True}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user