Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dressca.WebにWeb系の共通部品を集約する #2012

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions samples/Dressca/dressca-backend/Dressca.Web.Consumer.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
"src\\Dressca.SystemCommon\\Dressca.SystemCommon.csproj",
"src\\Dressca.Web.Consumer.Dto\\Dressca.Web.Consumer.Dto.csproj",
"src\\Dressca.Web.Consumer\\Dressca.Web.Consumer.csproj",
"src\\Dressca.Web\\Dressca.Web.csproj",
"src\\Maris.Logging.Testing\\Maris.Logging.Testing.csproj",
"tests\\Dressca.IntegrationTest\\Dressca.IntegrationTest.csproj",
"tests\\Dressca.UnitTests.ApplicationCore\\Dressca.UnitTests.ApplicationCore.csproj",
"tests\\Dressca.UnitTests.SystemCommon\\Dressca.UnitTests.SystemCommon.csproj",
"tests\\Dressca.UnitTests.Web.Consumer\\Dressca.UnitTests.Web.Consumer.csproj",
"tests\\Dressca.UnitTests.Web\\Dressca.UnitTests.Web.csproj",
"tests\\Maris.Logging.Testing.Tests\\Maris.Logging.Testing.Tests.csproj"
]
}
Expand Down
14 changes: 14 additions & 0 deletions samples/Dressca/dressca-backend/Dressca.sln
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dressca.UnitTests.Web.Consu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dressca.Web.Consumer.Dto", "src\Dressca.Web.Consumer.Dto\Dressca.Web.Consumer.Dto.csproj", "{DF1A785A-FB0B-451E-B459-E65FDCB67845}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dressca.Web", "src\Dressca.Web\Dressca.Web.csproj", "{CB5845EF-7067-407D-97D9-CA4E5B6FBA70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dressca.UnitTests.Web", "tests\Dressca.UnitTests.Web\Dressca.UnitTests.Web.csproj", "{688341DB-7DDD-4001-A418-89A1D7C8C20D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -97,6 +101,14 @@ Global
{DF1A785A-FB0B-451E-B459-E65FDCB67845}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF1A785A-FB0B-451E-B459-E65FDCB67845}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF1A785A-FB0B-451E-B459-E65FDCB67845}.Release|Any CPU.Build.0 = Release|Any CPU
{CB5845EF-7067-407D-97D9-CA4E5B6FBA70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB5845EF-7067-407D-97D9-CA4E5B6FBA70}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB5845EF-7067-407D-97D9-CA4E5B6FBA70}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB5845EF-7067-407D-97D9-CA4E5B6FBA70}.Release|Any CPU.Build.0 = Release|Any CPU
{688341DB-7DDD-4001-A418-89A1D7C8C20D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{688341DB-7DDD-4001-A418-89A1D7C8C20D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{688341DB-7DDD-4001-A418-89A1D7C8C20D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{688341DB-7DDD-4001-A418-89A1D7C8C20D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -114,6 +126,8 @@ Global
{D9A4BA02-8886-48C3-AD6E-EE8DA260DC8C} = {16A54A4D-8AEA-42B3-B8CF-D8C7650BB3C6}
{7BA7B435-5790-4F8F-BA23-A9F87A86BB66} = {00E7327F-10DF-4937-AC61-FE2FCDCCA88B}
{DF1A785A-FB0B-451E-B459-E65FDCB67845} = {16A54A4D-8AEA-42B3-B8CF-D8C7650BB3C6}
{CB5845EF-7067-407D-97D9-CA4E5B6FBA70} = {16A54A4D-8AEA-42B3-B8CF-D8C7650BB3C6}
{688341DB-7DDD-4001-A418-89A1D7C8C20D} = {00E7327F-10DF-4937-AC61-FE2FCDCCA88B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8FD66EC1-E1D1-4664-9ACE-8026659FD708}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<ProjectReference Include="..\Dressca.Store.Assets.StaticFiles\Dressca.Store.Assets.StaticFiles.csproj" />
<ProjectReference Include="..\Dressca.SystemCommon\Dressca.SystemCommon.csproj" />
<ProjectReference Include="..\Dressca.Web.Consumer.Dto\Dressca.Web.Consumer.Dto.csproj" />
<ProjectReference Include="..\Dressca.Web\Dressca.Web.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
25 changes: 10 additions & 15 deletions samples/Dressca/dressca-backend/src/Dressca.Web.Consumer/Events.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
namespace Dressca.Web.Consumer;

/// <summary>
/// イベントIDを管理するクラスです
/// イベント ID を管理するクラスです
/// </summary>
internal static class Events
{
/// <summary>
/// 業務例外が検出されたことを示すイベントID
/// クライアント側から不正な HTTP リクエストを受信したことを示すイベント ID です。
/// </summary>
internal static readonly EventId BusinessExceptionHandled = new(1001, nameof(BusinessExceptionHandled));
internal static readonly EventId ReceiveHttpBadRequest = new(1001, nameof(ReceiveHttpBadRequest));

/// <summary>
/// クライアント側から不正なHTTPリクエストを受信したことを示すイベントID
/// アセットが見つからなかったことを示すイベント ID です。
/// </summary>
internal static readonly EventId ReceiveHttpBadRequest = new(1101, nameof(ReceiveHttpBadRequest));
internal static readonly EventId AssetNotFound = new(1101, nameof(AssetNotFound));

/// <summary>
/// アセットが見つからなかったことを示すイベントID
/// 指定された商品が買い物かご内に存在しなかったことを示すイベント ID です。
/// </summary>
internal static readonly EventId AssetNotFound = new(1201, nameof(AssetNotFound));
internal static readonly EventId CatalogItemIdDoesNotExistInBasket = new(1201, nameof(CatalogItemIdDoesNotExistInBasket));

/// <summary>
/// 指定された商品が買い物かご内に存在しなかったことを示すイベントID
/// 注文情報が見つからなかったことを示すイベント ID です。
/// </summary>
internal static readonly EventId CatalogItemIdDoesNotExistInBasket = new(1301, nameof(CatalogItemIdDoesNotExistInBasket));
internal static readonly EventId OrderNotFound = new(1301, nameof(OrderNotFound));

/// <summary>
/// 注文情報が見つからなかったことを示すイベントID
/// </summary>
internal static readonly EventId OrderNotFound = new(1401, nameof(OrderNotFound));

/// <summary>
/// デバッグ用のイベントID
/// デバッグ用のイベント ID です。
/// </summary>
internal static readonly EventId DebugEvent = new(9999, nameof(DebugEvent));
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using Dressca.Web.Consumer;
using Dressca.Web.Consumer.Baskets;
using Dressca.Web.Consumer.Configuration;
using Dressca.Web.Consumer.Controllers;
using Dressca.Web.Consumer.HealthChecks;
using Dressca.Web.Consumer.Mapper;
using Dressca.Web.Consumer.Resources;
using Dressca.Web.Consumer.Runtime;
using Dressca.Web.Controllers;
using Dressca.Web.Runtime;
using Microsoft.AspNetCore.HttpLogging;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.Extensions.DependencyInjection.Extensions;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="BusinessExceptionHandled" xml:space="preserve">
<value>業務エラーが発生しました。</value>
</data>
<data name="CannotConvertAssetTypeToContentType" xml:space="preserve">
<value>アセットタイプ: {0} を Content-Type に変換できません。</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;

namespace Dressca.Web.Consumer.Controllers;
namespace Dressca.Web.Controllers;

/// <summary>
/// エラーの情報にアクセスする API コントローラーです。
Expand All @@ -12,21 +13,31 @@ namespace Dressca.Web.Consumer.Controllers;
public class ErrorController : ControllerBase
{
/// <summary>
/// 開発環境におけるエラー情報取得のためのルートパス ( /error-development ) 。
/// 開発環境におけるエラー情報取得のためのルートパスのリテラル値 ( /error-development ) です
/// </summary>
internal const string DevelopmentErrorRoute = "/error-development";
private const string DevelopMentErrorRouteLiteral = "/error-development";

/// <summary>
/// 実行環境におけるエラー情報取得のためのルートパス ( /error ) 。
/// 実行環境におけるエラー情報取得のためのルートパスのリテラル値 ( /error ) です
/// </summary>
internal const string ErrorRoute = "/error";
private const string ErrorRouteLiteral = "/error";

/// <summary>
/// 開発環境におけるエラー情報取得のためのルートパス( /error-development )を取得します。
/// </summary>
public static string DevelopmentErrorRoute => DevelopMentErrorRouteLiteral;

/// <summary>
/// 実行環境におけるエラー情報取得のためのルートパス ( /error )を取得します。
/// </summary>
public static string ErrorRoute => ErrorRouteLiteral;

/// <summary>
/// 開発環境でのエラーレスポンスを取得します。
/// </summary>
/// <param name="hostEnvironment">環境の情報。</param>
/// <returns>エラーの詳細情報。</returns>
[Route(DevelopmentErrorRoute)]
[Route(DevelopMentErrorRouteLiteral)]
public IActionResult HandleErrorDevelopment([FromServices] IHostEnvironment hostEnvironment)
{
if (!hostEnvironment.IsDevelopment())
Expand All @@ -44,6 +55,6 @@ public IActionResult HandleErrorDevelopment([FromServices] IHostEnvironment host
/// 実行環境でのエラーレスポンスを取得します。
/// </summary>
/// <returns>エラーの情報。</returns>
[Route(ErrorRoute)]
[Route(ErrorRouteLiteral)]
public IActionResult HandleError() => this.Problem();
}
37 changes: 37 additions & 0 deletions samples/Dressca/dressca-backend/src/Dressca.Web/Dressca.Web.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AppDesignerFolder>Resources</AppDesignerFolder>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dressca.SystemCommon\Dressca.SystemCommon.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Resources\Messages.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Messages.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources\Messages.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions samples/Dressca/dressca-backend/src/Dressca.Web/Events.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.Extensions.Logging;

namespace Dressca.Web;

/// <summary>
/// イベント ID を管理するクラスです。
/// </summary>
internal static class Events
{
/// <summary>
/// 業務例外が検出されたことを示すイベント ID です。
/// </summary>
internal static readonly EventId BusinessExceptionHandled = new(0001, nameof(BusinessExceptionHandled));
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading