Stuff works
This commit is contained in:
@@ -10,10 +10,16 @@ public class Viewer : BaseEntity<ulong>
|
||||
/// <summary>
|
||||
/// This user's name displayed in game.
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
public string DisplayName { get; set; } = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// This user's short identifier.
|
||||
/// </summary>
|
||||
public ulong ShortUdid { get; set; }
|
||||
|
||||
#region Navigation Properties
|
||||
|
||||
public List<SocialAccountConnection> SocialAccountConnections { get; set; } = new List<SocialAccountConnection>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -5,4 +5,5 @@ namespace SVSim.Database.Repositories.Viewer;
|
||||
public interface IViewerRepository
|
||||
{
|
||||
Task<Models.Viewer?> GetViewerBySocialConnection(SocialAccountType accountType, ulong socialId);
|
||||
Task<Models.Viewer?> GetViewerWithSocials(ulong id);
|
||||
}
|
||||
@@ -15,10 +15,16 @@ public class ViewerRepository : IViewerRepository
|
||||
|
||||
public async Task<Models.Viewer?> GetViewerBySocialConnection(SocialAccountType accountType, ulong socialId)
|
||||
{
|
||||
return _dbContext.Set<SocialAccountConnection>()
|
||||
.AsNoTracking()
|
||||
.Include(sac => sac.Viewer)
|
||||
.FirstOrDefault(sac => sac.AccountType == accountType && sac.AccountId == socialId)
|
||||
return (await _dbContext.Set<SocialAccountConnection>()
|
||||
.AsNoTracking()
|
||||
.Include(sac => sac.Viewer)
|
||||
.FirstOrDefaultAsync(sac => sac.AccountType == accountType && sac.AccountId == socialId))
|
||||
?.Viewer;
|
||||
}
|
||||
|
||||
public async Task<Models.Viewer?> GetViewerWithSocials(ulong id)
|
||||
{
|
||||
return await _dbContext.Set<Models.Viewer>().AsNoTracking().Include(viewer => viewer.SocialAccountConnections)
|
||||
.FirstOrDefaultAsync(viewer => viewer.Id == id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user