pub async fn would_orphan_developers(
db: &Db,
user_id: i64,
new_role: Option<Role>,
) -> Result<bool>Expand description
Would the proposed change leave the system with zero active Developers?
new_role:
None→ user is being deleted entirely.Some(role)→ user’s role is being changed torole.
Returns true only when:
- exactly one active Developer exists, AND
- the target user IS that Developer, AND
- the action would remove their Developer status.
Used as a server-side guard in user-edit / user-delete handlers, and as a CLI warning before destructive role changes.