Skip to content

Commit

Permalink
feat(errorhandling): add common controller returning all errormessages
Browse files Browse the repository at this point in the history
  • Loading branch information
ntruchsess committed Feb 8, 2024
1 parent 569a535 commit ebf50ab
Show file tree
Hide file tree
Showing 54 changed files with 329 additions and 72 deletions.
15 changes: 15 additions & 0 deletions src/Portal.Backend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Token.Tests", "..
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Web.Tests", "..\tests\framework\Framework.Web.Tests\Framework.Web.Tests.csproj", "{7A6C6A10-DC2E-4A16-8758-1115473F3D94}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.ErrorHandling.Controller", "framework\Framework.ErrorHandling.Controller\Framework.ErrorHandling.Controller.csproj", "{AD0C9BAD-E68F-40CF-86B4-31AC61856658}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1564,6 +1566,18 @@ Global
{7A6C6A10-DC2E-4A16-8758-1115473F3D94}.Release|x64.Build.0 = Release|Any CPU
{7A6C6A10-DC2E-4A16-8758-1115473F3D94}.Release|x86.ActiveCfg = Release|Any CPU
{7A6C6A10-DC2E-4A16-8758-1115473F3D94}.Release|x86.Build.0 = Release|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Debug|x64.ActiveCfg = Debug|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Debug|x64.Build.0 = Debug|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Debug|x86.ActiveCfg = Debug|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Debug|x86.Build.0 = Debug|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Release|Any CPU.Build.0 = Release|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Release|x64.ActiveCfg = Release|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Release|x64.Build.0 = Release|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Release|x86.ActiveCfg = Release|Any CPU
{AD0C9BAD-E68F-40CF-86B4-31AC61856658}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1680,5 +1694,6 @@ Global
{B733F449-AE22-4B00-9F33-816B2F809EF1} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{562DF697-262E-44DB-B6B5-40395E00D87C} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{7A6C6A10-DC2E-4A16-8758-1115473F3D94} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{AD0C9BAD-E68F-40CF-86B4-31AC61856658} = {B42CFF96-B8DB-48A6-A9CA-72BFB5F0117B}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<ProjectReference Include="..\..\web\Web.Identity\Web.Identity.csproj" />
<ProjectReference Include="..\..\web\Web.Initialization\Web.Initialization.csproj" />
<ProjectReference Include="..\..\web\Web.PublicInfos\Web.PublicInfos.csproj" />
<ProjectReference Include="..\..\framework\Framework.ErrorHandling.Controller\Framework.ErrorHandling.Controller.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
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.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;
Expand All @@ -35,7 +36,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// Creates a new instance of <see cref="CompanyDataController"/>
/// </summary>
[ApiController]
[Route("api/administration/companydata")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "companydata")]
[Produces("application/json")]
[Consumes("application/json")]
public class CompanyDataController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
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.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models;
Expand All @@ -35,7 +36,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// <summary>
/// Controller providing actions for displaying, filtering and updating connectors for companies.
/// </summary>
[Route("api/administration/[controller]")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "[controller]")]
[ApiController]
[Produces("application/json")]
public class ConnectorsController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;
Expand All @@ -32,7 +33,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// <summary>
/// Controller providing actions for displaying, filtering and updating connectors for documents.
/// </summary>
[Route("api/administration/[controller]")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "[controller]")]
[ApiController]
[Consumes("application/json")]
public class DocumentsController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
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.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;
Expand All @@ -32,7 +33,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// <summary>
/// Controller providing actions for displaying, filtering and updating identityProviders for companies.
/// </summary>
[Route("api/administration/identityprovider")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "identityprovider")]
[ApiController]
public class IdentityProviderController : ControllerBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
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.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers;
Expand All @@ -31,7 +32,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// Controller providing actions execute invitation
/// </summary>
[ApiController]
[Route("api/administration/invitation")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "invitation")]
[Produces("application/json")]
[Consumes("application/json")]
public class InvitationController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
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.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers;

[ApiController]
[Route("api/administration/registration/[controller]")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "registration/[controller]")]
[Produces("application/json")]
[Consumes("application/json")]
public class NetworkController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Web.PublicInfos;

Expand All @@ -30,7 +31,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// Creates a new instance of <see cref="PartnerNetworkController"/>
/// </summary>
[ApiController]
[Route("api/administration/[controller]")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "[controller]")]
[Produces("application/json")]
[Consumes("application/json")]
public class PartnerNetworkController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models;
using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models;
Expand All @@ -33,7 +34,7 @@
namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers;

[ApiController]
[Route("api/administration/registration")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "registration")]
[Produces("application/json")]
[Consumes("application/json")]
public class RegistrationController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers;

[ApiController]
[Route("api/administration/[controller]")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "[controller]")]
[Produces("application/json")]
[Consumes("application/json")]
public class RegistrationStatusController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@
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.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers;

[ApiController]
[Route("api/administration/serviceaccount")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "serviceaccount")]
[Produces("application/json")]
[Consumes("application/json")]
public class ServiceAccountController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers;
Expand All @@ -28,7 +29,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// Controller providing actions for displaying, filtering and updating static data for app.
/// </summary>
[ApiController]
[Route("api/administration/staticdata")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "staticdata")]
[Produces("application/json")]
[Consumes("application/json")]
public class StaticDataController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;
Expand All @@ -33,7 +34,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
/// Creates a new instance of <see cref="SubscriptionConfigurationController"/>
/// </summary>
[ApiController]
[Route("api/administration/[controller]")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "[controller]")]
[Produces("application/json")]
[Consumes("application/json")]
public class SubscriptionConfigurationController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
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.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models;
using Org.Eclipse.TractusX.Portal.Backend.Web.Identity;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers;

[ApiController]
[Route("api/administration/user")]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "user")]
[Produces("application/json")]
[Consumes("application/json")]
public class UserController : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"launchUrl": "api/administration/swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"MVC_ROUTING_BASEPATH": "api/administration",
"Cors__AllowedOrigins__0": "http://localhost:3000",
"Cors__AllowedOrigins__1": "https://portal.example.org"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
- Copyright (c) 2024 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
-->

<Project>
<PropertyGroup>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/********************************************************************************
* Copyright (c) 2021, 2024 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 Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;

namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Controller;

[ApiController]
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "errormessages")]
[Produces("application/json")]
public class ErrorMessagesController : ControllerBase
{
private readonly IErrorMessageService _logic;

public ErrorMessagesController(IErrorMessageService logic)
{
_logic = logic;
}

[HttpGet]
[ProducesResponseType(typeof(IEnumerable<IErrorMessageService.ErrorMessageType>), StatusCodes.Status200OK)]
public IEnumerable<IErrorMessageService.ErrorMessageType> GetAllMessageTexts()
=> _logic.GetAllMessageTexts();
}
Loading

0 comments on commit ebf50ab

Please sign in to comment.