pub async fn delete_org(pool: &Pool<MySql>, id: i64) -> Result<()>
Expand description
Deletes an organization from the system.
This function permanently removes an organization record from the database. It should be used with caution, as it typically has significant implications for associated data and user access.
§Arguments
pool
- Database connection pool for executing the queryid
- Unique identifier of the organization to delete
§Returns
Ok(())
- Successfully deleted the organizationErr(anyhow::Error)
- Failed to delete the organization
§Warning
This operation is irreversible. Consider the implications before deleting organizations, especially those with active users or resources.
§Important
This function only deletes the organization record itself. It does not cascade delete related records such as organization members, applications, or other resources associated with the organization. Consider implementing cascading delete logic or foreign key constraints if needed.
§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.