refactor: Phase 7-3 - Clients + TaxFilings API-First (WIP)
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
**Clients Migration Complete:** - ClientController: GET /api/client (paged), POST/PUT/DELETE - ClientBrowserClient: IClientBrowserClient interface + implementation - ClientList.razor: Service → API client - ClientEdit.razor: Service → API client (Create/Update) **TaxFilings API Framework Ready:** - TaxFilingController: GET upcoming, GET by client, POST/PUT/DELETE - TaxFilingBrowserClient: ITaxFilingBrowserClient interface + impl - Registered in Program.cs with TokenRefreshHandler **SOLID Applied:** ✓ Separation of concerns (Controller → Service → Repository) ✓ Dependency inversion (Blazor → Browser clients, not services) ✓ Interface segregation (Specialized clients per domain) **Status:** - Clients Blazor: ✅ ClientList + ClientEdit refactored - TaxFilings Blazor: ⏳ Pending refactor (pages exist) - Faqs: ⏳ API + Blazor pending - Announcements: ⏳ API + Blazor pending - Phase 6 SignalR: ⏳ Deferred Next: Refactor TaxFilings Blazor pages, then Faqs & Announcements Build: ✅ Success (0 errors, 2 warnings in Dashboard) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
@page "/admin/clients/{Id:int}/edit"
|
||||
@attribute [Authorize]
|
||||
@using TaxBaik.Application.DTOs
|
||||
@using TaxBaik.Application.Services
|
||||
@using TaxBaik.Web.Services
|
||||
@using TaxBaik.Domain.Entities
|
||||
@inject ClientService ClientService
|
||||
@inject IClientBrowserClient ClientClient
|
||||
@inject NavigationManager Navigation
|
||||
@inject ISnackbar Snackbar
|
||||
|
||||
@@ -124,25 +124,34 @@
|
||||
{
|
||||
if (Id.HasValue)
|
||||
{
|
||||
var client = await ClientService.GetByIdAsync(Id.Value);
|
||||
if (client is null)
|
||||
try
|
||||
{
|
||||
Snackbar.Add("고객을 찾을 수 없습니다.", Severity.Error);
|
||||
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;
|
||||
}
|
||||
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
|
||||
};
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -157,13 +166,19 @@
|
||||
{
|
||||
if (Id.HasValue)
|
||||
{
|
||||
await ClientService.UpdateAsync(Id.Value, dto);
|
||||
Snackbar.Add("고객 정보가 수정되었습니다.", Severity.Success);
|
||||
var result = await ClientClient.UpdateAsync(Id.Value, dto);
|
||||
if (result != null)
|
||||
Snackbar.Add("고객 정보가 수정되었습니다.", Severity.Success);
|
||||
else
|
||||
Snackbar.Add("수정에 실패했습니다.", Severity.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newId = await ClientService.CreateAsync(dto);
|
||||
Snackbar.Add("고객이 등록되었습니다.", Severity.Success);
|
||||
var result = await ClientClient.CreateAsync(dto);
|
||||
if (result != null)
|
||||
Snackbar.Add("고객이 등록되었습니다.", Severity.Success);
|
||||
else
|
||||
Snackbar.Add("등록에 실패했습니다.", Severity.Error);
|
||||
}
|
||||
Navigation.NavigateTo("/taxbaik/admin/clients");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@page "/admin/clients"
|
||||
@attribute [Authorize]
|
||||
@using TaxBaik.Application.Services
|
||||
@using TaxBaik.Web.Services
|
||||
@using TaxBaik.Domain.Entities
|
||||
@inject ClientService ClientService
|
||||
@inject IClientBrowserClient ClientClient
|
||||
@inject NavigationManager Navigation
|
||||
@inject IDialogService DialogService
|
||||
@inject ISnackbar Snackbar
|
||||
@@ -141,14 +141,24 @@
|
||||
|
||||
private async Task LoadAsync()
|
||||
{
|
||||
var (items, total) = await ClientService.GetPagedAsync(
|
||||
currentPage, PageSize,
|
||||
string.IsNullOrEmpty(statusFilter) ? null : statusFilter,
|
||||
string.IsNullOrEmpty(searchText) ? null : searchText);
|
||||
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);
|
||||
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()
|
||||
@@ -185,8 +195,23 @@
|
||||
|
||||
if (confirmed != true) return;
|
||||
|
||||
await ClientService.DeleteAsync(client.Id);
|
||||
Snackbar.Add($"{client.Name} 고객이 삭제되었습니다.", Severity.Success);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user