getDomainIdsWithContent method

Future<Set<String>> getDomainIdsWithContent()

Return the set of domain IDs that have at least one topic with a content chunk. Used to gate goal-eligible domains so users can't bind a learning goal to an empty domain.

Implementation

Future<Set<String>> getDomainIdsWithContent() async {
  final response = await _client
      .from('content_chunks')
      .select('topics!inner(domain_id)');
  return (response as List<dynamic>)
      .map((row) => (row['topics'] as Map)['domain_id'] as String)
      .toSet();
}