aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2022-01-21 19:50:08 +0100
committerGitHub <noreply@github.com>2022-01-21 19:50:08 +0100
commitcd675475bc5f37d4b20ed71271b17d0945b3f969 (patch)
treeee1a904ed6aacb1a3adc8848280caaf2b5856bc7 /Jellyfin.Server.Implementations
parent34ee6d82fb38b553d0ccd192fb7b2acfe2433c16 (diff)
parenta60cb280a3d31ba19ffb3a94cf83ef300a7473b7 (diff)
Merge pull request #7225 from crobibero/query-result
Diffstat (limited to 'Jellyfin.Server.Implementations')
-rw-r--r--Jellyfin.Server.Implementations/Activity/ActivityManager.cs11
-rw-r--r--Jellyfin.Server.Implementations/Devices/DeviceManager.cs20
2 files changed, 13 insertions, 18 deletions
diff --git a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs
index ba2c8b54f9..4447b212d2 100644
--- a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs
+++ b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs
@@ -59,17 +59,16 @@ namespace Jellyfin.Server.Implementations.Activity
entries = entries.Where(entry => entry.UserId != Guid.Empty == query.HasUserId.Value );
}
- return new QueryResult<ActivityLogEntry>
- {
- Items = await entries
+ return new QueryResult<ActivityLogEntry>(
+ query.Skip,
+ await entries.CountAsync().ConfigureAwait(false),
+ await entries
.Skip(query.Skip ?? 0)
.Take(query.Limit ?? 100)
.AsAsyncEnumerable()
.Select(ConvertToOldModel)
.ToListAsync()
- .ConfigureAwait(false),
- TotalRecordCount = await entries.CountAsync().ConfigureAwait(false)
- };
+ .ConfigureAwait(false));
}
/// <inheritdoc />
diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
index 6c77421c70..b5fc96079e 100644
--- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
+++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
@@ -145,12 +145,10 @@ namespace Jellyfin.Server.Implementations.Devices
devices = devices.Take(query.Limit.Value);
}
- return new QueryResult<Device>
- {
- Items = await devices.ToListAsync().ConfigureAwait(false),
- StartIndex = query.Skip ?? 0,
- TotalRecordCount = count
- };
+ return new QueryResult<Device>(
+ query.Skip,
+ count,
+ await devices.ToListAsync().ConfigureAwait(false));
}
/// <inheritdoc />
@@ -158,12 +156,10 @@ namespace Jellyfin.Server.Implementations.Devices
{
var devices = await GetDevices(query).ConfigureAwait(false);
- return new QueryResult<DeviceInfo>
- {
- Items = devices.Items.Select(device => ToDeviceInfo(device)).ToList(),
- StartIndex = devices.StartIndex,
- TotalRecordCount = devices.TotalRecordCount
- };
+ return new QueryResult<DeviceInfo>(
+ devices.StartIndex,
+ devices.TotalRecordCount,
+ devices.Items.Select(device => ToDeviceInfo(device)).ToList());
}
/// <inheritdoc />