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

Change the hint_panels/move endpoint to a noun to follow REST API best practices #64

Open
apmwebdev opened this issue Oct 1, 2023 · 0 comments
Assignees
Labels
cleanup Too small to be a true "refactor," but same idea

Comments

@apmwebdev
Copy link
Owner

apmwebdev commented Oct 1, 2023

Background

It is possible for users to change the order of hint panels within a hint profile. This should be a distinct operation from the normal hint panel #update CRUD method due to movement affecting other panels besides just the moved panel. Because of this, the required data for the #move endpoint is different from #update. It would theoretically be possible to only include data for the panel being moved by sending something like { id, newIndex } to the endpoint, but this still feels distinct from #update due to the fact that it affects other panels besides just the moved one.

Next Steps

Since the #update method uses PUT or PATCH with hint_panels/:id, one possibility would be to use the hint_panels URL with PUT or PATCH and no hint panel ID. This would also be distinct from index due to using PUT/PATCH instead of GET (if index is ever re-implemented). The downside is that it would not be immediately obvious that this URL pattern is for moving hint panels as opposed to, say, bulk updating them more generally.

Another option would be to change the url to /mover or /movement instead of /move. While these would satisfy the condition of making the URL pattern into a noun, they would be much less clear than move and would therefore be bad for a different reason.

Maybe something like /order or /sequence could be used? Those both convey what is happening much more clearly.

An even clearer approach would be to change this operation to be associated with a specific hint profile rather than hint panels. user_hint_profiles/:id/panel_order is much more effective at conveying what is happening than hint_panels/order. This is probably the approach to take.

@apmwebdev apmwebdev added the cleanup Too small to be a true "refactor," but same idea label Oct 1, 2023
@apmwebdev apmwebdev self-assigned this Oct 1, 2023
@apmwebdev apmwebdev added invalid This doesn't seem right and removed invalid This doesn't seem right labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Too small to be a true "refactor," but same idea
Projects
None yet
Development

No branches or pull requests

1 participant