Skip to content

feat(FastAPI): added /requests (get) route

Kevin Morris requested to merge kevr/aurweb:pu_requests into pu

Notes

There is a feature request to allow users to delete their own requests: #20 (closed). The GET /requests route here has been modified to be accessible by all authenticated users, but only showing requests and request actions which they are able to perform (for non-TUs: Close).

This commit implements 1/2 of #20 (closed). The other 1/2 will need to be implemented when /requests/{id}/close is implemented.

Closes #14 (closed) for FastAPI.

Main commit

    feat(FastAPI): added /requests (get) route

    Introduces `aurweb.defaults` and `aurweb.filters`.

    `aurweb.filters` is a location developers can put their additional
    Jinja2 filters and/or functions. We should slowly move all of our
    filters over here, where it makes sense.

    `aurweb.defaults` is a new module which hosts some default constants
    and utility functions, starting with offsets (O) and per page values
    (PP).

    As far as the new GET /requests is concerned, we match up here to
    PHP's implementation, with some minor improvements:

    Improvements:

    * PP on this page is now configurable: 50 (default), 100, or 250.
        * Example: `https://localhost:8444/requests?PP=250`

    Modifications:

    * The pagination is a bit different, but serves the exact same purpose.
    * "Last" no longer goes to an empty page.
        * Closes: https://gitlab.archlinux.org/archlinux/aurweb/-/issues/14

    Signed-off-by: Kevin Morris <kevr@0cost.org>
Edited by Kevin Morris

Merge request reports

Loading