refac/security: python code format endpoint

This commit is contained in:
Timothy Jaeryang Baek
2025-06-08 20:26:07 +04:00
parent 87e5aee106
commit 4fe45d4430
3 changed files with 77 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ class CodeForm(BaseModel):
@router.post("/code/format")
async def format_code(form_data: CodeForm, user=Depends(get_verified_user)):
async def format_code(form_data: CodeForm, user=Depends(get_admin_user)):
try:
formatted_code = black.format_str(form_data.code, mode=black.Mode())
return {"code": formatted_code}