feat(server): allow filtering of builds per repo

This commit is contained in:
Jef Roosens 2022-05-07 15:31:01 +02:00
parent 7e01dbafec
commit 393e641a76
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
2 changed files with 22 additions and 6 deletions

View file

@ -4,7 +4,7 @@ import time
pub struct BuildLog {
id int [primary; sql: serial]
repo GitRepo [nonull]
repo_id int [nonull]
start_time time.Time [nonull]
end_time time.Time [nonull]
exit_code int [nonull]
@ -19,6 +19,16 @@ pub fn (db &VieterDb) get_build_logs() []BuildLog {
return res
}
// get_build_logs_for_repo returns all BuildLog's in the database for a given
// repo.
pub fn (db &VieterDb) get_build_logs_for_repo(repo_id int) []BuildLog {
res := sql db.conn {
select from BuildLog where repo_id == repo_id order by id
}
return res
}
// get_build_log tries to return a specific BuildLog.
pub fn (db &VieterDb) get_build_log(id int) ?BuildLog {
res := sql db.conn {