Refactor file & module names to use RepositoryRule

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Context

Resolve discussion raised by @adie.po in Update REST & GraphQL APIs for protected contai... (!174642 - merged)

aligning the module names and file names to reflect the changes as well.

  • module Rule to module RepositoryRule
  • container_registry/protection/rule/* to container_registry/protection/repository_rule/*

Files to be refactored

Frontend files have been refactored in Rename filenames for container protection repos... (!176751 - merged) so. the remaining backend changes need to be updated:

1. Model Files

Current: app/models/container_registry/protection/rule.rb Target: app/models/container_registry/protection/repository_rule.rb

  • Change module name from Rule to RepositoryRule
  • Update class name from Rule to RepositoryRule

2. Service Files

Current Directory: app/services/container_registry/protection/ Target Directory: app/services/container_registry/protection/repository_rule/

Files to move and refactor:

  • create_rule_service.rbcreate_repository_rule_service.rb
  • update_rule_service.rbupdate_repository_rule_service.rb
  • delete_rule_service.rbdelete_repository_rule_service.rb

3. Spec Files

Current: spec/models/container_registry/protection/rule_spec.rb Target: spec/models/container_registry/protection/repository_rule_spec.rb

Additional spec files that may need updates:

  • Service specs for the renamed service classes
  • Any GraphQL mutation specs
  • API specs that reference the model

4. API Files

Current: lib/api/project_container_registry_protection_rules.rb

  • Update references to the model class
  • Update service class references

5. Database Migration

  • Create a migration to rename the database table from container_registry_protection_rules to container_registry_protection_repository_rules
  • Update foreign key references and indexes
Edited by 🤖 GitLab Bot 🤖