getNotifications method

Future<List<OrgNotificationModel>> getNotifications(
  1. String orgId, {
  2. int limit = 50,
})

Implementation

Future<List<OrgNotificationModel>> getNotifications(
  String orgId, {
  int limit = 50,
}) async {
  final response = await _client
      .from('org_notifications')
      .select()
      .eq('org_id', orgId)
      .eq('user_id', _userId)
      .order('created_at', ascending: false)
      .limit(limit);
  return (response as List<dynamic>)
      .map(
        (row) => OrgNotificationModel.fromJson(row as Map<String, dynamic>),
      )
      .toList();
}