Skip to content

Add "Sort Order" field to Application model and order by it #804

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jberlyn
Copy link

@jberlyn jberlyn commented Jun 9, 2025

This is my attempt at resolving:
#358

This adds a new field to Application called "Sort Order". When fetching the list of Applications by user, it will order by this Sort Order. By default, Applications will have a Sort Order of 0.

This is my first time contributing to a Go codebase, I am not familiar with the database tooling so I am unsure if this will automatically migrate the Application table to include the "Sort Order" column.

Happy to take feedback on this feature implementation.

Order user Application list by sort order
Add sort order field to Application creation
Add sort order field to Application updating
@jberlyn jberlyn requested a review from a team as a code owner June 9, 2025 07:00
@eternal-flame-AD
Copy link
Member

Thanks! It looks generally good. I have no problem going with this design, might be a couple nitpicks for a deep look before merge but otherwise looking good. However there might be a more user friendly UX.

Do you know about sortable drag and drop list? The one where you have "Apple" on one line, "Banana" on the second, and you can swap orders between them? I think it would be more intuitive than inputting a number.

you can implement this by labeling the "sort order" of Apps from 0-N, and then when the user drag and drop you upload a new sequence, or swap the index of two apps. I would prefer the full update approach since we are displaying Apps on one page anyways so there won't be too much.

Let me know if you are up to it!

@jmattheis
Copy link
Member

Another option would be to use decimals when reordering, this way only one app has to be updated in the database. E.g. You have this order (the number is the sort order index)

1. Apple
2. Banana
3. Orange

When now reordering Orange between Apple and Banana it would get the sort order 1.5.

But the full update proposal from eternal-flame-AD is fine too.

@jberlyn
Copy link
Author

jberlyn commented Jun 15, 2025

I am not sure when I will get around to making any improvements to this pull request, but happy for others to contribute if they would like to round out this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants