feat(blog): add archived post restore workflow
TaxBaik CI/CD / build-and-deploy (push) Failing after 5m38s
TaxBaik CI/CD / build-and-deploy (push) Failing after 5m38s
This commit is contained in:
@@ -7,6 +7,14 @@
|
||||
|
||||
<AdminPageHeader Title="블로그 관리" Eyebrow="Content" Subtitle="검색 유입 콘텐츠의 발행 상태와 성과를 관리합니다.">
|
||||
<ChildContent>
|
||||
<MudButton Variant="Variant.Outlined" Color="Color.Secondary" StartIcon="@Icons.Material.Filled.Restore"
|
||||
OnClick="ToggleArchiveView">
|
||||
@(showArchived ? "전체 글 보기" : "숨김 글 보기")
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Outlined" Color="Color.Secondary" StartIcon="@Icons.Material.Filled.Refresh"
|
||||
OnClick="Reload">
|
||||
새로고침
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.EditNote"
|
||||
Href="/taxbaik/admin/blog/create">새 포스트 작성</MudButton>
|
||||
</ChildContent>
|
||||
@@ -39,8 +47,16 @@
|
||||
<CellTemplate Context="cell">
|
||||
<MudButton Variant="Variant.Outlined" Size="Size.Small" Color="Color.Primary"
|
||||
Href="@($"/taxbaik/admin/blog/{cell.Item.Id}/edit")">수정하기</MudButton>
|
||||
<MudButton Variant="Variant.Text" Size="Size.Small" Color="Color.Error"
|
||||
@onclick="@(async () => await DeletePost(cell.Item.Id))">삭제</MudButton>
|
||||
@if (showArchived)
|
||||
{
|
||||
<MudButton Variant="Variant.Text" Size="Size.Small" Color="Color.Success"
|
||||
@onclick="@(async () => await RestorePost(cell.Item.Id))">복원</MudButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudButton Variant="Variant.Text" Size="Size.Small" Color="Color.Error"
|
||||
@onclick="@(async () => await DeletePost(cell.Item.Id))">삭제</MudButton>
|
||||
}
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
@@ -61,6 +77,7 @@
|
||||
private int currentPage = 1;
|
||||
private int totalPages = 1;
|
||||
private int totalPosts = 0;
|
||||
private bool showArchived;
|
||||
private const int PageSize = 20;
|
||||
|
||||
private IEnumerable<TaxBaik.Application.DTOs.BlogPostResponseDto> FilteredPosts => posts
|
||||
@@ -85,7 +102,9 @@
|
||||
isLoading = true;
|
||||
try
|
||||
{
|
||||
var result = await BlogClient.GetAdminPagedAsync(currentPage, PageSize);
|
||||
var result = showArchived
|
||||
? await BlogClient.GetArchivedPagedAsync(currentPage, PageSize)
|
||||
: await BlogClient.GetAdminPagedAsync(currentPage, PageSize);
|
||||
posts = result.Items.ToList();
|
||||
totalPosts = result.Total;
|
||||
totalPages = Math.Max(1, (int)Math.Ceiling(totalPosts / (double)PageSize));
|
||||
@@ -155,4 +174,26 @@
|
||||
Snackbar.Add("포스트가 삭제되었습니다.", Severity.Success);
|
||||
await LoadPosts();
|
||||
}
|
||||
|
||||
private async Task RestorePost(int postId)
|
||||
{
|
||||
var restored = await BlogClient.RestoreAsync(postId);
|
||||
if (!restored)
|
||||
{
|
||||
Snackbar.Add("포스트 복원에 실패했습니다.", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
Snackbar.Add("포스트가 복원되었습니다.", Severity.Success);
|
||||
await LoadPosts();
|
||||
}
|
||||
|
||||
private async Task ToggleArchiveView()
|
||||
{
|
||||
showArchived = !showArchived;
|
||||
currentPage = 1;
|
||||
await LoadPosts();
|
||||
}
|
||||
|
||||
private async Task Reload() => await LoadPosts();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user