Skip to content

Commit

Permalink
Partial implementation updated
Browse files Browse the repository at this point in the history
  • Loading branch information
AnuragNagpure authored and Phil91 committed Feb 17, 2024
1 parent 27b5391 commit f2b2874
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public IAsyncEnumerable<VerifiedCredentialTypeId> GetCertificateTypes() =>
_portalRepositories.GetInstance<ICompanySsiDetailsRepository>().GetCertificateTypes(_identityData.CompanyId);

/// <inheritdoc />
public IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificatesBpnOthers(string businessPartnerNumber)
public async Task<IEnumerable<CompanyCertificateBpnData>> GetCompanyCertificatesBpnOthers(string businessPartnerNumber)
{
if (string.IsNullOrWhiteSpace(businessPartnerNumber))
{
Expand All @@ -629,7 +629,7 @@ public IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificatesBpnOthe

var companyId = await companyCertificateRepository.GetCompanyId(businessPartnerNumber).ConfigureAwait(false);

await companyCertificateRepository.GetCompanyCertificateData(companyId.Id);
return await companyCertificateRepository.GetCompanyCertificateData(companyId.Id);
}

public Task<Pagination.Response<CompanyCertificateData>> GetAllCompanyCertificatesAsync(int page, int size, CertificateSorting? sorting, CompanyCertificateStatusId? certificateStatus, CompanyCertificateTypeId? certificateType) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface ICompanyDataBusinessLogic
Task RejectCredential(Guid credentialId);

IAsyncEnumerable<VerifiedCredentialTypeId> GetCertificateTypes();
IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificatesBpnOthers(string businessPartnerNumber);
Task<IEnumerable<CompanyCertificateBpnData>> GetCompanyCertificatesBpnOthers(string businessPartnerNumber);
Task CreateCompanyCertificate(CompanyCertificateCreationData data, CancellationToken cancellationToken);

Task<Pagination.Response<CompanyCertificateData>> GetAllCompanyCertificatesAsync(int page, int size, CertificateSorting? sorting, CompanyCertificateStatusId? certificateStatus, CompanyCertificateTypeId? certificateType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,11 @@ public async Task<NoContentResult> RejectCredential([FromRoute] Guid credentialI
}

/// <summary>
/// Gets the companyrole and ConsentAgreement Details
/// Gets the companyCertificates Details
/// </summary>
/// <returns>the Companyrole and ConsentAgreement details</returns>
/// <remarks>Example: GET: api/administration/companydata/companyRolesAndConsents</remarks>
/// <response code="200">Returns the Companyrole and Consent details.</response>
/// <response code="400">languageShortName is not valid</response>
/// <response code="404">CompanyId does not exist in company</response>
/// <response code="409">No Companyrole or Incorrect Status</response>
/// <returns>the companyCertificates details</returns>
/// <remarks>Example: GET: api/administration/companydata/businessPartnerNumber}/companyCertificates</remarks>
/// <response code="200">Returns the companyCertificates details.</response>
[HttpGet]
[Authorize(Roles = "view_certificates")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
Expand All @@ -404,6 +401,6 @@ public async Task<NoContentResult> RejectCredential([FromRoute] Guid credentialI
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificatesBpn([FromQuery] string businessPartnerNumber) =>
_logic.GetCompanyCertificatesBpnOthers(businessPartnerNumber);
public async IEnumerable<CompanyCertificateBpnData> GetCompanyCertificatesBpn([FromQuery] string businessPartnerNumber) =>
await _logic.GetCompanyCertificatesBpnOthers(businessPartnerNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public CompanyCertificate CreateCompanyCertificate(Guid companyId, CompanyCertif
_context.Companies.Where(x => x.BusinessPartnerNumber == businessPartnerNumber).SingleOrDefaultAsync();

/// <inheritdoc />
public IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificateData(Guid companyId) =>
public async Task<IEnumerable<CompanyCertificateBpnData>> GetCompanyCertificateData(Guid companyId) =>
_context.CompanyCertificates
.Where(x => x.CompanyId == companyId)
.Select(ccb => new CompanyCertificateBpnData(
Expand All @@ -67,7 +67,7 @@ public IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificateData(Gui
ccb.DocumentId,
ccb.ValidFrom,
ccb.ValidTill))
.AsAsyncEnumerable();
.AsEnumerable();

public Func<int, int, Task<Pagination.Source<CompanyCertificateData>?>> GetActiveCompanyCertificatePaginationSource(CertificateSorting? sorting, CompanyCertificateStatusId? certificateStatus, CompanyCertificateTypeId? certificateType, Guid companyId) =>
(skip, take) => Pagination.CreateSourceQueryAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public interface ICompanyCertificateRepository
/// </summary>
/// <param name="companyId">Id of the company</param>
/// <returns>Returns the CompanyCertificateBpnData Details</returns>
IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificateData(Guid companyId);
Task<IEnumerable<CompanyCertificateBpnData>> GetCompanyCertificateData(Guid companyId);

/// <summary>
/// Gets all company certificate data from the persistence storage as pagination
Expand Down

0 comments on commit f2b2874

Please sign in to comment.