Fix incorrect conditional logic in ReadRecActionQueryHandler

The conditional check in the `Handle` method of the
`ReadRecActionQueryHandler` class was updated. Previously, the code
threw a `NotFoundException` if the `actions` list was not empty
(`actions.Count != 0`). This logic was inverted to throw the exception
when the `actions` list is empty (`actions.Count == 0`).

This change ensures the exception is thrown only when no actions are
found for the given profile, aligning with the intended behavior
described in the exception message.
This commit is contained in:
tekh 2025-12-03 12:06:47 +01:00
parent a7f4677ad1
commit b67da5434e

View File

@ -28,7 +28,7 @@ public class ReadRecActionQueryHandler(IRepository<RecActionView> repo, IMapper
{
var actions = await repo.Where(x => x.ProfileId == request.ProfileId).ToListAsync(cancel);
if(actions.Count != 0)
if(actions.Count == 0)
throw new NotFoundException($"No actions found for the profile {request.ProfileId}.");
return mapper.Map<IEnumerable<RecActionDto>>(actions);