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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user