Skip to content

Conversation

@bwl21
Copy link
Owner

@bwl21 bwl21 commented Sep 27, 2025

Problem

Automatic groups were displaying 'Unbekannter Typ' instead of actual group type names like 'Hauskreis', 'Mitarbeiterteam', etc.

Root Cause

  • Group type ID was being accessed from wrong field path
  • No mapping from group type IDs to human-readable names
  • API response structure was not properly handled

Solution

  • Fetch group types: Added API call to /group/grouptypes to create ID-to-name mapping
  • Correct field access: Access groupTypeId from group.information.groupTypeId (not root level)
  • Robust API handling: Handle both data array and direct array responses
  • Interface updates: Added both groupTypeId (number) and groupTypeName (string) fields
  • UI improvements: Display groupTypeName instead of groupTypeId in admin table

Technical Details

API Integration

  • Fetch group types upfront and create Map for efficient lookups
  • Include domainAttributes in groups API call for complete data
  • Robust error handling with fallbacks

Field Access Priority

  1. group.information.groupTypeId (correct path)
  2. group.domainAttributes.groupTypeId (fallback)
  3. group.groupTypeId (fallback)
  4. 0 (default)

Files Changed

  • src/composables/useAutomaticGroups.ts - Core logic for fetching and mapping group types
  • src/components/automatic-groups/AutomaticGroupsAdmin.vue - UI updates for displaying group type names

Testing

  • Group types are correctly fetched and mapped
  • Automatic groups now display readable group type names
  • Error handling works when group types API fails
  • All lint checks pass
  • No breaking changes to existing functionality

Documentation

  • Complete session documentation created
  • Lessons learned updated with ChurchTools API patterns
  • Reusable pattern for other ID-to-name mappings

Resolves the grouptype display issue and provides a robust foundation for similar reference data mappings.

- Fetch group types from /group/grouptypes API to create ID-to-name mapping
- Access groupTypeId from correct field path (group.information.groupTypeId)
- Update interface to include both groupTypeId (number) and groupTypeName (string)
- Update admin table to display groupTypeName instead of groupTypeId
- Add robust error handling for group types API calls
- Include domainAttributes in groups API call for complete data

Resolves issue where automatic groups showed 'Unbekannter Typ' instead of
actual group type names like 'Hauskreis', 'Mitarbeiterteam', etc.

Co-authored-by: Ona <no-reply@ona.com>
@bwl21 bwl21 merged commit 1e91f18 into main Sep 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants