getUserCertificates method

Future<List<UserCertificateModel>> getUserCertificates(
  1. String orgId
)

Implementation

Future<List<UserCertificateModel>> getUserCertificates(String orgId) async {
  final response = await _client
      .from('user_certificates')
      .select(
        '*, certifications!inner(name, org_id), profiles(username, display_name, email)',
      )
      .eq('certifications.org_id', orgId)
      .order('issued_at', ascending: false);
  return (response as List<dynamic>)
      .map((r) => UserCertificateModel.fromJson(r as Map<String, dynamic>))
      .toList();
}