This commit is contained in:
parent
864c348531
commit
c89ecf8cda
11 changed files with 3729 additions and 18 deletions
|
|
@ -29,10 +29,12 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly PermissionRepository _permission;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
|
||||
public DisciplineDirectorController(DisciplineDbContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
UserProfileRepository userProfileRepository,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
// _repository = repository;
|
||||
|
|
@ -40,6 +42,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_permission = permission;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -47,6 +50,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -279,7 +283,13 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
var profile = await _userProfileRepository.GetUserOC(userId, token.Replace("Bearer ", ""));
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound);
|
||||
|
||||
var data = await _context.DisciplineInvestigates
|
||||
.Where(x => x.RootDnaId == profile.RootDnaId || x.RootDnaId == null)
|
||||
.Where(x => x.DisciplineInvestigate_Directors
|
||||
.Where(x => x.DisciplineDirector == director)
|
||||
.FirstOrDefault() != null
|
||||
|
|
@ -316,7 +326,13 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, token.Replace("Bearer ", ""));
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound);
|
||||
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Where(x => x.RootDnaId == profile.RootDnaId || x.RootDnaId == null)
|
||||
.Where(x => x.DisciplineDisciplinary_DirectorInvestigates
|
||||
.Where(x => x.DisciplineDirector == director)
|
||||
.FirstOrDefault() != null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue