[Plan] Update application code to use new plan associations and enum identifiers
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
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 (closed))
Scope
Update application code in:
- Models to remove
idusage inPlanmodel andplan_idorhosted_plan_idusage in referencing models - Controllers (Fulfillment, Admin, API)
- Services and business logic
- Background jobs
- GraphQL resolvers
- Queries and scopes
- JiHu-specific implementations
Tasks
-
Models to remove
idusage inPlanmodel andplan_idorhosted_plan_idusage 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/plansand association remove theplan_id app/controllers/admin/plans_controller.rbapp/services/gitlab_subscriptions/app/graphql/resolvers/ee/app/models/gitlab_subscription.rbee/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_idorhosted_plan_idalong withidinPlanmodel
-
no usage of old
- 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: Convert `plans` table to be hard-coded in appli... (&19409)
- Original Issue: #519892 (closed)
- Previous: #571421 (closed)
Edited by 🤖 GitLab Bot 🤖