fc-common: add BuildOutput model; implement CRUD operations
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Iecbe7a5561caf7bf7f770a277b11f3816a6a6964
This commit is contained in:
parent
b1a7233a05
commit
01cd4439aa
6 changed files with 218 additions and 4 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue