-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: change to list_detours
and other detour_admin endpoint to request fields explicitly
#2948
Conversation
…ns.Db.Detour.Queries` into `Skate.Detours.Db.Detour.Queries`
wip! working, pr ready wip! add virtual fields to struct wip! add route id
lib/skate/detours/db/detour.ex
Outdated
|> preload([ | ||
:author | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I feel like there should be a better way to tell if we need to preload the author, (and preload using a join instead) but I wasn't able to figure it out in time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming you mean you want to have the preload([:author])
statement present if a condition is met, you can do something like.....
defp preload_author(query, thing_to_check) do
if thing_to_check == true do
preload(query, [:author])
else
query
end
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wip! make `with_fields` handle virtual fields wip! move split_fields into own function review! wip! replace `with_author`
373a6b8
to
2edd643
Compare
list_detours
and other Read API endpointslist_detours
and other detour_admin endpoint to request fields explicitly
2edd643
to
8eefc7a
Compare
8eefc7a
to
0b8995d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more of a general question for discussion, why do we have Detailed
, ActivatedDetourDetails
, and WithState
structs all for Detour
?
especially in the case of ActivatedDetourDetails
it seems excessive to add 2 fields and add an additional complexity of nesting the actual Detour
info within :details
d0eb72d
to
45462f9
Compare
Some ideas on how we should structure the "Read" subset of CRUD API's in Skate, but specifically for Detours in this PR.
I think this could be merged into #2946 if people like it.