change(python): move request & pkgbase request routes

Move package request routes and related routes to their
respective routers. In addition, move some utility used
for requests over from `aurweb.packages`.

Introduced routers:
- `aurweb.routers.requests`

Introduced package:
- `aurweb.requests`

Introduced module:
- `aurweb.requests.util`

Changes:
- Moved `aurweb.packages.validate` to `aurweb.pkgbase.validate`
- Moved requests listing & request closure routes to
  `aurweb.routers.requests`
- Moved pkgbase request creation route to `aurweb.routers.pkgbase`
- Moved `get_pkgreq_by_id` from `aurweb.packages.util` to
  `aurweb.requests.util` and fixed its return type hint.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-02 00:54:56 -08:00
parent a77d44e919
commit a1f46611e1
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
10 changed files with 218 additions and 195 deletions

View file

@ -21,7 +21,7 @@ from aurweb.auth import BasicAuthBackend
from aurweb.db import get_engine, query
from aurweb.models import AcceptedTerm, Term
from aurweb.prometheus import http_api_requests_total, http_requests_total, instrumentator
from aurweb.routers import accounts, auth, html, packages, pkgbase, rpc, rss, sso, trusted_user
from aurweb.routers import accounts, auth, html, packages, pkgbase, requests, rpc, rss, sso, trusted_user
from aurweb.templates import make_context, render_template
# Setup the FastAPI app.
@ -82,6 +82,7 @@ async def app_startup():
app.include_router(rss.router)
app.include_router(packages.router)
app.include_router(pkgbase.router)
app.include_router(requests.router)
app.include_router(rpc.router)
# Initialize the database engine and ORM.