pub async fn would_orphan_developers(
db: &Db,
user_id: i64,
new_role: Option<Role>,
) -> Result<bool>Expand description
Phase 7a/0.5/f — 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 (deletion or demotion to anything other than Developer).
Used as a server-side guard in do_user_edit and do_user_delete,
and as a CLI warning before destructive role changes.