Skip to content

Extract Duplicate Sort Logic #16

@caleb-vanlue

Description

@caleb-vanlue

Sort field mapping logic is duplicated between CollectionService.mapCollectionSortField() and SuggestionService.mapSortField(). This code duplication increases maintenance burden, risks inconsistent behavior between endpoints, and violates the DRY principle. Adding new sort fields requires changes in multiple places.

Extract sort logic to a shared SortFieldMapper utility class or create a @SortableField() decorator. Centralize sort field definitions with their database mappings. Ensure all services use the shared implementation. Add unit tests specifically for sort mapping logic to prevent regressions.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions