Skip to content

Conversation

mrfrase3
Copy link
Contributor

@mrfrase3 mrfrase3 commented Mar 8, 2024

Summary

Currently if you need to manually submit an event, like you want to push an update after calling _patch, this lib requires you to build a context object manually or else it wont work properly:

const newItem = await app.service(path)._patch(item._id, data);
app.service(path).emit('patched', newItem, { method: 'patch', id: item._id, result: newItem, path, params: {} });

most of the required info in context can already be gleaned from the execution context, so the code in this PR attempts a best guess context object. Whilst not perfect, it at least protects the developer from forgetting a fixed set of fields:

app.service(path).emit('patched', newItem);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant