Skip to content

OperationTypeの表示名をenumにDisplayAttributeで記載する#4162

Merged
KentaHizume merged 2 commits intomainfrom
feature/OperationTypeの表示名をenumに記載する
Dec 19, 2025

Hidden character warning

The head ref may contain hidden characters: "feature/OperationType\u306e\u8868\u793a\u540d\u3092enum\u306b\u8a18\u8f09\u3059\u308b"
Merged

OperationTypeの表示名をenumにDisplayAttributeで記載する#4162
KentaHizume merged 2 commits intomainfrom
feature/OperationTypeの表示名をenumに記載する

Conversation

@tsuna-can-se
Copy link
Copy Markdown
Contributor

この Pull request で実施したこと

OperationType列挙型にもMarisのライブラリを利用して表示名を取得するように修正しました。

この Pull request では実施していないこと

なし

Issues や Discussions 、関連する Web サイトなどへのリンク

なし

OperationTypeの各値に日本語の表示名をDisplay属性で付与しました。また、using宣言やnamespace宣言の位置・インデントも整理しました。
Announcement関連3ファイルのGetHistoryHeadingメソッドで、OperationTypeの表示名取得処理をswitch文からGetDisplayName()呼び出しに統一しました。これにより表示名管理の一元化とコードの簡素化を実現しています。
@tsuna-can-se tsuna-can-se self-assigned this Dec 18, 2025
@tsuna-can-se tsuna-can-se added the target: Dressca-CMS サンプルアプリケーションDressca-CMSに関係がある label Dec 18, 2025
@tsuna-can-se tsuna-can-se added this to the v2.0.0 milestone Dec 18, 2025
@github-actions
Copy link
Copy Markdown

Test Result 📝

Test was a success.
Completed in 1794ms with 45 passed, 0 failed and 0 skipped.

Coverage 📐

Summary
Generated on: 12/18/2025 - 09:37:11
Parser: MultiReport (3x Cobertura)
Assemblies: 2
Classes: 47
Files: 45
Line coverage: 4% (148 of 3645)
Covered lines: 148
Uncovered lines: 3497
Coverable lines: 3645
Total lines: 6545
Branch coverage: 5.8% (28 of 478)
Covered branches: 28
Total branches: 478
Method coverage: Feature is only available for sponsors
Tag: 88_20332476999
DresscaCMS.Announcement - 4.3%
Name Line Branch
DresscaCMS.Announcement 4.3% 10.7%
DresscaCMS.Announcement.AnnouncementServiceCollectionExtensions 0% 0%
DresscaCMS.Announcement.ApplicationCore.ApplicationServices.AnnouncementsAp
plicationService
18.6% 21.4%
DresscaCMS.Announcement.ApplicationCore.GetAnnouncementWithHistoriesResult 0%
DresscaCMS.Announcement.ApplicationCore.GetPagedAnnouncementsResult 87.5%
DresscaCMS.Announcement.ApplicationCore.LanguagePriorityProvider 100% 100%
DresscaCMS.Announcement.ApplicationCore.LanguagePriorityProvider.LanguageOr
der
100%
DresscaCMS.Announcement.Infrastructures.AnnouncementDbContext 0% 0%
DresscaCMS.Announcement.Infrastructures.Configurations.AnnouncementConfigur
ation
0% 0%
DresscaCMS.Announcement.Infrastructures.Configurations.AnnouncementContentC
onfiguration
0%
DresscaCMS.Announcement.Infrastructures.Configurations.AnnouncementContentH
istoryConfiguration
0%
DresscaCMS.Announcement.Infrastructures.Configurations.AnnouncementHistoryC
onfiguration
0% 0%
DresscaCMS.Announcement.Infrastructures.EfAnnouncementsRepository 0% 0%
DresscaCMS.Announcement.Infrastructures.Entities.Announcement 100%
DresscaCMS.Announcement.Infrastructures.Entities.AnnouncementContent 62.5% 0%
DresscaCMS.Announcement.Infrastructures.Entities.AnnouncementContentHistory 0% 0%
DresscaCMS.Announcement.Infrastructures.Entities.AnnouncementHistory 0% 0%
DresscaCMS.Announcement.Infrastructures.Migrations.AnnouncementDbContextMod
elSnapshot
0% 0%
DresscaCMS.Announcement.Infrastructures.Migrations.InitialCreate 0% 0%
DresscaCMS.Web - 3.5%
Name Line Branch
DresscaCMS.Web 3.5% 2.7%
AspNetCoreGeneratedDocument.Pages_ServerError 0%
DresscaCMS.Web.Components.Account.IdentityRedirectManager 0% 0%
DresscaCMS.Web.Components.Account.IdentityRevalidatingAuthenticationStatePr
ovider
0% 0%
DresscaCMS.Web.Components.Account.Shared.RedirectToLogin 0%
DresscaCMS.Web.Components.App 0% 0%
DresscaCMS.Web.Components.Layout.MainLayout 0% 0%
DresscaCMS.Web.Components.Layout.NavMenu 0%
DresscaCMS.Web.Components.Pages.AnnouncementCreate 0% 0%
DresscaCMS.Web.Components.Pages.AnnouncementDeleteComplete 0% 0%
DresscaCMS.Web.Components.Pages.AnnouncementDeleteConfirm 0% 0%
DresscaCMS.Web.Components.Pages.AnnouncementEdit 0% 0%
DresscaCMS.Web.Components.Pages.AnnouncementsManagement 0% 0%
DresscaCMS.Web.Components.Pages.Error 100% 100%
DresscaCMS.Web.Components.Pages.Login 0% 0%
DresscaCMS.Web.Components.Pages.Login.InputModel 0%
DresscaCMS.Web.Extensions.AuthenticationStateProviderExtensions 0% 0%
DresscaCMS.Web.State.InMemoryStateStore 100% 100%
DresscaCMS.Web.State.StateResult 80%
DresscaCMS.Web.ViewModels.AnnouncementContentCreateViewModel 0%
DresscaCMS.Web.ViewModels.AnnouncementContentEditViewModel 0%
DresscaCMS.Web.ViewModels.AnnouncementCreateViewModel 0% 0%
DresscaCMS.Web.ViewModels.AnnouncementEditViewModel 0% 0%
DresscaCMS.Web.ViewModels.DeletedAnnouncementState 0%
DresscaCMS.Web.ViewModels.Language 0% 0%
DresscaCMS.Web.ViewModels.LanguagePriorities 0% 0%
Microsoft.Extensions.DependencyInjection.StateStoreExtensions 0%
Microsoft.Extensions.Validation.Generated 0% 0%
Program 0% 0%
System.Runtime.CompilerServices 0%

