분리의 단점을 제거하고 단일 앱으로 통합: 구조 변경: - TaxBaik.Admin → TaxBaik.Web/Components/Admin/ - Admin Services → TaxBaik.Web/Services/ - 포트: 5001 (기존 5002 제거) 경로: - 홈페이지: http://localhost:5001/taxbaik - 관리자: http://localhost:5001/taxbaik/admin 기술: - Razor Pages (Web) + Blazor Server (Admin) 통합 - 단일 Program.cs로 양쪽 모두 지원 - JWT 인증 유지 - MudBlazor UI 유지 장점: - 개발 복잡도 감소 (터미널 1개) - 배포 단순화 (앱 1개) - DB 마이그레이션 1회 실행 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
@page "/admin/blog"
|
||||
@using TaxBaik.Application.Services
|
||||
@using TaxBaik.Domain.Interfaces
|
||||
@attribute [Authorize]
|
||||
@inject IBlogPostRepository BlogRepository
|
||||
@inject DialogService DialogService
|
||||
@inject Snackbar Snackbar
|
||||
|
||||
<PageTitle>블로그 관리</PageTitle>
|
||||
|
||||
<div class="mb-4 d-flex justify-content-between align-items-center">
|
||||
<MudText Typo="Typo.h5">📝 블로그 관리</MudText>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary"
|
||||
Href="/taxbaik/admin/blog/create">새 포스트</MudButton>
|
||||
</div>
|
||||
|
||||
<MudDataGrid Items="@posts" Striped="true" Hoverable="true" Loading="@isLoading">
|
||||
<Columns>
|
||||
<PropertyColumn Property="x => x.Title" Title="제목" />
|
||||
<PropertyColumn Property="x => x.IsPublished" Title="발행">
|
||||
<CellTemplate Context="cell">
|
||||
<MudCheckBox @bind-Checked="@cell.Item.IsPublished" />
|
||||
</CellTemplate>
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="x => x.ViewCount" Title="조회수" />
|
||||
<PropertyColumn Property="x => x.CreatedAt" Title="작성일" Format="yyyy-MM-dd" />
|
||||
<TemplateColumn>
|
||||
<CellTemplate Context="cell">
|
||||
<MudButton Variant="Variant.Text" Color="Color.Primary"
|
||||
Href="@($"/taxbaik/admin/blog/{cell.Item.Id}/edit")">수정</MudButton>
|
||||
<MudButton Variant="Variant.Text" Color="Color.Error"
|
||||
@onclick="@(async () => await DeletePost(cell.Item.Id))">삭제</MudButton>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
</MudDataGrid>
|
||||
|
||||
@code {
|
||||
private List<Domain.Entities.BlogPost> posts = [];
|
||||
private bool isLoading = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadPosts();
|
||||
}
|
||||
|
||||
private async Task LoadPosts()
|
||||
{
|
||||
isLoading = true;
|
||||
try
|
||||
{
|
||||
var items = await BlogRepository.GetAllForAdminAsync();
|
||||
posts = items.ToList();
|
||||
}
|
||||
catch { }
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task TogglePublish(int postId, bool isPublished)
|
||||
{
|
||||
// TODO: Update publish status via service
|
||||
}
|
||||
|
||||
private async Task DeletePost(int postId)
|
||||
{
|
||||
// TODO: Delete via repository
|
||||
await LoadPosts();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user