-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Allow fetching multiple content and media by Guid and Udi
#15289
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
Allow fetching multiple content and media by Guid and Udi
#15289
Conversation
|
Hi there @bjarnef, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
Guid and Udi
Guid and UdiGuid and Udi
|
@Zeegaan speaking about |
Co-authored-by: Ronald Barendse <[email protected]>
|
@nul800sebastiaan this one shouldn't have any impact on existing behavior, but allow The extensions could be streamlined in v14 (if not already). |
|
@AndyButland would it still make sense the include this in latest v13? I recall in some custom views, where it would have been useful with a single lookup, but I needed to make a lookup per item (or create a custom API method to handle that). |
AndyButland
left a comment
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.
My guess is there's not too much demand given the time this PR has been pending, but I don't see any harm in it and can see it might allow some optimisations for packages doing these look-ups. Will merge in and schedule for 13.12 (13.11 is already built and internally tested, so I don't want to add more to that).
Prerequisites
Description
In Angular it is possible to fetch content by
int,GuidandUdiid usingcontentResource.getById(), but often it is better fetching multiple items in a single request instead of multiple requests.and since most pickers stores udi references, then
GuidandUdioverload methods are preferred. HowevercontentResource.getByIds()only supportedintids.Currently the ids are from querystring, but it may be better it post ids in body like
entityResource.getByIds()method does.I also updated this for media.
I found it is bit inconsistency that ContentService
GetByIds(IEnumerable<Udi> ids)extension returns nullable, while MediaServiceGetByIds(IEnumerable<Udi> ids)extension doesn'tUmbraco-CMS/src/Umbraco.Core/Services/ContentServiceExtensions.cs
Lines 22 to 37 in e80d117
Umbraco-CMS/src/Umbraco.Core/Services/MediaServiceExtensions.cs
Lines 20 to 35 in e80d117