diff --git a/TaxBaik.Application/Services/TaxProfileService.cs b/TaxBaik.Application/Services/TaxProfileService.cs index a3e48c2..4b55828 100644 --- a/TaxBaik.Application/Services/TaxProfileService.cs +++ b/TaxBaik.Application/Services/TaxProfileService.cs @@ -37,7 +37,10 @@ public class TaxProfileService(ITaxProfileRepository repository) public async Task UpdateAsync(int profileId, string? businessType, string? accountingMethod, DateTime? nextFilingDueDate, string taxRiskLevel = "normal", CancellationToken ct = default) { - var profile = new TaxProfile { Id = profileId }; + var profile = await repository.GetByIdAsync(profileId, ct); + if (profile == null) + throw new ValidationException("세무 프로필을 찾을 수 없습니다."); + if (!string.IsNullOrWhiteSpace(businessType)) profile.BusinessType = businessType.Trim(); if (!string.IsNullOrWhiteSpace(accountingMethod)) diff --git a/TaxBaik.Domain/Interfaces/ITaxProfileRepository.cs b/TaxBaik.Domain/Interfaces/ITaxProfileRepository.cs index b40eab9..c4c5972 100644 --- a/TaxBaik.Domain/Interfaces/ITaxProfileRepository.cs +++ b/TaxBaik.Domain/Interfaces/ITaxProfileRepository.cs @@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities; public interface ITaxProfileRepository { Task CreateAsync(TaxProfile profile, CancellationToken cancellationToken = default); + Task GetByIdAsync(int id, CancellationToken cancellationToken = default); Task> GetAllAsync(CancellationToken cancellationToken = default); Task GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default); Task UpdateAsync(TaxProfile profile, CancellationToken cancellationToken = default); diff --git a/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs b/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs index c4a1822..8f6c743 100644 --- a/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs +++ b/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs @@ -20,6 +20,17 @@ public class TaxProfileRepository(IDbConnectionFactory connectionFactory) : Base profile); } + public async Task GetByIdAsync(int id, CancellationToken cancellationToken = default) + { + using var conn = Conn(); + return await conn.QueryFirstOrDefaultAsync( + @"SELECT id, client_id, business_registration, business_type, establishment_date, + annual_revenue_range, employee_count, accounting_method, fiscal_year_end, last_filing_date, + next_filing_due_date, tax_risk_level, previous_audit_history, special_notes, created_at, updated_at + FROM tax_profiles WHERE id = @Id", + new { Id = id }); + } + public async Task> GetAllAsync(CancellationToken cancellationToken = default) { using var conn = Conn(); diff --git a/tests/e2e/admin-responsive.spec.ts b/tests/e2e/admin-responsive.spec.ts index b548b5a..97fcc51 100644 --- a/tests/e2e/admin-responsive.spec.ts +++ b/tests/e2e/admin-responsive.spec.ts @@ -15,7 +15,7 @@ const TEST_PASSWORD = process.env.E2E_ADMIN_PASSWORD || 'TestAdmin@123456'; * - 운영(localhost): http://localhost/taxbaik (Nginx 라우팅 → active 포트) * - 로컬 직접 테스트: http://127.0.0.1:5001/taxbaik (개발 포트) */ -const baseUrl = (process.env.E2E_BASE_URL ?? 'http://localhost/taxbaik').replace(/\/$/, ''); +const baseUrl = (process.env.E2E_BASE_URL ?? 'http://178.104.200.7/taxbaik').replace(/\/$/, ''); /** * API를 통한 테스트 데이터 생성