api docs cleanup + readd webhooks: (#1949)

- readd webhooks (regression from #1941)
- set order of tags in docs
- add missing tag to route
This commit is contained in:
Ilya Kreymer 2024-07-22 09:00:59 -07:00 committed by GitHub
parent cd00f52cca
commit cb909ffc95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 2 deletions

View File

@ -531,7 +531,9 @@ def init_background_jobs_api(
"""Retry background job"""
return await ops.retry_background_job(job_id, org)
@app.post("/orgs/all/jobs/retryFailed", response_model=SuccessResponse)
@app.post(
"/orgs/all/jobs/retryFailed", response_model=SuccessResponse, tags=["jobs"]
)
async def retry_all_failed_background_jobs(user: User = Depends(user_dep)):
"""Retry failed background jobs from all orgs"""
if not user.is_superuser:

View File

@ -48,6 +48,26 @@ app_root = FastAPI(docs_url=None, redoc_url=None, OPENAPI_URL=OPENAPI_URL)
db_inited = {"inited": False}
tags = [
"crawlconfigs",
"crawls",
"settings",
"auth",
"users",
"organizations",
"profiles",
"uploads",
"all-crawls",
"qa",
"pages",
"collections",
"webhooks",
"jobs",
"invites",
"subscriptions",
]
# ============================================================================
def make_schema():
"""make custom openapi schema"""
@ -71,6 +91,8 @@ See [https://docs.browsertrix.com/](https://docs.browsertrix.com/) for more info
"url": "https://www.gnu.org/licenses/agpl-3.0.en.html",
},
routes=app_root.routes,
webhooks=app_root.webhooks.routes,
tags=[{"name": tag} for tag in tags],
)
schema["info"]["x-logo"] = {"url": "/docs-logo.svg"}
return schema
@ -223,7 +245,7 @@ def main():
app.include_router(org_ops.router)
@app.get("/settings")
@app.get("/settings", tags=["settings"])
async def get_settings():
if not db_inited.get("inited"):
raise HTTPException(status_code=503, detail="not_ready_yet")