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

Rethink routes (i.e. URLs) for collections and document sets #4411

Open
bencomp opened this issue Nov 12, 2024 · 0 comments
Open

Rethink routes (i.e. URLs) for collections and document sets #4411

bencomp opened this issue Nov 12, 2024 · 0 comments

Comments

@bencomp
Copy link
Contributor

bencomp commented Nov 12, 2024

This is a big issue with more implications than I probably see, but I would like to humbly suggest to rethink and update the URLs for collections and document sets (and maybe other resources too). The current situation appears to cause issues for users and it makes understanding and developing the application harder.

I know that FromThePage has a long history and understand that Rails has evolved too. This issue comes from me finding it hard to understand why some issues exist or even seem to return. I don't expect that I have time to help implement (all) the suggestions below or that you will prioritise this.

Some observations about routing:

Some of these issues were already addressed. But not having a clear structure may require increasingly complex logic to maintain integrity (force unique slugs, force slugs to not be numbers only, make routes.rb longer, etc.) when adding features.

The Rails guide on routing makes it all look easy, if your controller actions match the Rails defaults.

Let me provide some suggestions for discussion:

  • if an object is always part of some other object, nest the URLs (e.g. articles should always be POSTed within a collection)
  • include the type of (nested) resource in the URL, to prevent potential conflicts when IDs for collections, works and pages overlap and to allow easier (mental) construction of URLs. For example, the /iiif/ path can be followed by collection, work or page IDs, or by fixed strings; while I don't think any of the IIIF routes could 'clash' currently, updating or adding routes requires carefully analysing whether that action introduces potential clashes. For collections and document sets, URLs did collide, but a different solution, unique slugs, was chosen.
  • refactor routes with verbs to resources with HTTP methods, e.g. POST document_sets/remove_set_collaborator with query params for the IDs of the document set and the collaborator could become DELETE document_sets/:document_set_id/collaborators/:collaborator_id.

Thanks!

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

No branches or pull requests

1 participant