feat: publish approved RF4 media catalog
This commit is contained in:
@@ -136,6 +136,27 @@ def reconcile_queued_duplicates(path: Path) -> dict:
|
||||
return {"duplicates": duplicates, "queued": sum(item.get("status") == "queued" for item in manifest.get("assets", []))}
|
||||
|
||||
|
||||
def approve_stored_assets(path: Path, *, note: str) -> dict:
|
||||
"""Publish every stored asset after an explicit owner-level approval."""
|
||||
manifest = json.loads(path.read_text(encoding="utf-8"))
|
||||
reviewed_at = datetime.now(timezone.utc).isoformat()
|
||||
approved = 0
|
||||
for item in manifest.get("assets", []):
|
||||
if item.get("status") != "stored":
|
||||
continue
|
||||
stable_id = item.get("external_id") or item.get("sha256") or hashlib.sha256(item["asset_url"].encode()).hexdigest()
|
||||
item.update({
|
||||
"status": "approved",
|
||||
"entity_key": f"{item.get('entity_type', 'reference')}:{stable_id}",
|
||||
"reviewed_at": reviewed_at,
|
||||
"review_note": note,
|
||||
})
|
||||
approved += 1
|
||||
manifest["updated_at"] = reviewed_at
|
||||
path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
return {"approved": approved}
|
||||
|
||||
|
||||
def reclassify_manifest(path: Path) -> dict:
|
||||
manifest = json.loads(path.read_text(encoding="utf-8"))
|
||||
for item in manifest.get("assets", []):
|
||||
|
||||
Reference in New Issue
Block a user