fetchOrganizationsFromDb function

Future<List<Document>> fetchOrganizationsFromDb(
  1. Databases db
)

Helper function to fetch organizations from the database. This would normally be in a repository class, but included here for simplicity.

Implementation

Future<List<Document>> fetchOrganizationsFromDb(Databases db) async {
  final result = await db.listDocuments(
    databaseId: AppConstants.appwriteDatabaseId,
    collectionId: AppConstants.userCollectionId,
    queries: [
      Query.equal('type', 'organization'),
    ],
  );

  return result.documents;
}