Refactor code formatting and improve readability: standardize line breaks and indentation across various endpoint files, enhancing code clarity and maintainability. Update package version formatting in Directory.Packages.props for consistency.

This commit is contained in:
Leonid Pershin
2026-07-25 19:55:01 +03:00
parent 1f6fa6f1ae
commit f57b7503ed
122 changed files with 1856 additions and 892 deletions
@@ -21,9 +21,15 @@ public sealed class GetLivePlaylistQueryHandler(
CancellationToken cancellationToken
)
{
var channel = await dbContext.Channels.AsNoTracking()
var channel = await dbContext
.Channels.AsNoTracking()
.Where(c => c.Slug == query.Slug && c.IsEnabled)
.Select(c => new { c.Id, c.EpochUtc, c.FillerAssetId })
.Select(c => new
{
c.Id,
c.EpochUtc,
c.FillerAssetId,
})
.FirstOrDefaultAsync(cancellationToken);
if (channel is null)
return Result.Failure<LivePlaylistDto>(ChannelErrors.NotFound);
@@ -33,7 +39,8 @@ public sealed class GetLivePlaylistQueryHandler(
// Загружаем записи, пересекающиеся с окном (с небольшим запасом назад).
var windowStartTime = query.Now.AddSeconds(-(window + 2) * seg);
var rawEntries = await dbContext.ScheduleEntries.AsNoTracking()
var rawEntries = await dbContext
.ScheduleEntries.AsNoTracking()
.Where(e =>
e.ChannelId == channel.Id
&& e.StartsAtUtc < query.Now
@@ -52,7 +59,8 @@ public sealed class GetLivePlaylistQueryHandler(
if (channel.FillerAssetId is { } fillerId)
assetIds.Add(fillerId);
var segmentCounts = await dbContext.MediaAssets.AsNoTracking()
var segmentCounts = await dbContext
.MediaAssets.AsNoTracking()
.Where(a =>
assetIds.Contains(a.Id)
&& a.Status == MediaAssetStatus.Ready
@@ -72,7 +80,10 @@ public sealed class GetLivePlaylistQueryHandler(
.ToList();
LiveFiller? filler = null;
if (channel.FillerAssetId is { } fid && segmentCounts.TryGetValue(fid, out var fillerSegments))
if (
channel.FillerAssetId is { } fid
&& segmentCounts.TryGetValue(fid, out var fillerSegments)
)
filler = new LiveFiller(fid, fillerSegments);
var playlist = LiveWindowCalculator.Build(
@@ -82,8 +93,8 @@ public sealed class GetLivePlaylistQueryHandler(
var dto = new LivePlaylistDto(
playlist.MediaSequence,
playlist.TargetDuration,
playlist.Segments
.Select(s => new LiveSegmentDto(s.AssetId, s.LocalIndex, s.Discontinuity))
playlist
.Segments.Select(s => new LiveSegmentDto(s.AssetId, s.LocalIndex, s.Discontinuity))
.ToList()
);
return Result.Success(dto);