refactor: enforce clean layer separation across repository, service, and controller #216
Draft
anderslindho wants to merge 4 commits intomasterfrom
Draft
refactor: enforce clean layer separation across repository, service, and controller #216anderslindho wants to merge 4 commits intomasterfrom
anderslindho wants to merge 4 commits intomasterfrom
Conversation
Repositories must not know about HTTP. Replace all ResponseStatusException throws in ChannelRepository, TagRepository, and PropertyRepository with StorageException (for ES IO failures) or the existing typed domain exceptions (ChannelValidationException for bad query windows). Add a StorageException handler to V0ExceptionHandler mapping it to 500. The NOT_FOUND status used in findById catch blocks was also wrong: those are IO/connection failures, not 404s - replaced with StorageException.
…itory boundaries Services must not depend on Spring web binding types. Replace MultiValueMap<String, String> with Map<String, List<String>> in all service method signatures and repository public APIs. Controllers pass their MultiValueMap directly — no conversion needed since MultiValueMap IS-A Map<String, List<String>>. Also replaces internal LinkedMultiValueMap usages in TagRepository and PropertyRepository scroll loops, MetricsService metric-combination generation, ChannelProcessorService.processAllChannels, and ChannelFinderEpicsService with standard java.util equivalents.
@repository and @configuration must not be combined on the same class. The @configuration annotation was causing repositories to participate in Spring's configuration processing, which is incorrect. Remove it from all three repositories and drop the now-unused import.
georgweiss
reviewed
May 7, 2026
| * @return matching channels | ||
| */ | ||
| public SearchResult search(MultiValueMap<String, String> searchParameters) { | ||
| public SearchResult search(Map<String, List<String>> searchParameters) { |
Collaborator
There was a problem hiding this comment.
Why replacing MultiValuedMap?
Contributor
Author
There was a problem hiding this comment.
See commit message for that change:
Services must not depend on Spring web binding types. Replace
MultiValueMap<String, String> with Map<String, List> in all
service method signatures and repository public APIs. Controllers pass
their MultiValueMap directly - no conversion needed since MultiValueMap
IS-A Map<String, List>.
Collaborator
There was a problem hiding this comment.
MultiValuedMap is a class in spring framework core, not in a web library.
georgweiss
reviewed
May 7, 2026
Collaborator
georgweiss
left a comment
There was a problem hiding this comment.
Added in-line comment
Add ChannelDto, TagDto, PropertyDto, SearchResultDto, ScrollDto under web/v0/dto/ and corresponding static mappers under web/v0/mapper/. All five controllers now map to/from DTOs; the service and domain layers are unchanged. This isolates the v0 API shape from the domain model so a future v1 API can evolve its own DTOs without touching service or repository code.
ef3dcb7 to
1863ef6
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Pushes the codebase toward cleaner layering: repositories are pure persistence adapters, services have no web framework dependencies, and the HTTP boundary is explicit.
Also adds a v0 DTO layer ahead of a planned v1 API, so the two can evolve independently without touching the service or domain layers.