createLearningPath method

Future<LearningPathModel> createLearningPath({
  1. required String orgId,
  2. required String name,
  3. String? description,
  4. bool isOnboarding = false,
})

Implementation

Future<LearningPathModel> createLearningPath({
  required String orgId,
  required String name,
  String? description,
  bool isOnboarding = false,
}) async {
  final response = await _client
      .from('learning_paths')
      .insert({
        'org_id': orgId,
        'name': name,
        // ignore: use_null_aware_elements
        if (description != null) 'description': description,
        'is_onboarding': isOnboarding,
        'created_by': _userId,
      })
      .select()
      .single();
  return LearningPathModel.fromJson(response);
}