From 13abfa4de1d1611a93dc1a3732f844ec53ccad5f Mon Sep 17 00:00:00 2001 From: VPrasannaK94 <117351802+VPrasannaK94@users.noreply.github.com> Date: Tue, 25 Jul 2023 11:57:52 +0530 Subject: [PATCH] fix(administration) : add swagger documentation for companyData endpoints (#162) Ref : CPLP -2946 Reviewed-By: Phil Schneider --- .../Controllers/CompanyDataController.cs | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/administration/Administration.Service/Controllers/CompanyDataController.cs b/src/administration/Administration.Service/Controllers/CompanyDataController.cs index b04159055e..86551c3d94 100644 --- a/src/administration/Administration.Service/Controllers/CompanyDataController.cs +++ b/src/administration/Administration.Service/Controllers/CompanyDataController.cs @@ -105,8 +105,10 @@ await this.WithCompanyId(companyId => _logic.CreateCompanyAssignedUseCaseDetails /// /// Example: DELETE: api/administration/companydata/preferredUseCases /// NoContentResult - /// Company Status is Incorrect - /// UseCaseId is not available + /// + /// Company Status is Incorrect
+ /// UseCaseId is not available + ///
[HttpDelete] [Authorize(Roles = "set_company_use_cases")] [Authorize(Policy = PolicyTypes.ValidCompany)] @@ -125,6 +127,8 @@ public async Task RemoveCompanyAssignedUseCaseDetailsAsync([Fro /// the Companyrole and ConsentAgreement details /// Example: GET: api/administration/companydata/companyRolesAndConsents /// Returns the Companyrole and Consent details. + /// languageShortName is not valid + /// CompanyId does not exist in company /// No Companyrole or Incorrect Status [HttpGet] [Authorize(Roles = "view_company_data")] @@ -132,6 +136,7 @@ public async Task RemoveCompanyAssignedUseCaseDetailsAsync([Fro [Route("companyRolesAndConsents")] [ProducesResponseType(typeof(CompanyRoleConsentViewData), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)] public IAsyncEnumerable GetCompanyRoleAndConsentAgreementDetailsAsync([FromQuery] string? languageShortName = null) => this.WithCompanyId(companyId => _logic.GetCompanyRoleAndConsentAgreementDetailsAsync(companyId, languageShortName)); @@ -142,8 +147,15 @@ public IAsyncEnumerable GetCompanyRoleAndConsentAgre /// Create Companyrole and Consent details /// Example: POST: api/administration/companydata/companyRolesAndConsents /// Created the Companyrole and Consent details. - /// companyRole already exists - /// All agreement need to get signed + /// + /// All agreement need to get signed as Active or InActive
+ /// Agreements not associated with requested companyRoles + ///
+ /// + /// Company does not exists
+ /// Company is in Incorrect state
+ /// Company can't unassign from all roles + ///
[HttpPost] [Authorize(Roles = "view_company_data")] [Authorize(Policy = PolicyTypes.ValidIdentity)] @@ -164,11 +176,13 @@ public async Task CreateCompanyRoleAndConsentAgreementDetailsAs /// Example: Get: api/administration/companydata/useCaseParticipation /// All UseCaseParticipations of the own company /// Returns a collection of UseCaseParticipation. + /// There should only be one pending or active ssi detail be assigned [HttpGet] [Authorize(Roles = "view_use_case_participation")] [Authorize(Policy = PolicyTypes.ValidCompany)] [Route("useCaseParticipation")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)] public Task> GetUseCaseParticipation([FromQuery] string? language) => this.WithCompanyId(companyId => _logic.GetUseCaseParticipationAsync(companyId, language)); @@ -178,11 +192,13 @@ public Task> GetUseCaseParticipation([From /// All ssi certifications of the own company /// Example: Get: api/administration/companydata/certificates /// Returns a collection of certificates. + /// There should only be one pending or active ssi detail be assigned [HttpGet] [Authorize(Roles = "view_certificates")] [Authorize(Policy = PolicyTypes.ValidCompany)] [Route("certificates")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)] public Task> GetSsiCertificationData() => this.WithCompanyId(companyId => _logic.GetSsiCertificatesAsync(companyId)); @@ -208,6 +224,10 @@ public IAsyncEnumerable GetCertificateTypes() => /// The id of the created use case participation /// Example: POST: api/administration/companydata/useCaseParticipation /// Successfully created the use case particiation. + /// + /// VerifiedCredentialExternalTypeDetailId does not exist
+ /// Credential request already exist + ///
[HttpPost] [Consumes("multipart/form-data")] [Authorize(Roles = "request_ssicredential")] @@ -215,6 +235,7 @@ public IAsyncEnumerable GetCertificateTypes() => [Authorize(Policy = PolicyTypes.ValidCompany)] [Route("useCaseParticipation")] [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] public async Task CreateUseCaseParticipation([FromForm] UseCaseParticipationCreationData data, CancellationToken cancellationToken) { await this.WithUserIdAndCompanyId(identity => _logic.CreateUseCaseParticipation(identity, data, cancellationToken)).ConfigureAwait(false); @@ -229,6 +250,10 @@ public async Task CreateUseCaseParticipation([FromForm] UseCase /// The id of the created use case participation /// Example: POST: api/administration/companydata/certificates /// Successfully created the ssi certificate. + /// + /// credentialTypeId is not assigned to a certificate
+ /// Credential request already exist + ///
[HttpPost] [Consumes("multipart/form-data")] [Authorize(Roles = "request_ssicredential")] @@ -236,6 +261,7 @@ public async Task CreateUseCaseParticipation([FromForm] UseCase [Authorize(Policy = PolicyTypes.ValidCompany)] [Route("certificates")] [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] public async Task CreateSsiCertificate([FromForm] SsiCertificateCreationData data, CancellationToken cancellationToken) { await this.WithUserIdAndCompanyId(identity => _logic.CreateSsiCertificate(identity, data, cancellationToken)).ConfigureAwait(false); @@ -275,11 +301,18 @@ public async Task CreateSsiCertificate([FromForm] SsiCertificat /// Cancellation Token /// No Content /// Successfully approved the credentials. + /// CompanySsiDetail does not exists + /// + /// Credential is in Incorrect State
+ /// VerifiedCredentialTypeKindId must not be null + ///
[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 ApproveCredential([FromRoute] Guid credentialId, CancellationToken cts) { await this.WithUserId(userId => _logic.ApproveCredential(userId, credentialId, cts)).ConfigureAwait(false); @@ -293,11 +326,15 @@ public async Task ApproveCredential([FromRoute] Guid credential /// Id of the entry that should be approved /// No Content /// Successfully rejected the credentials. + /// CompanySsiDetail does not exists + /// CredentialSsiDetail is in Incorrect State [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 RejectCredential([FromRoute] Guid credentialId) { await this.WithUserId(userId => _logic.RejectCredential(userId, credentialId)).ConfigureAwait(false);