From aa34bdd279be0ade9e220de22a1e5d2f7eb26398 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 4 Dec 2025 10:06:56 +0100 Subject: [PATCH] Add ProfileId filter and navigation property to OutRes Enhanced `ReadOutResHandler` to support filtering by `ProfileId` when querying `OutRes` entities. This was implemented by adding a condition to filter results based on the `ProfileId` of the associated `Action`. Updated the `OutRes` class to include a navigation property `Action`, annotated with `[ForeignKey]` to link it to the `ActionId` column. This establishes a relationship between `OutRes` and `RecAction`, improving data access and maintainability. --- src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs | 3 +++ src/ReC.Domain/Entities/OutRes.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs b/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs index 46a58a3..13791ab 100644 --- a/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs +++ b/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs @@ -23,6 +23,9 @@ public class ReadOutResHandler(IRepository repo, IMapper mapper) : IRequ if(request.ActionId is long actionId) q = q.Where(res => res.ActionId == actionId); + if(request.ProfileId is long profileId) + q = q.Where(res => res.Action!.ProfileId == profileId); + var dtos = await q.ToListAsync(cancel); return mapper.Map(dtos); diff --git a/src/ReC.Domain/Entities/OutRes.cs b/src/ReC.Domain/Entities/OutRes.cs index 5c2264c..e669f17 100644 --- a/src/ReC.Domain/Entities/OutRes.cs +++ b/src/ReC.Domain/Entities/OutRes.cs @@ -14,6 +14,9 @@ public class OutRes [Column("ACTION_ID")] public long? ActionId { get; set; } + [ForeignKey("ActionId")] + public RecAction? Action { get; set; } + [Column("RESULT_HEADER")] public string? Header { get; set; }