Allow dependency injection in static flows
serradura opened this issue · 0 comments
serradura commented
The u-case allows the usage of dependency injection via the #then
method, its method is used to declare dynamic flows.
Group::FindAllForUser
.call(user: current_user, params: params)
.then(Paginate)
.then(Serialize::PaginatedRelationAsJson, serializer: Group::Serialize)
The idea of this issue is to propose the creation of a mechanism to allow dependency injection in static flows. Like these examples:
FetchListAsJson = Micro::Cases.flow([
Group::FindAllForUser,
Paginate,
[Serialize::PaginatedRelationAsJson, serializer: Group::Serialize]
])
FetchListAsJson = Micro::Cases.safe_flow([
# ...
])
class FetchListAsJson < Micro::Case
flow [
Group::FindAllForUser,
Paginate,
[Serialize::PaginatedRelationAsJson, serializer: Group::Serialize]
])
end
class FetchListAsJson < Micro::Case::Safe
flow [
# ...
])
end