This commit is contained in:
parent
864c348531
commit
c89ecf8cda
11 changed files with 3729 additions and 18 deletions
|
|
@ -33,12 +33,14 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly PermissionRepository _permission;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
|
||||
public DisciplineComplaintController(DisciplineDbContext context,
|
||||
MinIODisciplineService documentService,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
// _repository = repository;
|
||||
|
|
@ -48,6 +50,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
_repositoryNoti = repositoryNoti;
|
||||
_permission = permission;
|
||||
_configuration = configuration;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -299,6 +302,11 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
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 disciplineComplaint = new Domain.Models.Discipline.DisciplineComplaint
|
||||
{
|
||||
RespondentType = req.respondentType.Trim().ToUpper(),
|
||||
|
|
@ -310,6 +318,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
Title = req.title,
|
||||
Description = req.description,
|
||||
DateReceived = req.dateReceived,
|
||||
RootDnaId = profile.RootDnaId,
|
||||
LevelConsideration = req.levelConsideration == null ? null : req.levelConsideration.Trim().ToUpper(),
|
||||
DateConsideration = req.dateConsideration,
|
||||
OffenseDetails = req.offenseDetails == null ? null : req.offenseDetails.Trim().ToUpper(),
|
||||
|
|
@ -582,6 +591,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
{
|
||||
RespondentType = data.RespondentType.Trim().ToUpper(),
|
||||
Organization = data.Organization,
|
||||
RootDnaId = data.RootDnaId,
|
||||
ConsideredAgency = data.ConsideredAgency,
|
||||
OrganizationId = data.OrganizationId,
|
||||
ConsideredAgencyId = data.ConsideredAgencyId,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -674,6 +674,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
{
|
||||
RespondentType = data.RespondentType.Trim().ToUpper(),
|
||||
Organization = data.Organization,
|
||||
RootDnaId = data.RootDnaId,
|
||||
ConsideredAgency = data.ConsideredAgency,
|
||||
OrganizationId = data.OrganizationId,
|
||||
ConsideredAgencyId = data.ConsideredAgencyId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue