Skip to content

Add unified sortUsing() method to simplify sorting logic - #478

Merged
arukompas merged 1 commit into
mainfrom
refactor/unified-sorting-method
Oct 17, 2025
Merged

Add unified sortUsing() method to simplify sorting logic#478
arukompas merged 1 commit into
mainfrom
refactor/unified-sorting-method

Conversation

@arukompas

Copy link
Copy Markdown
Contributor

Summary

  • Introduces unified sortUsing(SortingMethod, SortingOrder) method to both LogFileCollection and LogFolderCollection
  • Simplifies controller sorting logic from ~30 lines of nested if/else to single-line calls
  • All existing sorting methods remain and delegate to the new method (backwards compatible)
  • Controllers updated to use new simplified API

Changes

  • LogFileCollection: Added sortUsing() method, refactored existing methods to use it
  • LogFolderCollection: Added sortUsing() method, refactored existing methods to use it
  • FilesController: Simplified sorting logic (lines 21-34 → line 21)
  • FoldersController: Simplified sorting logic (lines 26-56 → lines 26-28)
  • Tests: Added 8 new tests for sortUsing() method

Test plan

  • All 281 existing tests pass
  • 8 new unit tests added for sortUsing() method
  • No breaking changes - all existing public methods remain functional
  • Code formatted with Laravel Pint

Simplifies controller sorting logic by introducing a unified
sortUsing(method, order) method. Existing sorting methods
now delegate to this new method. No breaking changes.
@arukompas arukompas self-assigned this Oct 17, 2025
@arukompas
arukompas changed the base branch from refactor/remove-redundant-file-sorting to main October 17, 2025 07:51
@arukompas arukompas closed this Oct 17, 2025
@arukompas arukompas reopened this Oct 17, 2025
@arukompas
arukompas merged commit 3d04bda into main Oct 17, 2025
27 checks passed
@arukompas
arukompas deleted the refactor/unified-sorting-method branch October 18, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant