IA-958 : feat: Rework fetchAssignedSubjects to use bulk UUID lookup with client-side filtering and category label normalization
Summary
Replaces the single-endpoint assigned subjects fetch with a two-step approach: first resolve assigned UUIDs, then fetch full subject details in bulk. Adds French category label mapping and fixes client-side filtering. Also cleans up the Learning screen's fetch effect.
Changes
subjectEndpoints
- Added
getSubjectsByUuidsendpoint:POST .../subjects/by-uuids
subjectStore (mobile)
- Added
categoryLabelsmap to normalize API category keys (e.g.MATHEMATIQUES) into French display labels - Rewrote
fetchAssignedSubjectswith a two-step flow:-
GETassigned subjects to extractsubjectUuidlist -
POSTtogetSubjectsByUuidswith{ uuids, childUuid }to fetch full subject details
-
- Applied
categoryLabelsmapping during subject normalization, with fallback to raw value - Normalizes
subjectUuidby falling back tos.uuid - Moved category and name filtering to client-side on the fetched results, replacing the previous query-param approach
- Added early return with empty subjects when no UUIDs are assigned
Learning screen
- Simplified fetch
useEffect: removed the null check branch and unified category argument — passesundefinedfor "Tous" instead ofundefinedvs filtered array - Omitted
fetchAssignedSubjectsfrom the dependency array intentionally to prevent infinite re-fetch loop (documented in comment) - Passes
searchQuery || undefinedto avoid sending empty string to the store