Closed NicolasMahe closed 6 years ago
This validations also shouldn't be made in Complete(). We should first check data for execution and only then call Complete() with valid data in the api handlers. Passing an invalid data to Complete() doesn't make much sense.
event
and execution
packages needs to be more agnostic and only do their own jobs.
I saw in quite a lot of files this boring piece of code to access value of maps and return an error if not found: https://github.com/mesg-foundation/core/blob/bd84ad1d54eadfb8aa2bd79ac0c7c68f775f9c03/execution/complete.go#L13-L19
I suggest to create getters that will return the expected data and the error if not found. We should have getters for:
func (service *Service) GetEvent(eventKey string) (*Event, err)
func (service *Service) GetTask(taskKey string) (*Task, err)
func (service *Service) GetTaskOutput(taskKey string, outputKey string) (*Output, err)
@mesg-foundation/core what do you think?