From: Michael Tremer Date: Sat, 29 Apr 2023 12:30:19 +0000 (+0000) Subject: builds: Implement filtering by user X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c07aa62ef70f1491c154f9157829fe520b328b04;p=pbs.git builds: Implement filtering by user Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index 12fbdeeb..ea7a91b1 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -138,6 +138,30 @@ class Builds(base.Object): return list(builds) + def get_by_user(self, user, limit=None, offset=None): + """ + Returns builds by a certain user + """ + builds = self._get_builds(""" + SELECT + * + FROM + builds + WHERE + deleted_at IS NULL + AND + owner_id = %s + ORDER BY + created_at DESC + LIMIT + %s + OFFSET + %s + """, user, limit, offset, + ) + + return list(builds) + async def create(self, repo, package, owner=None, group=None): """ Creates a new build based on the given distribution and package diff --git a/src/templates/base.html b/src/templates/base.html index 15a9e67b..5edafb16 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -89,10 +89,12 @@