Refactor: Introduce service layer and thin down controller layer#207
Open
anderslindho wants to merge 6 commits intoChannelFinder:masterfrom
Open
Refactor: Introduce service layer and thin down controller layer#207anderslindho wants to merge 6 commits intoChannelFinder:masterfrom
anderslindho wants to merge 6 commits intoChannelFinder:masterfrom
Conversation
3105641 to
2082fad
Compare
- Add LegacyApiProperties @ConfigurationProperties bean for channelfinder.legacy.service-root, normalizing leading/trailing slashes; defaults to ChannelFinder. - Remove hardcoded CFResourceDescriptors constants from all six API interface @RequestMapping declarations; interfaces now carry only HTTP method contracts. - Inject scroll resource URI via @value in ChannelRepository to avoid static constant coupling. - Document the property in application.properties.
…egation All business logic (authorization, validation, orchestration) moves out of controllers into dedicated application services. Controllers now contain only constructor injection and single-line delegation calls. - Add ChannelService, TagService, PropertyService, InfoService, ChannelScrollService. - Move processAllChannels scroll orchestration and CF_ADMIN auth check into ChannelProcessorService; remove IChannelScroll dependency from its controller. - Add seven domain exception types (ChannelNotFoundException, TagNotFoundException, PropertyNotFoundException, *ValidationException, UnauthorizedException). - Add ChannelFinderExceptionHandler (@RestControllerAdvice) mapping domain exceptions to HTTP status codes. - Remove validateChannelRequest/validateTagRequest/validatePropertyRequest from API interfaces; validation now lives entirely in the service layer. - Switch all six controllers to constructor injection. - Update ChannelProcessorServiceTest to match the expanded constructor signature.
Introduce a web package hierarchy that makes the structural intent clear and leaves room for a future web.v1 package alongside it. - rest.api.* -> web.legacy.api.* - rest.controller.* -> web.legacy.controller.* - ChannelFinderExceptionHandler -> web (cross-cutting, not legacy-specific) Update all test imports accordingly. No behaviour change.
Replace the implicit per-controller @crossorigin annotations with an explicit CorsConfigurationSource bean in WebSecurityConfig, backed by a configurable cors.allowed-origins property (default: *). - Remove @crossorigin from all legacy controllers (committed as fixup). - Add corsConfigurationSource() bean and wire it into the filter chain. - Document the property in application.properties.
…n errors Bulk requests of 1500+ channels with rich property payloads exceeded the default ES circuit-breaker limit (~102 MiB), causing 429/413 rejections in CI. Split channel inserts into batches of 1000 and throw on bulk errors rather than logging and continuing with a silently empty index. Same fail-fast treatment applied to checkBulkResponse (properties/tags).
2082fad to
fb0a338
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.



Moves towards a clean controller -> service -> repository layering as the foundation for a future versioned REST API.