From 46cb508bdfbfb444f8e87d4787728a5daa87e8f5 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Mon, 29 Jun 2026 15:16:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Contract,=20TaxProfile,=20TaxFilingSched?= =?UTF-8?q?ule=EC=97=90=20=EB=8C=80=ED=95=B4=20=EC=84=A0=EC=A0=9C=EC=A0=81?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20GetAllAsync=20API=20=EB=B0=8F=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=EC=B2=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TaxBaik.Application/Services/ContractService.cs | 3 +++ .../Services/TaxFilingScheduleService.cs | 3 +++ TaxBaik.Application/Services/TaxProfileService.cs | 3 +++ TaxBaik.Domain/Interfaces/IContractRepository.cs | 1 + .../Interfaces/ITaxFilingScheduleRepository.cs | 1 + TaxBaik.Domain/Interfaces/ITaxProfileRepository.cs | 1 + .../Repositories/ContractRepository.cs | 8 ++++++++ .../Repositories/TaxFilingScheduleRepository.cs | 8 ++++++++ .../Repositories/TaxProfileRepository.cs | 10 ++++++++++ TaxBaik.Web/Controllers/ContractController.cs | 14 ++++++++++++++ .../Controllers/TaxFilingScheduleController.cs | 14 ++++++++++++++ TaxBaik.Web/Controllers/TaxProfileController.cs | 14 ++++++++++++++ 12 files changed, 80 insertions(+) diff --git a/TaxBaik.Application/Services/ContractService.cs b/TaxBaik.Application/Services/ContractService.cs index f902b8f..3e81291 100644 --- a/TaxBaik.Application/Services/ContractService.cs +++ b/TaxBaik.Application/Services/ContractService.cs @@ -36,6 +36,9 @@ public class ContractService(IContractRepository repository) public async Task GetByIdAsync(int id, CancellationToken ct = default) => await repository.GetByIdAsync(id, ct); + public async Task> GetAllAsync(CancellationToken ct = default) => + await repository.GetAllAsync(ct); + public async Task> GetByClientIdAsync(int clientId, CancellationToken ct = default) => await repository.GetByClientIdAsync(clientId, ct); diff --git a/TaxBaik.Application/Services/TaxFilingScheduleService.cs b/TaxBaik.Application/Services/TaxFilingScheduleService.cs index fcf1dbd..c51c6bb 100644 --- a/TaxBaik.Application/Services/TaxFilingScheduleService.cs +++ b/TaxBaik.Application/Services/TaxFilingScheduleService.cs @@ -33,6 +33,9 @@ public class TaxFilingScheduleService(ITaxFilingScheduleRepository repository) public async Task GetByIdAsync(int id, CancellationToken ct = default) => await repository.GetByIdAsync(id, ct); + public async Task> GetAllAsync(CancellationToken ct = default) => + await repository.GetAllAsync(ct); + public async Task> GetByClientIdAsync(int clientId, CancellationToken ct = default) => await repository.GetByClientIdAsync(clientId, ct); diff --git a/TaxBaik.Application/Services/TaxProfileService.cs b/TaxBaik.Application/Services/TaxProfileService.cs index 7dfe1d4..a3e48c2 100644 --- a/TaxBaik.Application/Services/TaxProfileService.cs +++ b/TaxBaik.Application/Services/TaxProfileService.cs @@ -31,6 +31,9 @@ public class TaxProfileService(ITaxProfileRepository repository) public async Task GetByClientIdAsync(int clientId, CancellationToken ct = default) => await repository.GetByClientIdAsync(clientId, ct); + public async Task> GetAllAsync(CancellationToken ct = default) => + await repository.GetAllAsync(ct); + public async Task UpdateAsync(int profileId, string? businessType, string? accountingMethod, DateTime? nextFilingDueDate, string taxRiskLevel = "normal", CancellationToken ct = default) { diff --git a/TaxBaik.Domain/Interfaces/IContractRepository.cs b/TaxBaik.Domain/Interfaces/IContractRepository.cs index 7815545..630f4d5 100644 --- a/TaxBaik.Domain/Interfaces/IContractRepository.cs +++ b/TaxBaik.Domain/Interfaces/IContractRepository.cs @@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities; public interface IContractRepository { Task CreateAsync(Contract contract, CancellationToken cancellationToken = default); + Task> GetAllAsync(CancellationToken cancellationToken = default); Task GetByIdAsync(int id, CancellationToken cancellationToken = default); Task> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default); Task> GetActiveContractsAsync(CancellationToken cancellationToken = default); diff --git a/TaxBaik.Domain/Interfaces/ITaxFilingScheduleRepository.cs b/TaxBaik.Domain/Interfaces/ITaxFilingScheduleRepository.cs index 5bfefd2..33ba1aa 100644 --- a/TaxBaik.Domain/Interfaces/ITaxFilingScheduleRepository.cs +++ b/TaxBaik.Domain/Interfaces/ITaxFilingScheduleRepository.cs @@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities; public interface ITaxFilingScheduleRepository { Task CreateAsync(TaxFilingSchedule schedule, CancellationToken cancellationToken = default); + Task> GetAllAsync(CancellationToken cancellationToken = default); Task GetByIdAsync(int id, CancellationToken cancellationToken = default); Task> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default); Task> GetUpcomingDuesAsync(int daysAhead = 30, CancellationToken cancellationToken = default); diff --git a/TaxBaik.Domain/Interfaces/ITaxProfileRepository.cs b/TaxBaik.Domain/Interfaces/ITaxProfileRepository.cs index 970327e..b40eab9 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> GetAllAsync(CancellationToken cancellationToken = default); Task GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default); Task UpdateAsync(TaxProfile profile, CancellationToken cancellationToken = default); Task> GetByRiskLevelAsync(string riskLevel, CancellationToken cancellationToken = default); diff --git a/TaxBaik.Infrastructure/Repositories/ContractRepository.cs b/TaxBaik.Infrastructure/Repositories/ContractRepository.cs index e68f535..ec7c925 100644 --- a/TaxBaik.Infrastructure/Repositories/ContractRepository.cs +++ b/TaxBaik.Infrastructure/Repositories/ContractRepository.cs @@ -16,6 +16,14 @@ public class ContractRepository(IDbConnectionFactory connectionFactory) : BaseRe contract); } + public async Task> GetAllAsync(CancellationToken cancellationToken = default) + { + using var conn = Conn(); + return await conn.QueryAsync( + @"SELECT id, client_id, contract_number, service_type, contract_date, start_date, end_date, monthly_fee, total_amount, payment_status, status, notes, created_at, updated_at + FROM contracts ORDER BY contract_date DESC"); + } + public async Task GetByIdAsync(int id, CancellationToken cancellationToken = default) { using var conn = Conn(); diff --git a/TaxBaik.Infrastructure/Repositories/TaxFilingScheduleRepository.cs b/TaxBaik.Infrastructure/Repositories/TaxFilingScheduleRepository.cs index 6c2c4ab..caaf92d 100644 --- a/TaxBaik.Infrastructure/Repositories/TaxFilingScheduleRepository.cs +++ b/TaxBaik.Infrastructure/Repositories/TaxFilingScheduleRepository.cs @@ -16,6 +16,14 @@ public class TaxFilingScheduleRepository(IDbConnectionFactory connectionFactory) schedule); } + public async Task> GetAllAsync(CancellationToken cancellationToken = default) + { + using var conn = Conn(); + return await conn.QueryAsync( + @"SELECT id, client_id, filing_type, due_date, filing_year, status, assigned_to, completed_date, notes, created_at, updated_at + FROM tax_filing_schedules ORDER BY due_date DESC"); + } + public async Task GetByIdAsync(int id, CancellationToken cancellationToken = default) { using var conn = Conn(); diff --git a/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs b/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs index f1eedc2..c4a1822 100644 --- a/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs +++ b/TaxBaik.Infrastructure/Repositories/TaxProfileRepository.cs @@ -20,6 +20,16 @@ public class TaxProfileRepository(IDbConnectionFactory connectionFactory) : Base profile); } + public async Task> GetAllAsync(CancellationToken cancellationToken = default) + { + using var conn = Conn(); + return await conn.QueryAsync( + @"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 ORDER BY id DESC"); + } + public async Task GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default) { using var conn = Conn(); diff --git a/TaxBaik.Web/Controllers/ContractController.cs b/TaxBaik.Web/Controllers/ContractController.cs index 5324191..c9dabff 100644 --- a/TaxBaik.Web/Controllers/ContractController.cs +++ b/TaxBaik.Web/Controllers/ContractController.cs @@ -24,6 +24,20 @@ public class ContractController(ContractService service) : ControllerBase } } + [HttpGet] + public async Task GetAll() + { + try + { + var contracts = await service.GetAllAsync(); + return Ok(contracts); + } + catch (Exception ex) + { + return StatusCode(500, new { error = "조회 실패", message = ex.Message }); + } + } + [HttpGet("{id:int}")] public async Task GetById(int id) { diff --git a/TaxBaik.Web/Controllers/TaxFilingScheduleController.cs b/TaxBaik.Web/Controllers/TaxFilingScheduleController.cs index 5da220d..0948613 100644 --- a/TaxBaik.Web/Controllers/TaxFilingScheduleController.cs +++ b/TaxBaik.Web/Controllers/TaxFilingScheduleController.cs @@ -24,6 +24,20 @@ public class TaxFilingScheduleController(TaxFilingScheduleService service) : Con } } + [HttpGet] + public async Task GetAll() + { + try + { + var schedules = await service.GetAllAsync(); + return Ok(schedules); + } + catch (Exception ex) + { + return StatusCode(500, new { error = "조회 실패", message = ex.Message }); + } + } + [HttpGet("{id:int}")] public async Task GetById(int id) { diff --git a/TaxBaik.Web/Controllers/TaxProfileController.cs b/TaxBaik.Web/Controllers/TaxProfileController.cs index d285356..8182700 100644 --- a/TaxBaik.Web/Controllers/TaxProfileController.cs +++ b/TaxBaik.Web/Controllers/TaxProfileController.cs @@ -24,6 +24,20 @@ public class TaxProfileController(TaxProfileService taxProfileService) : Control } } + [HttpGet] + public async Task GetAll() + { + try + { + var profiles = await taxProfileService.GetAllAsync(); + return Ok(profiles); + } + catch (Exception ex) + { + return StatusCode(500, new { error = "조회 실패", message = ex.Message }); + } + } + [HttpGet("client/{clientId:int}")] public async Task GetByClientId(int clientId) {