Skip to content
Snippets Groups Projects
Commit d66650c4 authored by Nathan Hertz's avatar Nathan Hertz
Browse files

Changed event type field from int to str in WorkflowEventSchema

parent c78a6181
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,11 @@ class WorkflowEventSchema(Schema):
retval = fields.Integer(allow_none=True)
# Enums apparently are not a first-class field type in Marshmallow
def get_type(self, obj: WorkflowEventType) -> int:
return obj.type.value
def get_type(self, obj: WorkflowEventType) -> str:
return obj.type.name.lower()
def load_type(self, value: int) -> WorkflowEventType:
return next(et for et in WorkflowEventType if et.value == value)
def load_type(self, name: str) -> WorkflowEventType:
return next(et for et in WorkflowEventType if et.name.lower() == name)
@post_load
def make_event(self, data, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment