mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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:
parent
a77d44e919
commit
a1f46611e1
10 changed files with 218 additions and 195 deletions
0
aurweb/requests/__init__.py
Normal file
0
aurweb/requests/__init__.py
Normal file
13
aurweb/requests/util.py
Normal file
13
aurweb/requests/util.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
from http import HTTPStatus
|
||||
|
||||
from fastapi import HTTPException
|
||||
|
||||
from aurweb import db
|
||||
from aurweb.models import PackageRequest
|
||||
|
||||
|
||||
def get_pkgreq_by_id(id: int) -> PackageRequest:
|
||||
pkgreq = db.query(PackageRequest).filter(PackageRequest.ID == id).first()
|
||||
if not pkgreq:
|
||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
||||
return db.refresh(pkgreq)
|
Loading…
Add table
Add a link
Reference in a new issue