Loading
Add #empty? check to Organizations::Organization
What does this MR do?
Adds Organizations::Organization#empty? predicate: returns true when the organization has no groups and no projects. Intentionally extensible — as org-level entities are introduced, they can add themselves to this check.
Notes:
- We might want to extend the implementation of
Organizations::Organization#empty?to include more sub-resources checks in the future, see Extend `Organizations::Organization#empty?` to ... (#596537) - Tests were added for the
.activescope, which is generated automatically by theenumdefined inOrganizations::Stateful(introduced in Add Organizations::Stateful concern with state ... (!230909 - merged) • Rémy Coutable • 19.0)
Queries
> Organizations::Organization.active.explain
Organizations::Organization Load (7.9ms) SELECT "organizations".* FROM "organizations" WHERE "organizations"."state" = 0
=> EXPLAIN SELECT "organizations".* FROM "organizations" WHERE "organizations"."state" = 0
QUERY PLAN
---------------------------------------------------------------------------------------------------
Index Scan using index_organizations_on_state on organizations (cost=0.15..5.24 rows=5 width=42)
Index Cond: (state = 0)
(2 rows)Related
- Implements Add `#empty?` check to `Organizations::Organiza... (#594307 - closed) • Rémy Coutable • 19.0
- Blocks Add state filtering to OrganizationsFinder, hid... (#594312 - closed) • Rémy Coutable • 19.1 • On track and Add Organizations::MarkForDeletionService for s... (#594308 - closed) • Rémy Coutable • 19.0
Edited by Ahmed Hemdan