from flask import request, Response
from db.repository import Repository
from db.entities import ClusterSet

repo = Repository()

def get_by_name(name):
    res = repo.get_clusters_for_layer(name)
    if res is None or len(res) == 0:
        return Response(status=404)
    else:
        return [c.to_serializable_dict() for c in res]
