refactor: Phase 7-2 Complete - Full Inquiry page API-First migration
TaxBaik CI/CD / build-and-deploy (push) Successful in 49s
TaxBaik CI/CD / build-and-deploy (push) Successful in 49s
**Blockers Fixed:** 1. InquiryBrowserClient URL hardcoding - Removed: \"http://localhost:5001\" hardcoded in each method - Added: Configured BaseAddress in Program.cs - Now uses: Relative paths (\"inquiry\", \"inquiry/{id}\", etc) - HttpClientFactory pipeline includes TokenRefreshHandler 2. Missing API endpoints in InquiryController - Added: PUT /api/inquiry/{id}/memo - Added: POST /api/inquiry/{id}/convert-to-client - Request DTOs: UpdateAdminMemoRequest, ConvertToClientRequest - ClientService injected (for client creation) **Implementation:** - InquiryBrowserClient: Extended interface * UpdateAdminMemoAsync(id, memo) * ConvertToClientAsync(id, name, phone, serviceType) * All methods use relative paths - InquiryBrowserClient.ConvertToClientResponse * Deserialize API response to extract clientId - InquiryDetail.razor: Full refactor * Before: @inject InquiryService, ClientService (direct service calls) * After: @inject IInquiryBrowserClient (API-only) * OnInitializedAsync: InquiryClient.GetByIdAsync * OnStatusChanged: InquiryClient.UpdateStatusAsync * SaveMemo: InquiryClient.UpdateAdminMemoAsync * ConvertToClient: InquiryClient.ConvertToClientAsync **InquiryList.razor status:** * Also still injects IInquiryRepository (line 4) * Consider refactoring to use IInquiryBrowserClient for consistency **Phase 7 Status:** - ✅ Blog page: Already API-First (ApiClient) - ✅ Inquiry page: Fully API-First (IInquiryBrowserClient) * InquiryTable: ✅ Migrated * InquiryDetail: ✅ Migrated * InquiryList: ⏳ Still uses IInquiryRepository (minor - reads only) **SOLID Applied:** ✓ S: InquiryBrowserClient single responsibility ✓ D: Blazor → IInquiryBrowserClient (not ServiceLayer) ✓ O: Client can change without Blazor impact Next: Check FAQ, Client, TaxFiling pages for same pattern. If all still injecting services directly, migrate sequentially. Then: Phase 6 (SignalR) will have all pages ready. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
@page "/admin/inquiries/{InquiryId:int}"
|
||||
@attribute [Authorize]
|
||||
@using TaxBaik.Application.Services
|
||||
@inject InquiryService InquiryService
|
||||
@inject ClientService ClientService
|
||||
@using TaxBaik.Web.Services
|
||||
@inject IInquiryBrowserClient InquiryClient
|
||||
@inject NavigationManager Navigation
|
||||
@inject ISnackbar Snackbar
|
||||
|
||||
@@ -114,7 +113,7 @@ else
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
inquiry = await InquiryService.GetByIdAsync(InquiryId);
|
||||
inquiry = await InquiryClient.GetByIdAsync(InquiryId);
|
||||
adminMemo = inquiry?.AdminMemo ?? "";
|
||||
}
|
||||
|
||||
@@ -123,22 +122,43 @@ else
|
||||
if (inquiry == null) return;
|
||||
try
|
||||
{
|
||||
await InquiryService.UpdateStatusAsync(inquiry.Id, status, "관리자");
|
||||
inquiry.Status = status;
|
||||
Snackbar.Add("상태가 변경되었습니다.", Severity.Success);
|
||||
var success = await InquiryClient.UpdateStatusAsync(inquiry.Id, status);
|
||||
if (success)
|
||||
{
|
||||
inquiry.Status = status;
|
||||
Snackbar.Add("상태가 변경되었습니다.", Severity.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Add("상태 변경에 실패했습니다.", Severity.Error);
|
||||
}
|
||||
}
|
||||
catch (ValidationException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add(ex.Message, Severity.Error);
|
||||
Snackbar.Add($"오류: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveMemo()
|
||||
{
|
||||
if (inquiry == null) return;
|
||||
await InquiryService.UpdateAdminMemoAsync(inquiry.Id, adminMemo);
|
||||
inquiry.AdminMemo = adminMemo;
|
||||
Snackbar.Add("메모가 저장되었습니다.", Severity.Success);
|
||||
try
|
||||
{
|
||||
var success = await InquiryClient.UpdateAdminMemoAsync(inquiry.Id, adminMemo);
|
||||
if (success)
|
||||
{
|
||||
inquiry.AdminMemo = adminMemo;
|
||||
Snackbar.Add("메모가 저장되었습니다.", Severity.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Add("메모 저장에 실패했습니다.", Severity.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"오류: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ConvertToClient()
|
||||
@@ -146,12 +166,22 @@ else
|
||||
if (inquiry == null) return;
|
||||
try
|
||||
{
|
||||
var clientId = await ClientService.CreateFromInquiryAsync(inquiry.Name, inquiry.Phone, inquiry.ServiceType);
|
||||
await InquiryService.LinkClientAsync(inquiry.Id, clientId);
|
||||
await InquiryService.UpdateStatusAsync(inquiry.Id, "consulting", "관리자");
|
||||
inquiry.ClientId = clientId;
|
||||
inquiry.Status = "consulting";
|
||||
Snackbar.Add("고객 카드가 생성되었습니다.", Severity.Success);
|
||||
var clientId = await InquiryClient.ConvertToClientAsync(
|
||||
inquiry.Id,
|
||||
inquiry.Name,
|
||||
inquiry.Phone,
|
||||
inquiry.ServiceType);
|
||||
|
||||
if (clientId > 0)
|
||||
{
|
||||
inquiry.ClientId = clientId;
|
||||
inquiry.Status = "consulting";
|
||||
Snackbar.Add("고객 카드가 생성되었습니다.", Severity.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Add("고객 카드 생성에 실패했습니다.", Severity.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user