Add publisher dashboard routes
This commit is contained in:
parent
96551c2788
commit
e4a5246ab3
31 changed files with 1603 additions and 516 deletions
27
repub/web/publisher/actions.py
Normal file
27
repub/web/publisher/actions.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import Any
|
||||
|
||||
from quart import Quart, Response
|
||||
|
||||
from repub.web.app import run_job_now_response
|
||||
|
||||
RouteGuard = Callable[[Callable[..., Awaitable[Any]]], Callable[..., Awaitable[Any]]]
|
||||
|
||||
|
||||
def register_publisher_actions(
|
||||
app: Quart,
|
||||
*,
|
||||
publisher_required: RouteGuard,
|
||||
admin_required: RouteGuard,
|
||||
) -> None:
|
||||
@app.post("/publisher/actions/jobs/<int:job_id>/run-now")
|
||||
@publisher_required
|
||||
async def publisher_run_job_now_action(job_id: int) -> Response:
|
||||
return run_job_now_response(app, job_id)
|
||||
|
||||
@app.post("/admin/publisher/actions/jobs/<int:job_id>/run-now")
|
||||
@admin_required
|
||||
async def admin_publisher_run_job_now_action(job_id: int) -> Response:
|
||||
return run_job_now_response(app, job_id)
|
||||
Loading…
Add table
Add a link
Reference in a new issue