IA-984 :Refactor: Fix endpoint URLs, convert static mapper to Spring bean, and harden education level resolution
Summary
This MR addresses several correctness and design issues across the assistant and user management services.
Changes
AssistantResolverService
- Fixed
/children/current-user→/children/{userId}for user lookup endpoint - Renamed
findByEducationLevelAndType...→findFirstByEducationLevelAndType...to match updated repository method -
getEducationLevelFromUuidnow throwsFunctionalExceptioninstead of silently defaulting toCM1on unresolvable levels
AssistantServiceImpl
- Replaced static
AssistantMappercalls with injectedAssistantMapperbean instance
AssistantMapper
- Converted from static utility class with a static
ExternalApiClientfield to a proper Spring@Componentwith constructor injection via@RequiredArgsConstructor
AssistantRepository
- Renamed
findByEducationLevelAndTypeAndStatusAndIsActive→findFirstByEducationLevelAndTypeAndStatusAndIsActiveto avoid ambiguity when multiple records match
ExternalApiClient
- Added
Authorizationheader forwarding from the incoming request context - Improved error handling:
HttpClientErrorExceptionlogged at WARN without stack trace; unexpected errors also downgraded from ERROR to WARN
ExternalModelService
- Renamed config property
MODEL_MANAGEMENT_API_BASE_URL→model-management.api.base-urlto follow Spring property naming conventions
UserManagementServiceImpl
- Fixed
/children/current-user→/children/{userId}for user lookup endpoint
Impact
- Fixes incorrect user resolution that was ignoring the
userIdparameter - Prevents silent wrong-level assignment when UUID mapping fails
- Aligns property naming with Spring conventions