mirror of
https://github.com/bleak-ai/gcontext.git
synced 2026-08-11 13:19:23 +02:00
Add unpublish endpoint to moderation router
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
061972e91a
commit
9a4ada1614
@@ -76,3 +76,16 @@ def reject(workflow_id: str, session: Session = Depends(get_session)):
|
||||
template.reviewed_at = datetime.now(timezone.utc)
|
||||
session.commit()
|
||||
return {"id": workflow_id, "status": REJECTED}
|
||||
|
||||
|
||||
@router.post("/{workflow_id}/unpublish", dependencies=[Depends(require_admin)])
|
||||
def unpublish(workflow_id: str, session: Session = Depends(get_session)):
|
||||
template = session.scalars(
|
||||
select(Template).where(Template.id == workflow_id, Template.status == APPROVED)
|
||||
).first()
|
||||
if template is None:
|
||||
raise HTTPException(status_code=404, detail="no approved workflow with this id")
|
||||
template.status = REJECTED
|
||||
template.reviewed_at = datetime.now(timezone.utc)
|
||||
session.commit()
|
||||
return {"id": workflow_id, "status": REJECTED}
|
||||
|
||||
Reference in New Issue
Block a user