Skip to content

feat(FastAPI): add /packages (get) search

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

Routing Changes

PHP's implementation of /packages actions all use a form action pointing toward /pkgbase/?, which seems to be modified as different actions and selections are used. This is broken in some cases.

With FastAPI, we point toward POST /packages instead, and allow a POST /packages route to handle the rest.

Main commit; overall summary

    [FastAPI] add /packages (get) search

    In terms of performance, most queries on this page win over
    PHP in query times, with the exception of sorting by Voted or
    Notify. Otherwise, there are a few improvements and modifications.
    That being said, an issue should be created and followed to address
    these performance shortcomings before we can properly swap.

    Modifications:

    * Pagination
        * The `paginate` Python module has been used in the FastAPI
          project
          here to implement paging on the packages search page. This
          changes how pagination is displayed, however it serves the same
          purpose. We'll take advantage of this module in other places as well.
    * Form action
        * The form action for actions now use `POST /packages` to perform
          updates to a list of packages. Previously, PHP was using
          /pkgbase/? and rewriting this action in certain situations.
          Now, we always look toward /packages and allow that to handle
          any redirections that may be needed.
    * Input names and values
        * Input names and values have been modified to satisfy the
          snake_case naming convention we'd like to use as much as
          possible.
        * Some input names and values were modified to comply with
          FastAPI Forms: (IDs[<id>]) -> (IDs, <id>).

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

Merge request reports