Added delete of items.Part 1

This commit is contained in:
alexey
2025-03-17 23:33:47 +03:00
parent e6c5742ea4
commit ecf3d47392
9 changed files with 480 additions and 13 deletions

View File

@@ -326,4 +326,21 @@ class DBase
def get_rpms()
Rpms.order(:id).all
end
def get_builds_for_project(prj_id)
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id join build_rpm as t4 on t4.build_id = t1.id where t1.proj_id = ? group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id", prj_id.to_i].all
end
def get_builds_for_project_git(prj_id, git_id)
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id join build_rpm as t4 on t4.build_id = t1.id where t1.proj_id = ? and t1.repo_id = ? group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id", prj_id.to_i, git_id.to_i].all
end
def get_builds_for_project_git_rpm(prj_id, git_id)
$DDB["select t3.savepath, t3.signpath, t3.sign from buildtask as t1 join build_rpm as t2 on t2.build_id = t1.id join rpms as t3 on t3.id = t2.rpm_id where t1.proj_id = ? and t1.repo_id = ?", prj_id.to_i, git_id.to_i].all
end
def delete_git_from_project(prj_id, git_id)
ReposProjects.where(proj_id: prj_id.to_i, repo_id: git_id.to_i).delete
ProjectsReposSpec.where(proj_id: prj_id.to_i, repo_id: git_id.to_i).delete
end
end