🐛 Fix get device API
This commit is contained in:
@@ -571,12 +571,12 @@ public class AccountCurrentController(
|
|||||||
.Where(device => device.AccountId == currentUser.Id)
|
.Where(device => device.AccountId == currentUser.Id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
var sessionDevices = devices.Select(SnAuthClientWithSessions.FromClient).ToList();
|
var sessionDevices = devices.ConvertAll(SnAuthClientWithSessions.FromClient).ToList();
|
||||||
var clientIds = sessionDevices.Select(x => x.Id).ToList();
|
var clientIds = sessionDevices.Select(x => x.Id).ToList();
|
||||||
|
|
||||||
var authSessions = await db.AuthSessions
|
var authSessions = await db.AuthSessions
|
||||||
.Where(c => clientIds.Contains(c.Id))
|
.Where(c => c.ClientId != null && clientIds.Contains(c.ClientId.Value))
|
||||||
.GroupBy(c => c.Id)
|
.GroupBy(c => c.ClientId!.Value)
|
||||||
.ToDictionaryAsync(c => c.Key, c => c.ToList());
|
.ToDictionaryAsync(c => c.Key, c => c.ToList());
|
||||||
foreach (var dev in sessionDevices)
|
foreach (var dev in sessionDevices)
|
||||||
if (authSessions.TryGetValue(dev.Id, out var challenge))
|
if (authSessions.TryGetValue(dev.Id, out var challenge))
|
||||||
@@ -956,4 +956,4 @@ public class AccountCurrentController(
|
|||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
return Ok(records);
|
return Ok(records);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user