Skip to content

Commit

Permalink
Merge pull request #428 from SkillsFundingAgency/DPP-1695-remove-conn…
Browse files Browse the repository at this point in the history
…ected-company-pages-linked-to-provider-permissions

Dpp 1695 remove connected company pages linked to provider permissions
  • Loading branch information
satya-sanikommu authored Nov 13, 2018
2 parents 12a809f + 16d2e18 commit d17e21d
Show file tree
Hide file tree
Showing 50 changed files with 16 additions and 1,605 deletions.
8 changes: 0 additions & 8 deletions src/AzureTopicConfigurationStrucuture.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@
{
"topicName": "provider_cohort_approval_undone_by_employer",
"subscription": [ "Task_ProviderCohortApprovalUndoneByEmployer" ]
},
{
"topicName": "relationship_created",
"subscription": [ "RDS_RelationshipCreated" ]
},
{
"topicName": "relationship_verified",
"subscription": [ "RDS_RelationshipVerified" ]
}
]

13 changes: 0 additions & 13 deletions src/SFA.DAS.Commitments.Api.Client/Interfaces/IRelationshipApi.cs

This file was deleted.

56 changes: 0 additions & 56 deletions src/SFA.DAS.Commitments.Api.Client/RelationshipApi.cs

This file was deleted.

16 changes: 0 additions & 16 deletions src/SFA.DAS.Commitments.Api.Types/Relationship.cs

This file was deleted.

8 changes: 0 additions & 8 deletions src/SFA.DAS.Commitments.Api.Types/RelationshipRequest.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using SFA.DAS.Commitments.Api.Orchestrators.Mappers;
using SFA.DAS.Commitments.Api.Types.Commitment;
using SFA.DAS.Commitments.Application.Commands.CreateCommitment;
using SFA.DAS.Commitments.Application.Queries.GetRelationship;
using SFA.DAS.Commitments.Domain.Interfaces;
using SFA.DAS.HashingService;
using Commitment = SFA.DAS.Commitments.Api.Types.Commitment.Commitment;
Expand All @@ -39,8 +38,6 @@ public void Setup()
_mappedCommitment = new Fixture().Create<Domain.Entities.Commitment>();
_commitmentMapper.Setup(m => m.MapFrom(It.IsAny<Commitment>()))
.Returns(_mappedCommitment);
_mockMediator.Setup(m => m.SendAsync(It.IsAny<GetRelationshipRequest>()))
.ReturnsAsync(new GetRelationshipResponse());

