refactor: fully integrate Browser Client into main Web server
TaxBaik CI/CD / build-and-deploy (push) Failing after 48s

BREAKING CHANGE: Removed TaxBaik.Web.Client project (separate WASM app)

Changes:
- Migrated all Blazor components to TaxBaik.Web/Components/Admin
- Migrated all Browser Client services to Components/Admin/Services
- Updated Program.cs to use integrated components (same assembly)
- Removed AddAdditionalAssemblies (no longer needed)
- Updated _Imports.razor with correct namespaces

Architecture:
 API-First: REST endpoints in TaxBaik.Web (ASP.NET Core)
 Client-Side: Blazor WASM components in TaxBaik.Web/Components
 Unified: Both API and UI served from single web server
 No separation: No separate client project

Result:
- Single deploy unit (TaxBaik.Web)
- API served only from web server
- Blazor renders client-side (prerender: false for protected pages)
- Monolithic web app architecture

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 15:39:19 +09:00
parent 69eeaca937
commit 2797473c56
89 changed files with 10 additions and 119 deletions
@@ -0,0 +1,125 @@
namespace TaxBaik.Web.Services;
using System.Net.Http;
using System.Net.Http.Json;
using TaxBaik.Domain.Entities;
public interface IFaqBrowserClient
{
Task<IEnumerable<Faq>> GetAllAsync(CancellationToken ct = default);
Task<Faq?> GetByIdAsync(int id, CancellationToken ct = default);
Task<Faq?> CreateAsync(Faq faq, CancellationToken ct = default);
Task<Faq?> UpdateAsync(int id, Faq faq, CancellationToken ct = default);
Task<bool> DeleteAsync(int id, CancellationToken ct = default);
}
public class FaqBrowserClient : IFaqBrowserClient
{
private readonly HttpClient _http;
private readonly ILogger<FaqBrowserClient> _logger;
private readonly ITokenStore _tokenStore;
public FaqBrowserClient(HttpClient http, ILogger<FaqBrowserClient> logger, ITokenStore tokenStore)
{
_http = http;
_logger = logger;
_tokenStore = tokenStore;
}
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
_http.DefaultRequestHeaders.Authorization = new("Bearer", _tokenStore.AccessToken);
else
_http.DefaultRequestHeaders.Authorization = null;
}
public async Task<IEnumerable<Faq>> GetAllAsync(CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
var result = await _http.GetFromJsonAsync<FaqListResponse>("faq", cancellationToken: ct);
return result?.Data ?? [];
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "Failed to fetch FAQs");
throw;
}
}
public async Task<Faq?> GetByIdAsync(int id, CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
return await _http.GetFromJsonAsync<Faq>($"faq/{id}", cancellationToken: ct);
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "Failed to fetch FAQ {FaqId}", id);
throw;
}
}
public async Task<Faq?> CreateAsync(Faq faq, CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
var response = await _http.PostAsJsonAsync("faq", faq, cancellationToken: ct);
if (!response.IsSuccessStatusCode) return null;
var content = await response.Content.ReadAsStringAsync(ct);
return System.Text.Json.JsonSerializer.Deserialize<Faq>(
content,
new System.Text.Json.JsonSerializerOptions { PropertyNameCaseInsensitive = true });
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "Failed to create FAQ");
throw;
}
}
public async Task<Faq?> UpdateAsync(int id, Faq faq, CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
var response = await _http.PutAsJsonAsync($"faq/{id}", faq, cancellationToken: ct);
if (!response.IsSuccessStatusCode) return null;
var content = await response.Content.ReadAsStringAsync(ct);
return System.Text.Json.JsonSerializer.Deserialize<Faq>(
content,
new System.Text.Json.JsonSerializerOptions { PropertyNameCaseInsensitive = true });
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "Failed to update FAQ {FaqId}", id);
throw;
}
}
public async Task<bool> DeleteAsync(int id, CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
var response = await _http.DeleteAsync($"faq/{id}", cancellationToken: ct);
return response.IsSuccessStatusCode;
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "Failed to delete FAQ {FaqId}", id);
throw;
}
}
private class FaqListResponse
{
public List<Faq> Data { get; set; } = [];
}
}