Removed the tenant check from find employee query in document controller
This commit is contained in:
parent
7659eadd00
commit
0066e20c43
@ -35,6 +35,7 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
private readonly ILoggingService _logger;
|
private readonly ILoggingService _logger;
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly Guid tenantId;
|
private readonly Guid tenantId;
|
||||||
|
private readonly Guid organizationId;
|
||||||
|
|
||||||
private static readonly Guid ProjectEntity = Guid.Parse("c8fe7115-aa27-43bc-99f4-7b05fabe436e");
|
private static readonly Guid ProjectEntity = Guid.Parse("c8fe7115-aa27-43bc-99f4-7b05fabe436e");
|
||||||
private static readonly Guid EmployeeEntity = Guid.Parse("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7");
|
private static readonly Guid EmployeeEntity = Guid.Parse("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7");
|
||||||
@ -52,6 +53,7 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||||
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
||||||
tenantId = userHelper.GetTenantId();
|
tenantId = userHelper.GetTenantId();
|
||||||
|
organizationId = _userHelper.GetCurrentOrganizationId();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("list/{entityTypeId}/entity/{entityId}")]
|
[HttpGet("list/{entityTypeId}/entity/{entityId}")]
|
||||||
@ -107,7 +109,7 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
else if (EmployeeEntity == entityTypeId)
|
else if (EmployeeEntity == entityTypeId)
|
||||||
{
|
{
|
||||||
var isEmployeeExists = await _context.Employees
|
var isEmployeeExists = await _context.Employees
|
||||||
.AnyAsync(e => e.Id == entityId && e.TenantId == tenantId);
|
.AnyAsync(e => e.Id == entityId && e.OrganizationId == organizationId);
|
||||||
|
|
||||||
if (!isEmployeeExists)
|
if (!isEmployeeExists)
|
||||||
{
|
{
|
||||||
@ -691,7 +693,7 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
bool entityExists = false;
|
bool entityExists = false;
|
||||||
if (entityType.Equals(EmployeeEntity))
|
if (entityType.Equals(EmployeeEntity))
|
||||||
{
|
{
|
||||||
entityExists = await _context.Employees.AnyAsync(e => e.Id == model.EntityId && e.TenantId == tenantId);
|
entityExists = await _context.Employees.AnyAsync(e => e.Id == model.EntityId && e.OrganizationId == organizationId);
|
||||||
}
|
}
|
||||||
else if (entityType.Equals(ProjectEntity))
|
else if (entityType.Equals(ProjectEntity))
|
||||||
{
|
{
|
||||||
@ -1078,7 +1080,7 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
bool entityExists;
|
bool entityExists;
|
||||||
if (entityType.Equals(EmployeeEntity))
|
if (entityType.Equals(EmployeeEntity))
|
||||||
{
|
{
|
||||||
entityExists = await _context.Employees.AnyAsync(e => e.Id == oldAttachment.EntityId && e.TenantId == tenantId);
|
entityExists = await _context.Employees.AnyAsync(e => e.Id == oldAttachment.EntityId && e.OrganizationId == organizationId);
|
||||||
}
|
}
|
||||||
else if (entityType.Equals(ProjectEntity))
|
else if (entityType.Equals(ProjectEntity))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user