_employerOrchestrator = new EmployerOrchestrator(
_mockMediator.Object,
Expand Down
24 changes: 0 additions & 24 deletions src/SFA.DAS.Commitments.Api/Controllers/ProviderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,30 +181,6 @@ public async Task<IHttpActionResult> DeleteApprenticeship(long providerId, long
return StatusCode(HttpStatusCode.NoContent);
}

[Route("{providerId}/relationships/{employerAccountId}/{legalEntityId}")]
[AuthorizeRemoteOnly(Roles = "Role1")]
public async Task<IHttpActionResult> GetRelationshipByProviderAndLegalEntityId(long providerId, long employerAccountId, string legalEntityId)
{
var response = await _providerOrchestrator.GetRelationship(providerId, employerAccountId, legalEntityId);
return Ok(response);
}

[Route("{providerId}/relationships/{commitmentId}")]
[AuthorizeRemoteOnly(Roles = "Role1")]
public async Task<IHttpActionResult> GetRelationshipByCommitment(long providerId, long commitmentId)
{
var response = await _providerOrchestrator.GetRelationship(providerId, commitmentId);
return Ok(response);
}

[Route("{providerId}/relationships/{employerAccountId}/{legalEntityId}")]
[AuthorizeRemoteOnly(Roles = "Role1")]
public async Task<IHttpActionResult> PatchRelationship(long providerId, long employerAccountId, string legalEntityId, [FromBody] RelationshipRequest request)
{
await _providerOrchestrator.PatchRelationship(providerId, employerAccountId, legalEntityId, request);
return StatusCode(HttpStatusCode.NoContent);
}

[Route("{providerId}/apprenticeships/{apprenticeshipId}/update")]
[AuthorizeRemoteOnly(Roles = "Role1")]
public async Task<IHttpActionResult> GetPendingApprenticeshipUpdate(long providerId, long apprenticeshipId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public DefaultRegistry()
For<IBulkUploadRepository>().Use<BulkUploadRepository>().Ctor<string>().Is(config.DatabaseConnectionString);
For<IProviderPaymentRepository>().Use<ProviderPaymentRepository>().Ctor<string>().Is(config.DatabaseConnectionString);
For<IStatisticsRepository>().Use<StatisticsRepository>().Ctor<string>().Is(config.DatabaseConnectionString);
For<IRelationshipRepository>().Use<RelationshipRepository>().Ctor<string>().Is(config.DatabaseConnectionString);

For<SingleInstanceFactory>().Use<SingleInstanceFactory>(ctx => t => ctx.GetInstance(t));
For<MultiInstanceFactory>().Use<MultiInstanceFactory>(ctx => t => ctx.GetAllInstances(t));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
using Originator = SFA.DAS.Commitments.Api.Types.Apprenticeship.Types.Originator;
using PaymentStatus = SFA.DAS.Commitments.Api.Types.Apprenticeship.Types.PaymentStatus;
using ProviderPaymentPriorityItem = SFA.DAS.Commitments.Api.Types.ProviderPayment.ProviderPaymentPriorityItem;
using Relationship = SFA.DAS.Commitments.Domain.Entities.Relationship;
using TransferApprovalStatus = SFA.DAS.Commitments.Api.Types.TransferApprovalStatus;

namespace SFA.DAS.Commitments.Api.Orchestrators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public interface IProviderOrchestrator
Task ApproveCohort(long providerId, long commitmentId, CommitmentSubmission submission);
Task DeleteApprenticeship(long providerId, long apprenticeshipId, string userId, string userName);
Task DeleteCommitment(long providerId, long commitmentId, string userId, string userName);
Task<Types.Relationship> GetRelationship(long providerId, long employerAccountId, string legalEntityId);
Task<Types.Relationship> GetRelationship(long providerId, long commitmentId);
Task PatchRelationship(long providerId, long employerAccountId, string legalEntityId, RelationshipRequest patchRequest);
Task<Types.Apprenticeship.ApprenticeshipUpdate> GetPendingApprenticeshipUpdate(long providerId, long apprenticeshipId);
Task CreateApprenticeshipUpdate(long providerId, ApprenticeshipUpdateRequest updateRequest);
Task PatchApprenticeshipUpdate(long providerId, long apprenticeshipId, ApprenticeshipUpdateSubmission submission);
Expand Down
79 changes: 0 additions & 79 deletions src/SFA.DAS.Commitments.Api/Orchestrators/ProviderOrchestrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
using SFA.DAS.Commitments.Application.Commands.DeleteCommitment;
using SFA.DAS.Commitments.Application.Commands.UpdateApprenticeship;
using SFA.DAS.Commitments.Application.Commands.UpdateCommitmentAgreement;
using SFA.DAS.Commitments.Application.Commands.VerifyRelationship;
using SFA.DAS.Commitments.Application.Queries.GetApprenticeship;
using SFA.DAS.Commitments.Application.Queries.GetApprenticeships;
using SFA.DAS.Commitments.Application.Queries.GetBulkUploadFile;
using SFA.DAS.Commitments.Application.Queries.GetCommitment;
using SFA.DAS.Commitments.Application.Queries.GetCommitments;
using SFA.DAS.Commitments.Application.Queries.GetPendingApprenticeshipUpdate;
using SFA.DAS.Commitments.Application.Queries.GetRelationship;
using SFA.DAS.Commitments.Application.Queries.GetRelationshipByCommitment;
using SFA.DAS.Commitments.Domain;
using SFA.DAS.Commitments.Domain.Interfaces;

Expand All @@ -39,7 +36,6 @@
using SFA.DAS.Commitments.Domain.Entities;

using Apprenticeship = SFA.DAS.Commitments.Api.Types.Apprenticeship.Apprenticeship;
using Relationship = SFA.DAS.Commitments.Domain.Entities.Relationship;

namespace SFA.DAS.Commitments.Api.Orchestrators
{
Expand Down Expand Up @@ -351,65 +347,6 @@ await _mediator.SendAsync(new DeleteCommitmentCommand
_logger.Info($"Deleted commitment {commitmentId} for provider {providerId}", providerId: providerId, commitmentId: commitmentId);
}

public async Task<Types.Relationship> GetRelationship(long providerId, long employerAccountId, string legalEntityId)
{
_logger.Trace($"Getting relationship for provider {providerId}, employer {employerAccountId}, legal entity {legalEntityId}", employerAccountId, providerId);

var response = await _mediator.SendAsync(new GetRelationshipRequest
{
Caller = new Caller(providerId, CallerType.Provider),
ProviderId = providerId,
EmployerAccountId = employerAccountId,
LegalEntityId = legalEntityId
});

if (response.Data == null)
{
_logger.Info($"Relationship not found for provider {providerId}, employer {employerAccountId}, legal entity {legalEntityId}", employerAccountId, providerId);
return null;
}

_logger.Info($"Retrieved relationship for provider {providerId}, employer {employerAccountId}, legal entity {legalEntityId}", employerAccountId, providerId);

return Map(response.Data);
}

public async Task<Types.Relationship> GetRelationship(long providerId, long commitmentId)
{
_logger.Trace($"Getting relationship for provider {providerId}, commitment {commitmentId}", null, providerId, commitmentId);

var response = await _mediator.SendAsync(new GetRelationshipByCommitmentRequest
{
Caller = new Caller(providerId, CallerType.Provider),
ProviderId = providerId,
CommitmentId = commitmentId
});

if (response.Data != null)
_logger.Info($"Getting relationship for provider {providerId}, commitment {commitmentId}", null, providerId, commitmentId);
else
_logger.Info($"Relationship not found for provider {providerId}, commitment {commitmentId}", null, providerId, commitmentId);

return Map(response.Data);
}

public async Task PatchRelationship(long providerId, long employerAccountId, string legalEntityId, RelationshipRequest patchRequest)
{
_logger.Trace($"Verifying relationship for provider {providerId}, employer {employerAccountId}, legal entity {legalEntityId}", employerAccountId, providerId);

await _mediator.SendAsync(new VerifyRelationshipCommand
{
Caller = new Caller(providerId, CallerType.Provider),
ProviderId = providerId,
EmployerAccountId = employerAccountId,
LegalEntityId = legalEntityId,
UserId = patchRequest.UserId,
Verified = patchRequest.Relationship.Verified
});

_logger.Info($"Verified relationship for provider {providerId}, employer {employerAccountId}, legal entity {legalEntityId}", employerAccountId, providerId);
}

public async Task<Types.Apprenticeship.ApprenticeshipUpdate> GetPendingApprenticeshipUpdate(long providerId, long apprenticeshipId)
{
_logger.Trace($"Getting pending update for apprenticeship {apprenticeshipId} for provider account {providerId}", providerId: providerId, apprenticeshipId: apprenticeshipId);
Expand Down Expand Up @@ -516,21 +453,5 @@ public async Task<string> GetBulkUploadFile(long providerId, long bulkUploadFile
_logger.Info($"Retrieved bulk upload for provider {providerId}", providerId: providerId);
return result.Data;
}

private Types.Relationship Map(Relationship entity)
{
return new Types.Relationship
{
EmployerAccountId = entity.EmployerAccountId,
Id = entity.Id,
LegalEntityId = entity.LegalEntityId,
LegalEntityName = entity.LegalEntityName,
LegalEntityAddress = entity.LegalEntityAddress,
LegalEntityOrganisationType = entity.LegalEntityOrganisationType,
ProviderId = entity.ProviderId,
ProviderName = entity.ProviderName,
Verified = entity.Verified
};
}
}
}
Loading

0 comments on commit d17e21d

Please sign in to comment.