@tsuna-can-se tsuna-can-se marked this pull request as ready for review December 18, 2025 09:49
Copilot AI review requested due to automatic review settings December 18, 2025 09:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

このPRは、OperationType列挙型にDisplayAttributeを追加し、表示名の取得方法をMarisライブラリのGetDisplayName()メソッドを使用するように統一しています。これにより、3つのRazorファイルに散在していた重複したswitch式が削除され、コードの保守性が向上しています。

  • OperationType列挙型の各値にDisplay属性を追加(None, Create, Update, Delete)
  • 3つのRazorコンポーネントで重複していたGetHistoryHeadingメソッドのswitch式をGetDisplayName()メソッドの呼び出しに簡素化
  • コードの重複を削減し、表示名の一元管理を実現

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
samples/DresscaCMS/src/DresscaCMS.Announcement/ApplicationCore/OperationType.cs System.ComponentModel.DataAnnotationsをインポートし、各enum値に日本語の表示名を持つDisplay属性を追加
samples/DresscaCMS/src/DresscaCMS.Web/Components/Pages/AnnouncementEdit.razor GetHistoryHeadingメソッドをswitch式からGetDisplayName()呼び出しに簡素化し、変数初期化の空白も修正
samples/DresscaCMS/src/DresscaCMS.Web/Components/Pages/AnnouncementDeleteConfirm.razor GetHistoryHeadingメソッドをswitch式からGetDisplayName()呼び出しに簡素化
samples/DresscaCMS/src/DresscaCMS.Web/Components/Pages/AnnouncementDeleteComplete.razor GetHistoryHeadingメソッドをswitch式からGetDisplayName()呼び出しに簡素化

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@KentaHizume KentaHizume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enumの数値にマッピングされた文字列が正しく画面に表示されることを確認いたしました。
未定義と削除については画面操作でうまく確認する方法が思いつかなかったため DB側をUPDATEして確認いたしました。

@KentaHizume KentaHizume merged commit 9c41a23 into main Dec 19, 2025
14 of 15 checks passed
@KentaHizume KentaHizume deleted the feature/OperationTypeの表示名をenumに記載する branch December 19, 2025 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target: Dressca-CMS サンプルアプリケーションDressca-CMSに関係がある

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants