Hi all! Is it possible to have some sort of duct component or module that does post-processing of the payload returned by another handler? I'm trying to do something like this:
[:money-clip.duct.restful/resource :money-clip.handler.bank-accounts/create]
{:db #ig/ref :duct.database/sql
:add {:user-id [:bank-account :user :id]}
:exclude [[:bank-account :user]]
:links {:self "/bank-account/{id}" :user "/users/{user-id}"}}
Where :money-clip.duct.restful/resource would be a generic post-processor - customisable by the :add / :exclude and :links options - for the map returned by the :money-clip.handler.bank-accounts/create handler. But I seem to be getting nowhere with it.
What would be the duct way of achieving this or something similar? Thanks.Thanks @clojurians-slack100! Will definitely explore those two options.
As it is now, I get the following error
Multiple methods in multimethod 'init-key' match dispatch value: :integrant.composite/money-clip.duct.restful.resource+money-clip.handler.bank-accounts.create_18632 -> :money-clip.handler.bank-accounts/create and :money-clip.duct.restful/resource, and neither is preferredI can think of 2 ways:
1) Split /resource and /create into separate components, such that the former refs the latter:
:money-clip.duct.restful/resource {:create #ig/ref :money-clip.handler.bank-accounts/create}
That way /resource can post-process the /create component.
2) Do post-processing in /create's init-key method on the component value that would've been returned.