-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(versioning): add versioning to apis
Refs: CPLP-1936
- Loading branch information
Showing
60 changed files
with
405 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/administration/Administration.Service/Controllers/V1/InvitationController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021, 2023 BMW Group AG | ||
* Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
|
||
using Asp.Versioning; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; | ||
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; | ||
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Library; | ||
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; | ||
|
||
namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers.V1; | ||
|
||
/// <summary> | ||
/// Controller providing actions execute invitation | ||
/// </summary> | ||
[ApiController] | ||
[ApiVersion("1.0", Deprecated = true)] | ||
[ApiVersion("1.1", Deprecated = true)] | ||
[Route("api/v{version:apiVersion}/administration/invitation")] | ||
[Produces("application/json")] | ||
[Consumes("application/json")] | ||
public class InvitationController : ControllerBase | ||
{ | ||
private readonly IInvitationBusinessLogic _logic; | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="InvitationController"/> | ||
/// </summary> | ||
/// <param name="logic">The invitation business logic</param> | ||
public InvitationController(IInvitationBusinessLogic logic) | ||
{ | ||
_logic = logic; | ||
} | ||
|
||
/// <summary> | ||
/// Executes the invitation | ||
/// </summary> | ||
/// <param name="invitationData"></param> | ||
/// <returns></returns> | ||
/// <remarks> | ||
/// Example: POST: api/administration/invitation | ||
/// </remarks> | ||
/// <response code="200">Successfully executed the invitation.</response> | ||
/// <response code="400">Missing mandatory input values (e.g. email, organization name, etc.)</response> | ||
/// <response code="500">Internal Server Error.</response> | ||
/// <response code="502">Bad Gateway Service Error.</response> | ||
/// <response code="409">user is not associated with company.</response> | ||
[MapToApiVersion("1.0")] | ||
[HttpPost] | ||
[Authorize(Roles = "invite_new_partner")] | ||
[Authorize(Policy = PolicyTypes.CompanyUser)] | ||
[ProducesResponseType(StatusCodes.Status200OK)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status500InternalServerError)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status502BadGateway)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)] | ||
public Task ExecuteInvitation([FromBody] CompanyInvitationData invitationData) => | ||
_logic.ExecuteInvitation(invitationData); | ||
|
||
/// <summary> | ||
/// Executes the invitation | ||
/// </summary> | ||
/// <param name="invitationData"></param> | ||
/// <returns></returns> | ||
/// <remarks> | ||
/// Example: POST: api/administration/invitation | ||
/// </remarks> | ||
/// <response code="200">Successfully executed the invitation.</response> | ||
/// <response code="400">Missing mandatory input values (e.g. email, organization name, etc.)</response> | ||
/// <response code="500">Internal Server Error.</response> | ||
/// <response code="502">Bad Gateway Service Error.</response> | ||
/// <response code="409">user is not associated with company.</response> | ||
[MapToApiVersion("1.1")] | ||
[HttpPost] | ||
[Authorize(Roles = "invite_new_partner")] | ||
[Authorize(Policy = PolicyTypes.CompanyUser)] | ||
[ProducesResponseType(StatusCodes.Status200OK)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status500InternalServerError)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status502BadGateway)] | ||
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)] | ||
public Task ExecuteInvitationV11([FromBody] CompanyInvitationData invitationData) => | ||
_logic.ExecuteInvitation(invitationData); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.