createSession method

Future<LearningSessionModel> createSession(
  1. Map<String, dynamic> data
)

Implementation

Future<LearningSessionModel> createSession(Map<String, dynamic> data) async {
  final userId = _client.auth.currentUser?.id;
  final payload = {'user_id': userId, ...data};
  final response = await _client
      .from('learning_sessions')
      .insert(payload)
      .select()
      .single();
  return LearningSessionModel.fromJson(response);
}