From b67da5434e0e3b3545f26d3e84757020d81ca0a8 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 3 Dec 2025 12:06:47 +0100 Subject: [PATCH] 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. --- src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs b/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs index 54922ed..2b3202d 100644 --- a/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs +++ b/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs @@ -28,7 +28,7 @@ public class ReadRecActionQueryHandler(IRepository 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>(actions);