enrollUsers method

Future<void> enrollUsers(
  1. String pathId,
  2. List<String> userIds,
  3. String enrolledBy
)

Implementation

Future<void> enrollUsers(
  String pathId,
  List<String> userIds,
  String enrolledBy,
) async {
  final rows = userIds
      .map(
        (uid) => {
          'path_id': pathId,
          'user_id': uid,
          'enrolled_by': enrolledBy,
        },
      )
      .toList();
  await _client
      .from('learning_path_enrollments')
      .upsert(rows, onConflict: 'path_id,user_id', ignoreDuplicates: true);
}