diff --git a/LightlessAPI b/LightlessAPI index f1817c5..852e2a0 160000 --- a/LightlessAPI +++ b/LightlessAPI @@ -1 +1 @@ -Subproject commit f1817c597450bf2ee5425708b982a68916214e3a +Subproject commit 852e2a005f5bfdf3844e057c6ba71de6f5f84ed8 diff --git a/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.User.cs b/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.User.cs index 29c3076..bda6d24 100644 --- a/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.User.cs +++ b/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.User.cs @@ -1276,9 +1276,16 @@ public partial class LightlessHub } [Authorize(Policy = "Identified")] - public async Task> RequestAllLocationInfo() + public async Task<(List, List)> RequestAllLocationInfo() { _logger.LogCallInfo(); + var locationWithTime = await GetLocationWithTime().ConfigureAwait(false); + var sharingStatus = await GetSharingStatus().ConfigureAwait(false); + return (locationWithTime, sharingStatus); + } + + private async Task> GetLocationWithTime() + { var dictionary = await DbContext.Permissions.AsNoTracking() .Where(x => x.OtherUserUID == UserUID && x.ShareLocationUntil > DateTimeOffset.UtcNow) .ToDictionaryAsync(x => x.UserUID, x => x.ShareLocationUntil, cancellationToken: RequestAbortedToken) @@ -1304,6 +1311,14 @@ public partial class LightlessHub return result; } + private async Task> GetSharingStatus() + { + return await DbContext.Permissions.AsNoTracking() + .Where(x => x.UserUID == UserUID && x.ShareLocationUntil > DateTimeOffset.UtcNow) + .Select(x => new SharingStatusDto(new UserData(x.OtherUserUID), x.ShareLocationUntil)) + .ToListAsync(cancellationToken: RequestAbortedToken).ConfigureAwait(false); + } + [Authorize(Policy = "Identified")] diff --git a/LightlessSyncServer/LightlessSyncServer/Utils/Extensions.cs b/LightlessSyncServer/LightlessSyncServer/Utils/Extensions.cs index 92cf499..546cf0c 100644 --- a/LightlessSyncServer/LightlessSyncServer/Utils/Extensions.cs +++ b/LightlessSyncServer/LightlessSyncServer/Utils/Extensions.cs @@ -151,7 +151,6 @@ public static class Extensions perm.SetDisableVFX(permissions.DisableVFX); if (setSticky) perm.SetSticky(permissions.Sticky); - perm.SetShareLocation(permissions.ShareLocationUntil > DateTimeOffset.UtcNow); return perm; } }