Commit e60b011f authored by Manuel Herold's avatar Manuel Herold

[businessLogic] fixed 500 error for enum query

parent cbb4d514
...@@ -34,7 +34,7 @@ class EnumRepository(MongoRepositoryBase): ...@@ -34,7 +34,7 @@ class EnumRepository(MongoRepositoryBase):
return [Enum.from_serializable_dict(row) for row in list(result)] return [Enum.from_serializable_dict(row) for row in list(result)]
def all_instances(self, name: str, use_case: str, table: str) -> Enum: def all_for_use_case_and_table_and_name(self, name: str, use_case: str, table: str) -> Enum:
result = list(super().get_entries(self._enum_collection, selection={ result = list(super().get_entries(self._enum_collection, selection={
"name": name, "use_case": use_case, "table": table})) "name": name, "use_case": use_case, "table": table}))
......
...@@ -32,12 +32,9 @@ def one(use_case: str, table: str, name: str): ...@@ -32,12 +32,9 @@ def one(use_case: str, table: str, name: str):
table - Required : unique identifier of the Table the Enum belongs to table - Required : unique identifier of the Table the Enum belongs to
name - Required : unique identifier for the Enum name - Required : unique identifier for the Enum
''' '''
enum = enum_repository.one(name, use_case, table) enums = enum_repository.all_for_use_case_and_table_and_name(name, use_case, table)
if enum == None: return Response(status=200, response=json.dumps([enum.to_serializable_dict() for enum in enums]))
return Response(status=404, response=f"Enum with name '{name}' does not exist!")
return Response(status=200, response=json.dumps(enum.to_serializable_dict()))
def put_new(use_case: str, table: str, name: str, value: str): def put_new(use_case: str, table: str, name: str, value: str):
''' '''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment