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.
This commit is contained in:
tekh 2025-12-04 10:06:56 +01:00
parent 2de0b5bfa3
commit aa34bdd279
2 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,9 @@ public class ReadOutResHandler(IRepository<OutRes> 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<OutResDto>(dtos);

View File

@ -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; }