Complete publish preview Phase 2A with retention, refresh and cache consistency
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from uuid import uuid4
|
||||
|
||||
from sqlalchemy import asc, desc, select
|
||||
from sqlalchemy import asc, delete, desc, select
|
||||
|
||||
from app.db.session import AsyncSessionLocal
|
||||
from app.models.scheme_artifact import SchemeArtifactRecord
|
||||
@@ -99,3 +99,16 @@ async def get_latest_scheme_artifact(
|
||||
|
||||
result = await session.execute(stmt)
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
|
||||
async def delete_scheme_artifacts_by_artifact_ids(artifact_ids: list[str]) -> int:
|
||||
if not artifact_ids:
|
||||
return 0
|
||||
|
||||
async with AsyncSessionLocal() as session:
|
||||
stmt = delete(SchemeArtifactRecord).where(
|
||||
SchemeArtifactRecord.artifact_id.in_(artifact_ids)
|
||||
)
|
||||
result = await session.execute(stmt)
|
||||
await session.commit()
|
||||
return int(result.rowcount or 0)
|
||||
|
||||
Reference in New Issue
Block a user