Skip to content

IA-984 :Refactor: Fix endpoint URLs, convert static mapper to Spring bean, and harden education level resolution

khadija.elbachouri a demandé de fusionner feature/IA-984 vers develop

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
  • getEducationLevelFromUuid now throws FunctionalException instead of silently defaulting to CM1 on unresolvable levels

AssistantServiceImpl

  • Replaced static AssistantMapper calls with injected AssistantMapper bean instance

AssistantMapper

  • Converted from static utility class with a static ExternalApiClient field to a proper Spring @Component with constructor injection via @RequiredArgsConstructor

AssistantRepository

  • Renamed findByEducationLevelAndTypeAndStatusAndIsActivefindFirstByEducationLevelAndTypeAndStatusAndIsActive to avoid ambiguity when multiple records match

ExternalApiClient

  • Added Authorization header forwarding from the incoming request context
  • Improved error handling: HttpClientErrorException logged at WARN without stack trace; unexpected errors also downgraded from ERROR to WARN

ExternalModelService

  • Renamed config property MODEL_MANAGEMENT_API_BASE_URLmodel-management.api.base-url to 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 userId parameter
  • Prevents silent wrong-level assignment when UUID mapping fails
  • Aligns property naming with Spring conventions
Modification effectuée par khadija.elbachouri

Rapports de requête de fusion