From d8186f7796fbd57c68beafeb53978d3a2d20fc23 Mon Sep 17 00:00:00 2001 From: Magnus Granberg Date: Sun, 3 Mar 2024 08:53:29 +0100 Subject: Add bugsettings to project Signed-off-by: Magnus Granberg --- buildbot_gentoo_ci/db/projects.py | 41 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'buildbot_gentoo_ci/db/projects.py') diff --git a/buildbot_gentoo_ci/db/projects.py b/buildbot_gentoo_ci/db/projects.py index 7ffac97..23cabde 100644 --- a/buildbot_gentoo_ci/db/projects.py +++ b/buildbot_gentoo_ci/db/projects.py @@ -79,6 +79,21 @@ class ProjectsConnectorComponent(base.DBConnectorComponent): res = yield self.db.pool.do(thd) return res + @defer.inlineCallbacks + def getRepositorySettingByProjUuidAndRepoUuid(self, project_uuid, repository_uuid): + def thd(conn): + tbl = self.db.model.projects_repositorys + q = tbl.select() + q = q.where(tbl.c.project_uuid == project_uuid) + q = q.where(tbl.c.repository_uuid == repository_uuid) + res = conn.execute(q) + row = res.fetchone() + if not row: + return None + return self._row2dict_projects_repositorys(conn, row) + res = yield self.db.pool.do(thd) + return res + @defer.inlineCallbacks def getRepositorysByProjectUuid(self, uuid, auto=True): def thd(conn): @@ -212,6 +227,20 @@ class ProjectsConnectorComponent(base.DBConnectorComponent): res = yield self.db.pool.do(thd) return res + @defer.inlineCallbacks + def getBugsSettingsByProjectUuid(self, uuid): + def thd(conn): + tbl = self.db.model.projects_bugs + q = tbl.select() + q = q.where(tbl.c.project_uuid == uuid) + res = conn.execute(q) + row = res.fetchone() + if not row: + return None + return self._row2dict_projects_bugs(conn, row) + res = yield self.db.pool.do(thd) + return res + def _row2dict(self, conn, row): return dict( uuid=row.uuid, @@ -243,7 +272,8 @@ class ProjectsConnectorComponent(base.DBConnectorComponent): pkgcheck=pkgcheck, build=row.build, test=row.test, - test_mr=row.test_mr + test_mr=row.test_mr, + bug=row.bug ) def _row2dict_projects_workers(self, conn, row): @@ -312,3 +342,12 @@ class ProjectsConnectorComponent(base.DBConnectorComponent): status=row.status, type=row.type ) + + def _row2dict_projects_bugs(self, conn, row): + return dict( + id=row.id, + project_uuid=row.project_uuid, + enabled=row.enabled, + auto_assigne=row.auto_assigne, + extra_summery=row.extra_summery + ) -- cgit v1.2.3-65-gdbad