IA-956: feat: Add subject unassignment and improve subject/assignment loading reliability
Summary
Adds the ability to unassign subjects from a child, and improves the robustness of subject fetching and assignment state management.
Changes
ChildSubjectsManager
- Added unassign logic in
saveChanges: now computestoAssignandtoUnassigndiffs against currently assigned subjects, and callsunassignSubjectFromChildin parallel for removed subjects - Fixed
toggleSubjectto use localcurrentSelectedcount frommodalSubjectsinstead of staleselectedCountfrom outer scope - Added
ListEmptyComponentin the modal FlatList to handle loading and empty states gracefully - Fixed early-return guard to check
child.uuidinstead ofchild.id - Combined
assignedSubjectsLoadingandsubjectsLoadinginto a single loading guard block - Modal subtitle now simplified to per-child quota wording
subscriptionStore
- Added
unassignSubjectFromChild(childUuid, subjectUuid)action callingDELETE .../child/:childUuid/subject/:subjectUuid -
fetchAssignedSubjectsByChildnow resetsassignedSubjects: []before fetching to avoid stale data flash
subjectStore
- Added guard for empty
levelUuidto skip fetch early - Resets
subjects: []before each fetch - Adds pagination params
{ size: 1000, page: 0 }to the request - Handles both array and paginated (
{ content: [] }) response shapes - Normalizes
subjectUuidby falling back tos.uuidif missing
subscriptionEndpoints
- Added
unassignSubject(childUuid, subjectUuid)endpoint:
DELETE .../assign-subjects/child/:childUuid/subject/:subjectUuid