diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-02-07 00:56:55 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-02-07 01:38:06 +0100 |
| commit | 268d88a5fb8f0f71c96ba5abcef250d1f7e049ff (patch) | |
| tree | dbca9e0725ed368f8621901b96a1f1a5846c500a /MediaBrowser.Controller/Persistence | |
| parent | 8ddc35a1ced32b40ef2ee333f2adcc57f3725811 (diff) | |
Optimize Collection Grouping, NextUp and Latest queries
Diffstat (limited to 'MediaBrowser.Controller/Persistence')
| -rw-r--r-- | MediaBrowser.Controller/Persistence/IItemRepository.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index c35e8e50a3..f1b27c52db 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -189,6 +189,16 @@ public interface IItemRepository (int Played, int Total) GetPlayedAndTotalCountFromLinkedChildren(InternalItemsQuery filter, Guid parentId); /// <summary> + /// Batch-fetches played and total counts for multiple folder items using the AncestorIds table. + /// This avoids N+1 queries when building DTOs for lists of folder items (Series, Seasons, etc.). + /// Applies user access filtering (parental controls, tags). + /// </summary> + /// <param name="folderIds">The list of folder item IDs to get counts for.</param> + /// <param name="user">The user for access filtering and played status.</param> + /// <returns>Dictionary mapping folder ID to (Played count, Total count).</returns> + Dictionary<Guid, (int Played, int Total)> GetPlayedAndTotalCountBatch(IReadOnlyList<Guid> folderIds, User user); + + /// <summary> /// Gets the IDs of linked children for the specified parent. /// </summary> /// <param name="parentId">The parent item ID.</param> |
