Hardened API and catered for Partner role query filter bypass
This commit is contained in:
@@ -98,7 +98,7 @@ public sealed class UserService(IDbContextFactory<ApplicationDbContext> contextF
|
||||
changedTotal += await context.Users.Where(f => f.Id == userId)
|
||||
.ExecuteUpdateAsync(f => f.SetProperty(u => u.Status, status), cancellationToken);
|
||||
|
||||
return Result.OkIf(changedTotal > 0, UpdateError.New);
|
||||
return Result.OkIf(changedTotal > 0, UpdateError.Create("Failed to update user status."));
|
||||
}));
|
||||
|
||||
public async Task<Result<User>> GetUserAsync(Guid userId, CancellationToken cancellationToken) =>
|
||||
@@ -110,7 +110,7 @@ public sealed class UserService(IDbContextFactory<ApplicationDbContext> contextF
|
||||
.Include(i => i.User)
|
||||
.FirstOrDefaultAsync(f => f.UserId == userId, cancellationToken);
|
||||
|
||||
return Result.FailIf(tenantUser == null, NotFoundError.New)
|
||||
return Result.FailIf(tenantUser == null, NotFoundError.Create("User not found."))
|
||||
.ToResult(tenantUser!.User?.Map()!);
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user