Skip to content
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

Closed
wants to merge 13 commits into from

Conversation

firestack
Copy link
Member

@firestack firestack commented Jan 29, 2025

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.

Comment on lines 120 to 140
|> preload([
:author
])
Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Member Author

@firestack firestack Jan 31, 2025

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`
@firestack firestack force-pushed the kf/wip/proposed-query-changes branch 4 times, most recently from 373a6b8 to 2edd643 Compare January 31, 2025 18:22
@firestack firestack changed the title wip! proposed change to list_detours and other Read API endpoints proposal: change to list_detours and other detour_admin endpoint to request fields explicitly Jan 31, 2025
@firestack firestack force-pushed the kf/wip/proposed-query-changes branch from 2edd643 to 8eefc7a Compare January 31, 2025 18:39
@firestack firestack marked this pull request as ready for review January 31, 2025 18:42
@firestack firestack requested a review from a team as a code owner January 31, 2025 18:42
@firestack firestack requested review from bfauble and removed request for a team January 31, 2025 18:42
@firestack firestack force-pushed the kf/wip/proposed-query-changes branch from 8eefc7a to 0b8995d Compare January 31, 2025 19:17
@bfauble bfauble self-assigned this Jan 31, 2025
Copy link
Contributor

@bfauble bfauble left a 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

@firestack firestack closed this Feb 4, 2025
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.

2 participants