Skip to content

Commit

Permalink
fix(administration) : add swagger documentation for companyData endpo…
Browse files Browse the repository at this point in the history
…ints (#162)

Ref : CPLP -2946
Reviewed-By: Phil Schneider <[email protected]>
  • Loading branch information
VPrasannaK94 authored Jul 25, 2023
1 parent eb3e55e commit 13abfa4
Showing 1 changed file with 41 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ await this.WithCompanyId(companyId => _logic.CreateCompanyAssignedUseCaseDetails
/// </summary>
/// <remarks>Example: DELETE: api/administration/companydata/preferredUseCases</remarks>
/// <response code="204">NoContentResult</response>
/// <response code="409">Company Status is Incorrect</response>
/// <response code="409">UseCaseId is not available</response>
/// <response code="409">
/// Company Status is Incorrect <br />
/// UseCaseId is not available
/// </response>
[HttpDelete]
[Authorize(Roles = "set_company_use_cases")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
Expand All @@ -125,13 +127,16 @@ public async Task<NoContentResult> RemoveCompanyAssignedUseCaseDetailsAsync([Fro
/// <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>
[HttpGet]
[Authorize(Roles = "view_company_data")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("companyRolesAndConsents")]
[ProducesResponseType(typeof(CompanyRoleConsentViewData), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public IAsyncEnumerable<CompanyRoleConsentViewData> GetCompanyRoleAndConsentAgreementDetailsAsync([FromQuery] string? languageShortName = null) =>
this.WithCompanyId(companyId => _logic.GetCompanyRoleAndConsentAgreementDetailsAsync(companyId, languageShortName));
Expand All @@ -142,8 +147,15 @@ public IAsyncEnumerable<CompanyRoleConsentViewData> GetCompanyRoleAndConsentAgre
/// <returns>Create Companyrole and Consent details</returns>
/// <remarks>Example: POST: api/administration/companydata/companyRolesAndConsents</remarks>
/// <response code="204">Created the Companyrole and Consent details.</response>
/// <response code="409">companyRole already exists</response>
/// <response code="409">All agreement need to get signed</response>
/// <response code="400">
/// All agreement need to get signed as Active or InActive <br />
/// Agreements not associated with requested companyRoles
/// </response>
/// <response code="409">
/// Company does not exists <br />
/// Company is in Incorrect state <br />
/// Company can't unassign from all roles
/// </response>
[HttpPost]
[Authorize(Roles = "view_company_data")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
Expand All @@ -164,11 +176,13 @@ public async Task<NoContentResult> CreateCompanyRoleAndConsentAgreementDetailsAs
/// <remarks>Example: Get: api/administration/companydata/useCaseParticipation</remarks>
/// <returns>All UseCaseParticipations of the own company</returns>
/// <response code="200">Returns a collection of UseCaseParticipation.</response>
/// <response code="409">There should only be one pending or active ssi detail be assigned</response>
[HttpGet]
[Authorize(Roles = "view_use_case_participation")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("useCaseParticipation")]
[ProducesResponseType(typeof(IEnumerable<UseCaseParticipationData>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public Task<IEnumerable<UseCaseParticipationData>> GetUseCaseParticipation([FromQuery] string? language) =>
this.WithCompanyId(companyId => _logic.GetUseCaseParticipationAsync(companyId, language));

Expand All @@ -178,11 +192,13 @@ public Task<IEnumerable<UseCaseParticipationData>> GetUseCaseParticipation([From
/// <returns>All ssi certifications of the own company</returns>
/// <remarks>Example: Get: api/administration/companydata/certificates</remarks>
/// <response code="200">Returns a collection of certificates.</response>
/// <response code="409">There should only be one pending or active ssi detail be assigned</response>
[HttpGet]
[Authorize(Roles = "view_certificates")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("certificates")]
[ProducesResponseType(typeof(IEnumerable<SsiCertificateTransferData>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public Task<IEnumerable<SsiCertificateData>> GetSsiCertificationData() =>
this.WithCompanyId(companyId => _logic.GetSsiCertificatesAsync(companyId));

Expand All @@ -208,13 +224,18 @@ public IAsyncEnumerable<VerifiedCredentialTypeId> GetCertificateTypes() =>
/// <returns>The id of the created use case participation</returns>
/// <remarks>Example: POST: api/administration/companydata/useCaseParticipation</remarks>
/// <response code="204">Successfully created the use case particiation.</response>
/// <response code="400">
/// VerifiedCredentialExternalTypeDetailId does not exist <br />
/// Credential request already exist
/// </response>
[HttpPost]
[Consumes("multipart/form-data")]
[Authorize(Roles = "request_ssicredential")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("useCaseParticipation")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
public async Task<NoContentResult> CreateUseCaseParticipation([FromForm] UseCaseParticipationCreationData data, CancellationToken cancellationToken)
{
await this.WithUserIdAndCompanyId(identity => _logic.CreateUseCaseParticipation(identity, data, cancellationToken)).ConfigureAwait(false);
Expand All @@ -229,13 +250,18 @@ public async Task<NoContentResult> CreateUseCaseParticipation([FromForm] UseCase
/// <returns>The id of the created use case participation</returns>
/// <remarks>Example: POST: api/administration/companydata/certificates</remarks>
/// <response code="204">Successfully created the ssi certificate.</response>
/// <response code="400">
/// credentialTypeId is not assigned to a certificate <br />
/// Credential request already exist
/// </response>
[HttpPost]
[Consumes("multipart/form-data")]
[Authorize(Roles = "request_ssicredential")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("certificates")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
public async Task<NoContentResult> CreateSsiCertificate([FromForm] SsiCertificateCreationData data, CancellationToken cancellationToken)
{
await this.WithUserIdAndCompanyId(identity => _logic.CreateSsiCertificate(identity, data, cancellationToken)).ConfigureAwait(false);
Expand Down Expand Up @@ -275,11 +301,18 @@ public async Task<NoContentResult> CreateSsiCertificate([FromForm] SsiCertificat
/// <param name="cts">Cancellation Token</param>
/// <returns>No Content</returns>
/// <response code="204">Successfully approved the credentials.</response>
/// <response code="404">CompanySsiDetail does not exists</response>
/// <response code="409">
/// Credential is in Incorrect State <br />
/// VerifiedCredentialTypeKindId must not be null
/// </response>
[HttpPut]
[Authorize(Roles = "decision_ssicredential")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
[Route("credentials/{credentialId}/approval")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public async Task<NoContentResult> ApproveCredential([FromRoute] Guid credentialId, CancellationToken cts)
{
await this.WithUserId(userId => _logic.ApproveCredential(userId, credentialId, cts)).ConfigureAwait(false);
Expand All @@ -293,11 +326,15 @@ public async Task<NoContentResult> ApproveCredential([FromRoute] Guid credential
/// <param name="credentialId">Id of the entry that should be approved</param>
/// <returns>No Content</returns>
/// <response code="204">Successfully rejected the credentials.</response>
/// <response code="404">CompanySsiDetail does not exists</response>
/// <response code="409">CredentialSsiDetail is in Incorrect State</response>
[HttpPut]
[Authorize(Roles = "decision_ssicredential")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
[Route("credentials/{credentialId}/reject")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public async Task<NoContentResult> RejectCredential([FromRoute] Guid credentialId)
{
await this.WithUserId(userId => _logic.RejectCredential(userId, credentialId)).ConfigureAwait(false);
Expand Down

0 comments on commit 13abfa4

Please sign in to comment.