This sentence is part of the explanation of the for_user reducer:
In our case, our classic reducer takes a
user_idand transforms the initial query with an additionalwhereclause.
The reducer function accepts a user argument, not a user_id.
def for_user(query \\ base(), user) do
query
|> where([d], d.user_id == ^user.id)
end