[Plan] Update application code to use new plan associations and enum identifiers
## Objective Update models, controllers, services, and business logic throughout the application to use the new plan associations and enum identifiers exclusively. Remove the usage of old `plan_id` and association from the codebase. ## Prerequisites - [ ] Plan model associations updated (#571421) ## Scope Update application code in: - Models to remove `id` usage in `Plan` model and `plan_id` or `hosted_plan_id` usage in referencing models - [Loose foreign keys](https://gitlab.com/gitlab-org/gitlab/-/blob/1ac1326a56e05037ffaceff75b6ca8d2cd6732b5/config/gitlab_loose_foreign_keys.yml#L1) - Controllers (Fulfillment, Admin, API) - Services and business logic - Background jobs - GraphQL resolvers - Queries and scopes - JiHu-specific implementations ## Tasks - [ ] Models to remove `id` usage in `Plan` model and `plan_id` or `hosted_plan_id` usage in referencing models - [ ] Audit and update controllers using plan relationships - [ ] Update services and business logic classes - [ ] Update GraphQL resolvers and mutations - [ ] Update background jobs that reference plans - [ ] Update queries to use new foreign keys - [ ] Update scopes and finder methods - [ ] Handle JiHu-specific code changes - [ ] Update API endpoints and serializers - [ ] Update admin interfaces - [ ] Update any hardcoded plan ID references to use enum values ## Code Areas to Update Based on analysis, likely areas include: - `app/models/plans` and association remove the `plan_id` - `app/controllers/admin/plans_controller.rb` - `app/services/gitlab_subscriptions/` - `app/graphql/resolvers/` - `ee/app/models/gitlab_subscription.rb` - `ee/app/services/` - Background job classes - API serializers ## Testing Strategy - [ ] Update model tests - [ ] Update controller tests - [ ] Update service tests - [ ] Update GraphQL tests - [ ] Update integration tests - [ ] Add tests for enum usage - [ ] Validate API responses ## Acceptance Criteria - [ ] All models use new plan associations exclusively * [ ] no usage of old `plan_id` or `hosted_plan_id` along with `id` in `Plan` model - [ ] All controllers use new plan associations - [ ] All services use enum identifiers - [ ] GraphQL resolvers updated - [ ] Background jobs updated - [ ] All tests pass - [ ] JiHu-specific code updated - [ ] API responses remain consistent - [ ] No performance regressions ## References - Parent Epic: https://gitlab.com/groups/gitlab-org/-/epics/19409+ - Original Issue: #519892 - Previous: #571421
issue