Function update_org

Source
pub async fn update_org(pool: &Pool<MySql>, id: i64, name: &str) -> Result<Org>
Expand description

Updates an existing organization’s information.

This function modifies an organization record with the provided name. It also updates the updated_at timestamp to reflect the modification time.

§Arguments

  • pool - Database connection pool for executing the query
  • id - Unique identifier of the organization to update
  • name - New name for the organization

§Returns

  • Ok(Org) - Successfully updated organization record
  • Err(anyhow::Error) - Failed to update organization

§Transaction Handling

This function uses a database transaction to ensure atomicity of the operation. If any part of the operation fails, the entire operation is rolled back.

§Error Handling

Returns an error if no organization with the given ID exists or if a database error occurs during the update operation.