refactor(ReadProfile): update to read buttons
This commit is contained in:
parent
559127a931
commit
82eb03b420
@ -5,4 +5,5 @@ namespace WorkFlow.Application.Contracts.Repositories;
|
||||
|
||||
public interface IButtonRepository : ICRUDRepository<Button, int>
|
||||
{
|
||||
public Task<IEnumerable<Button>> ReadAllAsync(int profileId);
|
||||
}
|
||||
@ -19,15 +19,18 @@ public class ReadProfileHandler : IRequestHandler<ReadProfile, Domain.Entities.P
|
||||
|
||||
private readonly IProfileObjRepository _objRepository;
|
||||
|
||||
private readonly IButtonRepository _bttnRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReadProfileHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="profileRepository">The profile repository used to access profile data.</param>
|
||||
/// <param name="objRepository">The profile object repository used to access object data.</param>
|
||||
public ReadProfileHandler(IProfileRepository profileRepository, IProfileObjRepository objRepository)
|
||||
public ReadProfileHandler(IProfileRepository profileRepository, IProfileObjRepository objRepository, IButtonRepository buttonRepository)
|
||||
{
|
||||
_profileRepository = profileRepository;
|
||||
_objRepository = objRepository;
|
||||
_bttnRepository = buttonRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -43,6 +46,11 @@ public class ReadProfileHandler : IRequestHandler<ReadProfile, Domain.Entities.P
|
||||
if (request.IncludeObject && profile?.Id is int profileId)
|
||||
profile.Objects = await _objRepository.ReadAsync(request.UserId, profileId, cancel);
|
||||
|
||||
if(profile?.Id is int pId)
|
||||
{
|
||||
var bttns = await _bttnRepository.ReadAllAsync(pId);
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user