refactor: complete WebAssembly migration - proper architecture
TaxBaik CI/CD / build-and-deploy (push) Failing after 2m17s

Phase 8: Complete WebAssembly 렌더 모드 전환 (정공법)

Migration Summary:
- ALL Admin components → TaxBaik.Web.Client
- Routes.razor, Pages/*, Layout/*, Shared/*, Forms/*
- App.razor → TaxBaik.WasmClient (호스트 컴포넌트)
- Shared utilities → TaxBaik.Application.Utils

Architecture:
 App.razor: TaxBaik.WasmClient (WebAssembly, 호스트)
 Routes + Pages: TaxBaik.WasmClient (WebAssembly)
 Layout + Shared + Forms: TaxBaik.WasmClient (WebAssembly)
 Services: TaxBaik.Web (API-First)

Key Changes:
- Namespaces: TaxBaik.Web.Components.Admin → TaxBaik.WasmClient.Components.Admin
- Shared utilities: TaxBaik.Application.Utils (single source of truth)
- Program.cs: MapRazorComponents<TaxBaik.WasmClient.Components.Admin.App>()
- _Imports.razor: Components/Admin 폴더에 재구성

Build Status:  0 errors, 0 warnings

Benefits:
- Stateless server (no Circuit memory)
- Client-side rendering (WebAssembly)
- Unlimited concurrent users (horizontal scaling)
- ERP-ready architecture

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 01:03:51 +09:00
parent 76446ee0f0
commit 8202c3278b
63 changed files with 41 additions and 30 deletions
@@ -0,0 +1,258 @@
@page "/admin/clients/{ClientId:int}"
@attribute [Authorize]
@using TaxBaik.Web.Services
@using TaxBaik.Web.Services.AdminClients
@using TaxBaik.WasmClient.Components.Admin.Shared
@inject IClientBrowserClient ClientClient
@inject IConsultingActivityBrowserClient ConsultingClient
@inject NavigationManager Navigation
@inject ISnackbar Snackbar
<PageTitle>고객 상세</PageTitle>
<section class="admin-page-hero">
<div>
<MudText Typo="Typo.caption" Class="admin-eyebrow">Client Details</MudText>
<MudText Typo="Typo.h4" Class="admin-page-title">고객 상세</MudText>
<MudText Typo="Typo.body2" Class="admin-page-subtitle">고객 정보와 상담 이력을 관리합니다.</MudText>
</div>
</section>
@if (client == null)
{
<MudText>고객을 찾을 수 없습니다.</MudText>
return;
}
<MudStack Row="true" AlignItems="AlignItems.Center" Class="mb-4" Spacing="2">
<MudButton Variant="Variant.Outlined" Color="Color.Primary"
StartIcon="@Icons.Material.Filled.ArrowBack"
@onclick="@(() => Navigation.NavigateTo("/taxbaik/admin/clients"))">
목록으로
</MudButton>
<MudButton Variant="Variant.Outlined" Color="Color.Warning"
StartIcon="@Icons.Material.Filled.Edit"
Href="@($"/taxbaik/admin/clients/{ClientId}/edit")">
수정
</MudButton>
</MudStack>
<MudGrid>
<MudItem xs="12" md="5">
<MudPaper Class="pa-4" Elevation="1">
<MudText Typo="Typo.h6" Class="mb-3">고객 정보</MudText>
<MudGrid Spacing="2">
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">이름</MudText>
<MudText>@client.Name</MudText>
</MudItem>
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">상호</MudText>
<MudText>@(client.CompanyName ?? "-")</MudText>
</MudItem>
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">연락처</MudText>
<MudText>@(client.Phone ?? "-")</MudText>
</MudItem>
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">이메일</MudText>
<MudText>@(client.Email ?? "-")</MudText>
</MudItem>
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">서비스</MudText>
<MudText>@(client.ServiceType ?? "-")</MudText>
</MudItem>
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">사업자 유형</MudText>
<MudText>@(client.TaxType ?? "-")</MudText>
</MudItem>
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">유입 경로</MudText>
<MudText>@(client.Source ?? "-")</MudText>
</MudItem>
<MudItem xs="6">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">등록일</MudText>
<MudText>@client.CreatedAt.ToLocalTime().ToString("yyyy-MM-dd")</MudText>
</MudItem>
@if (!string.IsNullOrWhiteSpace(client.Memo))
{
<MudItem xs="12">
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">메모</MudText>
<MudText Style="white-space: pre-wrap;">@client.Memo</MudText>
</MudItem>
}
</MudGrid>
</MudPaper>
</MudItem>
<MudItem xs="12" md="7">
<MudPaper Class="pa-4" Elevation="1">
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Class="mb-3">
<MudText Typo="Typo.h6">상담 이력</MudText>
<MudButton Variant="Variant.Filled" Color="Color.Primary"
Size="Size.Small"
OnClick="OpenAddConsultation">
+ 상담 추가
</MudButton>
</MudStack>
@if (showAddForm)
{
<MudPaper Class="pa-3 mb-3" Outlined="true">
<MudGrid Spacing="2">
<MudItem xs="12" sm="6">
<MudDatePicker @bind-Date="newDate" Label="상담일" DateFormat="yyyy-MM-dd" />
</MudItem>
<MudItem xs="12" sm="6">
<CommonCodeSelect @bind-Value="newServiceType" Group="CONSULTING_ACTIVITY_TYPE" Label="서비스 분야" Placeholder="선택" Clearable="true" />
</MudItem>
<MudItem xs="12">
<MudTextField T="string" @bind-Value="newSummary" Label="상담 내용 *"
Lines="3" Variant="Variant.Outlined" Required="true" />
</MudItem>
<MudItem xs="12" sm="6">
<MudSelect T="string" @bind-Value="newResult" Label="결과">
<MudSelectItem Value="@("")">-</MudSelectItem>
@foreach (var r in results)
{
<MudSelectItem Value="@r">@r</MudSelectItem>
}
</MudSelect>
</MudItem>
<MudItem xs="12" sm="6">
<MudNumericField T="decimal?" @bind-Value="newFee" Label="수임료 (원)"
Format="N0" />
</MudItem>
</MudGrid>
<MudStack Row="true" Class="mt-2" Spacing="2">
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="AddConsultation">저장</MudButton>
<MudButton Variant="Variant.Outlined" OnClick="@(() => showAddForm = false)">취소</MudButton>
</MudStack>
</MudPaper>
}
@if (consultations.Count == 0)
{
<MudText Color="Color.Secondary">상담 이력이 없습니다.</MudText>
}
else
{
<MudList T="string" Dense="true">
@foreach (var c in consultations)
{
<MudListItem>
<MudPaper Class="pa-3" Outlined="true" Style="width:100%">
<MudStack Row="true" AlignItems="AlignItems.Start" Justify="Justify.SpaceBetween">
<div>
<MudText Typo="Typo.caption" Color="Color.Secondary">
@c.ConsultationDate.ToString("yyyy-MM-dd")
@if (!string.IsNullOrEmpty(c.ServiceType)) { <text> · @c.ServiceType</text> }
</MudText>
<MudText Style="white-space: pre-wrap;" Class="mt-1">@c.Summary</MudText>
@if (!string.IsNullOrEmpty(c.Result))
{
<MudChip T="string" Size="Size.Small" Color="Color.Info" Class="mt-1">@c.Result</MudChip>
}
@if (c.Fee.HasValue)
{
<MudText Typo="Typo.caption" Color="Color.Secondary" Class="mt-1">
수임료: @c.Fee.Value.ToString("N0")원
</MudText>
}
</div>
<MudIconButton Icon="@Icons.Material.Filled.Delete"
Size="Size.Small" Color="Color.Error"
OnClick="@(() => DeleteConsultation(c.Id))" />
</MudStack>
</MudPaper>
</MudListItem>
}
</MudList>
}
</MudPaper>
</MudItem>
</MudGrid>
@code {
[Parameter]
public int ClientId { get; set; }
private Domain.Entities.Client? client;
private List<Domain.Entities.Consultation> consultations = [];
private static readonly string[] results = ["", "상담완료", "추가자료 요청", "견적발송", "계약전환", "보류"];
private bool showAddForm;
private DateTime? newDate = DateTime.Today;
private string newServiceType = "";
private string newSummary = "";
private string newResult = "";
private decimal? newFee;
protected override async Task OnInitializedAsync()
{
await LoadAll();
}
private async Task LoadAll()
{
client = await ClientClient.GetByIdAsync(ClientId);
consultations = (await ConsultingClient.GetByClientIdAsync(ClientId))
.Select(c => new Domain.Entities.Consultation
{
Id = c.Id,
ClientId = c.ClientId,
ConsultationDate = c.ActivityDate,
ServiceType = c.ActivityType,
Summary = c.Description,
Result = null,
Fee = null
})
.ToList();
}
private void OpenAddConsultation()
{
showAddForm = true;
newDate = DateTime.Today;
newServiceType = "";
newSummary = "";
newResult = "";
newFee = null;
}
private async Task AddConsultation()
{
try
{
var newId = await ConsultingClient.CreateAsync(
ClientId,
string.IsNullOrWhiteSpace(newServiceType) ? "기타" : newServiceType,
newDate?.ToUniversalTime() ?? DateTime.UtcNow,
newSummary,
null,
null);
if (newId <= 0)
throw new Exception("상담 생성 실패");
showAddForm = false;
await LoadAll();
Snackbar.Add("상담이 추가되었습니다.", Severity.Success);
}
catch (ValidationException ex)
{
Snackbar.Add(ex.Message, Severity.Error);
}
catch (Exception ex)
{
Snackbar.Add(ex.Message, Severity.Error);
}
}
private async Task DeleteConsultation(int id)
{
await ConsultingClient.DeleteAsync(id);
await LoadAll();
Snackbar.Add("삭제되었습니다.", Severity.Info);
}
}
@@ -0,0 +1,183 @@
@page "/admin/clients/create"
@page "/admin/clients/{Id:int}/edit"
@attribute [Authorize]
@using TaxBaik.Application.DTOs
@using TaxBaik.Web.Services
@using TaxBaik.Domain.Entities
@using TaxBaik.WasmClient.Components.Admin.Shared
@inject IClientBrowserClient ClientClient
@inject NavigationManager Navigation
@inject ISnackbar Snackbar
<PageTitle>@(Id.HasValue ? "고객 수정" : "고객 등록")</PageTitle>
<section class="admin-page-hero">
<div>
<MudText Typo="Typo.caption" Class="admin-eyebrow">CRM</MudText>
<MudText Typo="Typo.h4" Class="admin-page-title">@(Id.HasValue ? "고객 수정" : "고객 등록")</MudText>
</div>
<MudButton Variant="Variant.Outlined" Href="/taxbaik/admin/clients"
StartIcon="@Icons.Material.Filled.ArrowBack">목록으로</MudButton>
</section>
<AdminEditorPanel Loading="@isLoading" SkeletonContent="@ClientEditSkeleton">
@if (isLoading)
{
}
else
{
<MudForm @ref="form" @bind-IsValid="isValid">
<MudGrid Spacing="3">
@* 기본 정보 *@
<MudItem xs="12">
<MudText Typo="Typo.subtitle1" Class="fw-bold mb-1">기본 정보</MudText>
<MudDivider />
</MudItem>
<MudItem xs="12" md="6">
<MudTextField @bind-Value="dto.Name" Label="고객명 *" Required="true"
RequiredError="고객명을 입력하세요." />
</MudItem>
<MudItem xs="12" md="6">
<MudTextField @bind-Value="dto.CompanyName" Label="회사명 (선택)" />
</MudItem>
<MudItem xs="12" md="6">
<MudTextField @bind-Value="dto.Phone" Label="연락처"
Placeholder="010-0000-0000" />
</MudItem>
<MudItem xs="12" md="6">
<MudTextField @bind-Value="dto.Email" Label="이메일" InputType="InputType.Email" />
</MudItem>
@* 세무 정보 *@
<MudItem xs="12" Class="mt-2">
<MudText Typo="Typo.subtitle1" Class="fw-bold mb-1">세무 정보</MudText>
<MudDivider />
</MudItem>
<MudItem xs="12" md="6">
<CommonCodeSelect @bind-Value="dto.ServiceType" Group="CLIENT_SERVICE_TYPE" Label="서비스 유형" Clearable="true" />
</MudItem>
<MudItem xs="12" md="6">
<CommonCodeSelect @bind-Value="dto.TaxType" Group="CLIENT_TAX_TYPE" Label="세금 유형" Clearable="true" />
</MudItem>
@* 관리 정보 *@
<MudItem xs="12" Class="mt-2">
<MudText Typo="Typo.subtitle1" Class="fw-bold mb-1">관리 정보</MudText>
<MudDivider />
</MudItem>
<MudItem xs="12" md="6">
<CommonCodeSelect @bind-Value="dto.Status" Group="CLIENT_STATUS" Label="상태 *" Required="true" />
</MudItem>
<MudItem xs="12" md="6">
<CommonCodeSelect @bind-Value="dto.Source" Group="CLIENT_SOURCE" Label="유입 경로" Clearable="true" />
</MudItem>
<MudItem xs="12">
<MudTextField @bind-Value="dto.Memo" Label="메모"
Lines="4" AutoGrow="true"
Placeholder="상담 배경, 특이사항, 중요 날짜 등 자유롭게 기록하세요" />
</MudItem>
@* 저장 버튼 *@
<MudItem xs="12" Class="d-flex gap-2 mt-2">
<MudButton Variant="Variant.Filled" Color="Color.Primary"
StartIcon="@Icons.Material.Filled.Save"
OnClick="@SaveAsync" Disabled="@isSaving">
@(isSaving ? "저장 중..." : "저장")
</MudButton>
<MudButton Variant="Variant.Outlined" Href="/taxbaik/admin/clients">
취소
</MudButton>
</MudItem>
</MudGrid>
</MudForm>
}
</AdminEditorPanel>
@code {
[Parameter] public int? Id { get; set; }
private MudForm form = null!;
private CreateClientDto dto = new() { Status = "active" };
private bool isValid;
private bool isLoading = true;
private bool isSaving;
private RenderFragment ClientEditSkeleton => builder =>
{
builder.OpenComponent<AdminSkeletonRows>(0);
builder.AddAttribute(1, "Rows", 6);
builder.AddAttribute(2, "Columns", 3);
builder.CloseComponent();
};
protected override async Task OnInitializedAsync()
{
if (Id.HasValue)
{
try
{
var client = await ClientClient.GetByIdAsync(Id.Value);
if (client is null)
{
Snackbar.Add("고객을 찾을 수 없습니다.", Severity.Error);
Navigation.NavigateTo("/taxbaik/admin/clients");
return;
}
dto = new CreateClientDto
{
Name = client.Name,
CompanyName = client.CompanyName,
Phone = client.Phone,
Email = client.Email,
ServiceType = client.ServiceType,
TaxType = client.TaxType,
Status = client.Status,
Source = client.Source,
Memo = client.Memo
};
}
catch (Exception ex)
{
Snackbar.Add($"오류: {ex.Message}", Severity.Error);
Navigation.NavigateTo("/taxbaik/admin/clients");
return;
}
}
isLoading = false;
}
private async Task SaveAsync()
{
await form.Validate();
if (!isValid) return;
isSaving = true;
try
{
if (Id.HasValue)
{
var result = await ClientClient.UpdateAsync(Id.Value, dto);
if (result != null)
Snackbar.Add("고객 정보가 수정되었습니다.", Severity.Success);
else
Snackbar.Add("수정에 실패했습니다.", Severity.Error);
}
else
{
var result = await ClientClient.CreateAsync(dto);
if (result != null)
Snackbar.Add("고객이 등록되었습니다.", Severity.Success);
else
Snackbar.Add("등록에 실패했습니다.", Severity.Error);
}
Navigation.NavigateTo("/taxbaik/admin/clients");
}
catch (Exception ex)
{
Snackbar.Add($"저장 실패: {ex.Message}", Severity.Error);
}
finally
{
isSaving = false;
}
}
}
@@ -0,0 +1,227 @@
@page "/admin/clients"
@attribute [Authorize]
@using TaxBaik.Web.Services
@using TaxBaik.Domain.Entities
@inject IClientBrowserClient ClientClient
@inject NavigationManager Navigation
@inject IDialogService DialogService
@inject ISnackbar Snackbar
<PageTitle>고객 관리</PageTitle>
<AdminPageHeader Title="고객 관리" Eyebrow="CRM" Subtitle="고객 카드를 등록하고 상담 이력을 관리합니다.">
<ChildContent>
<MudButton Variant="Variant.Filled" Color="Color.Primary"
StartIcon="@Icons.Material.Filled.PersonAdd"
Href="/taxbaik/admin/clients/create">
고객 등록
</MudButton>
</ChildContent>
</AdminPageHeader>
@* 검색/필터 바 *@
<MudPaper Class="admin-surface mb-3 pa-3" Elevation="0">
<MudGrid>
<MudItem xs="12" md="5">
<MudTextField @bind-Value="searchText" Label="검색 (이름·연락처·회사명)"
Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search"
Immediate="false" OnKeyUp="@OnSearchKeyUp" />
</MudItem>
<MudItem xs="12" md="3">
<CommonCodeSelect @bind-Value="statusFilter" Group="CLIENT_STATUS" Label="상태" Placeholder="전체" Clearable="true" />
</MudItem>
<MudItem xs="12" md="2" Class="d-flex align-center">
<MudButton Variant="Variant.Outlined" OnClick="@SearchAsync" FullWidth="true">검색</MudButton>
</MudItem>
<MudItem xs="12" md="2" Class="d-flex align-center">
<MudButton Variant="Variant.Text" OnClick="@ResetAsync" FullWidth="true">초기화</MudButton>
</MudItem>
</MudGrid>
</MudPaper>
<AdminDataPanel Loading="@(clients is null)" SkeletonContent="@ClientListSkeleton">
@if (clients is null)
{
}
else if (!clients.Any())
{
<AdminEmptyState Icon="@Icons.Material.Filled.PeopleAlt" Message="등록된 고객이 없습니다." />
}
else
{
<MudSimpleTable Striped="true" Dense="true" Class="admin-table">
<thead>
<tr>
<th>이름</th>
<th>회사명</th>
<th>연락처</th>
<th>서비스</th>
<th>세금 유형</th>
<th>상태</th>
<th>유입 경로</th>
<th>등록일</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var c in clients)
{
<tr>
<td><strong>@c.Name</strong></td>
<td>@(c.CompanyName ?? "—")</td>
<td>@(c.Phone ?? "—")</td>
<td>
@if (!string.IsNullOrEmpty(c.ServiceType))
{
<MudChip Size="Size.Small" Color="Color.Primary">@c.ServiceType</MudChip>
}
</td>
<td>@(c.TaxType ?? "—")</td>
<td>
@if (c.Status == "active")
{
<MudChip Size="Size.Small" Color="Color.Success">활성</MudChip>
}
else
{
<MudChip Size="Size.Small" Color="Color.Default">비활성</MudChip>
}
</td>
<td>@(c.Source ?? "—")</td>
<td class="small">@c.CreatedAt.ToLocalTime().ToString("yy.MM.dd")</td>
<td>
<MudButtonGroup Size="Size.Small" Variant="Variant.Outlined">
<MudButton @onclick="@(() => Navigation.NavigateTo($"/taxbaik/admin/clients/{c.Id}/edit"))">
수정
</MudButton>
<MudButton Color="Color.Error" @onclick="@(() => DeleteAsync(c))">
삭제
</MudButton>
</MudButtonGroup>
</td>
</tr>
}
</tbody>
</MudSimpleTable>
@* 페이징 *@
@if (totalPages > 1)
{
<div class="d-flex justify-center pa-3">
<MudPagination BoundaryCount="1" MiddleCount="3"
Count="@totalPages" Selected="@currentPage"
SelectedChanged="@OnPageChanged" />
</div>
}
<MudText Typo="Typo.caption" Class="pa-2 text-muted">총 @(totalCount)명</MudText>
}
</AdminDataPanel>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<Client>? clients;
private string searchText = "";
private string statusFilter = "";
private int currentPage = 1;
private int totalCount;
private int totalPages;
private const int PageSize = 20;
private RenderFragment ClientListSkeleton => builder =>
{
builder.OpenComponent<AdminSkeletonRows>(0);
builder.AddAttribute(1, "Rows", 5);
builder.AddAttribute(2, "Columns", 5);
builder.CloseComponent();
};
protected override async Task OnInitializedAsync()
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadAsync();
}
}
}
private async Task LoadAsync()
{
try
{
var (items, total) = await ClientClient.GetPagedAsync(
currentPage, PageSize,
string.IsNullOrEmpty(statusFilter) ? null : statusFilter,
string.IsNullOrEmpty(searchText) ? null : searchText);
clients = items.ToList();
totalCount = total;
totalPages = (int)Math.Ceiling((double)total / PageSize);
}
catch (Exception ex)
{
Snackbar.Add($"오류: {ex.Message}", Severity.Error);
clients = [];
totalCount = 0;
totalPages = 0;
}
}
private async Task SearchAsync()
{
currentPage = 1;
await LoadAsync();
}
private async Task ResetAsync()
{
searchText = "";
statusFilter = "";
currentPage = 1;
await LoadAsync();
}
private async Task OnPageChanged(int page)
{
currentPage = page;
await LoadAsync();
}
private async Task OnSearchKeyUp(KeyboardEventArgs e)
{
if (e.Key == "Enter") await SearchAsync();
}
private async Task DeleteAsync(Client client)
{
var confirmed = await DialogService.ShowMessageBox(
"고객 삭제",
$"'{client.Name}' 고객을 삭제하시겠습니까? 관련 데이터도 함께 삭제됩니다.",
yesText: "삭제", cancelText: "취소");
if (confirmed != true) return;
try
{
var success = await ClientClient.DeleteAsync(client.Id);
if (success)
{
Snackbar.Add($"{client.Name} 고객이 삭제되었습니다.", Severity.Success);
await LoadAsync();
}
else
{
Snackbar.Add("삭제에 실패했습니다.", Severity.Error);
}
}
catch (Exception ex)
{
Snackbar.Add($"오류: {ex.Message}", Severity.Error);
}
await LoadAsync();
}
}