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

repo = Repository()

def get_by_name(name):
    res = repo.get_time_slices_by_name(name)
    
    if res is not None and len(res) != 0:
        return [e.to_serializable_dict() for e in res]
    else:
        return Response(status=404)