fc-common: add BuildOutput model; implement CRUD operations

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Iecbe7a5561caf7bf7f770a277b11f3816a6a6964
This commit is contained in:
raf 2026-02-28 21:33:11 +03:00
commit 01cd4439aa
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
6 changed files with 218 additions and 4 deletions

View file

@ -512,3 +512,21 @@ pub async fn set_builder(
.map_err(CiError::Database)?;
Ok(())
}
/// Delete a build by ID.
///
/// # Errors
///
/// Returns error if database query fails or build not found.
pub async fn delete(pool: &PgPool, id: Uuid) -> Result<()> {
let result = sqlx::query("DELETE FROM builds WHERE id = $1")
.bind(id)
.execute(pool)
.await?;
if result.rows_affected() == 0 {
return Err(CiError::NotFound(format!("Build {id} not found")));
}
Ok(())
}