Skip to content

Commit

Permalink
Fixed Crash Report screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Jul 1, 2024
1 parent 20ff11e commit 1ff015b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private async Task<Paging<UserCrashReportModel>> GetPaginatedBaseAsync(NexusMods
await using var unitOfRead = _unitOfWorkFactory.CreateUnitOfRead();

var user = await unitOfRead.NexusModsUsers.GetUserAsync(userId, ct);
return await unitOfRead.CrashReports.GetCrashReportsPaginatedAsync(user!, new PaginatedQuery(page, pageSize, filters, sortings), HttpContext.GetRole(), ct);
return await unitOfRead.CrashReports.GetCrashReportsPaginatedAsync(user, new PaginatedQuery(page, pageSize, filters, sortings), HttpContext.GetRole(), ct);
}

[HttpPost("Paginated")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ IQueryable<UserCrashReportModel> DbQueryBase(Expression<Func<CrashReportEntity,
var dbQuery = applicationRole == ApplicationRoles.Administrator || applicationRole == ApplicationRoles.Moderator
? DbQueryBase(x => true)
: DbQueryBase(x => x.ToUsers.Any(y => y.NexusModsUser.NexusModsUserId == user.NexusModsUserId) ||
x.ModuleInfos.Any(y => moduleIds.Contains(y.Module.ModuleId)) ||
x.ModuleInfos.Where(y => y.NexusModsMod != null).Any(y => nexusModsModIds.Contains(y.NexusModsMod!.NexusModsModId)));
x.ModuleInfos.Any(y => moduleIds.Contains(y.Module.ModuleId)) ||
x.ModuleInfos.Any(y => nexusModsModIds.Contains(y.NexusModsMod!.NexusModsModId)));

//return await dbQuery.PaginatedGroupedAsync(query.Page, query.PageSize, ct);
return await dbQuery.PaginatedAsync(query.Page, query.PageSize, ct);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public sealed record UserLinkedModModel
public interface INexusModsUserRepositoryRead : IRepositoryRead<NexusModsUserEntity>
{
Task<NexusModsUserEntity?> GetUserWithIntegrationsAsync(NexusModsUserId userId, CancellationToken ct);
Task<NexusModsUserEntity?> GetUserAsync(NexusModsUserId userId, CancellationToken ct);
Task<NexusModsUserEntity> GetUserAsync(NexusModsUserId userId, CancellationToken ct);

Task<Paging<UserLinkedModModel>> GetNexusModsModsPaginatedAsync(NexusModsUserId userId, PaginatedQuery query, CancellationToken ct);

Expand All @@ -60,11 +60,11 @@ internal class NexusModsUserRepository : Repository<NexusModsUserEntity>, INexus

public NexusModsUserRepository(IAppDbContextProvider appDbContextProvider) : base(appDbContextProvider.Get()) { }

public async Task<NexusModsUserEntity?> GetUserAsync(NexusModsUserId userId, CancellationToken ct) => await _dbContext.NexusModsUsers
public async Task<NexusModsUserEntity> GetUserAsync(NexusModsUserId userId, CancellationToken ct) => await _dbContext.NexusModsUsers
.Include(x => x.ToModules).ThenInclude(x => x.Module)
.Include(x => x.ToNexusModsMods).ThenInclude(x => x.NexusModsMod)
.AsSplitQuery()
.FirstAsync(x => x.NexusModsUserId == userId, ct);
.FirstOrDefaultAsync(x => x.NexusModsUserId == userId, ct) ?? NexusModsUserEntity.Create(userId);

public async Task<NexusModsUserEntity?> GetUserWithIntegrationsAsync(NexusModsUserId userId, CancellationToken ct) => await _dbContext.NexusModsUsers
.Include(x => x.ToRoles)
Expand Down

0 comments on commit 1ff015b

Please sign in to comment.