From 55c65810c188f4abcf9821da360d85159b7f09ad Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Mon, 29 Jun 2026 15:09:21 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20RevenueTracking=20=EC=A0=84=EC=B2=B4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EB=B0=8F=20=EB=A6=AC=ED=8F=AC?= =?UTF-8?q?=EC=A7=80=ED=86=A0=EB=A6=AC/=EC=84=9C=EB=B9=84=EC=8A=A4=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/RevenueTrackingService.cs | 3 +++ .../Interfaces/IRevenueTrackingRepository.cs | 1 + .../Repositories/RevenueTrackingRepository.cs | 8 ++++++++ .../Controllers/RevenueTrackingController.cs | 14 ++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/TaxBaik.Application/Services/RevenueTrackingService.cs b/TaxBaik.Application/Services/RevenueTrackingService.cs index d9a3b2e..be9c66c 100644 --- a/TaxBaik.Application/Services/RevenueTrackingService.cs +++ b/TaxBaik.Application/Services/RevenueTrackingService.cs @@ -34,6 +34,9 @@ public class RevenueTrackingService(IRevenueTrackingRepository 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> GetPendingPaymentsAsync(CancellationToken ct = default) => await repository.GetPendingPaymentsAsync(ct); diff --git a/TaxBaik.Domain/Interfaces/IRevenueTrackingRepository.cs b/TaxBaik.Domain/Interfaces/IRevenueTrackingRepository.cs index f1a04aa..498402b 100644 --- a/TaxBaik.Domain/Interfaces/IRevenueTrackingRepository.cs +++ b/TaxBaik.Domain/Interfaces/IRevenueTrackingRepository.cs @@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities; public interface IRevenueTrackingRepository { Task CreateAsync(RevenueTracking revenue, CancellationToken cancellationToken = default); + Task> GetAllAsync(CancellationToken cancellationToken = default); Task> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default); Task> GetPendingPaymentsAsync(CancellationToken cancellationToken = default); Task> GetByDateRangeAsync(DateTime startDate, DateTime endDate, CancellationToken cancellationToken = default); diff --git a/TaxBaik.Infrastructure/Repositories/RevenueTrackingRepository.cs b/TaxBaik.Infrastructure/Repositories/RevenueTrackingRepository.cs index 8a527a9..a6fe61a 100644 --- a/TaxBaik.Infrastructure/Repositories/RevenueTrackingRepository.cs +++ b/TaxBaik.Infrastructure/Repositories/RevenueTrackingRepository.cs @@ -16,6 +16,14 @@ public class RevenueTrackingRepository(IDbConnectionFactory connectionFactory) : revenue); } + public async Task> GetAllAsync(CancellationToken cancellationToken = default) + { + using var conn = Conn(); + return await conn.QueryAsync( + @"SELECT id, client_id, invoice_number, invoice_date, service_type, amount, payment_status, payment_date, due_date, notes, created_at, updated_at + FROM revenue_tracking ORDER BY invoice_date DESC"); + } + public async Task> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default) { using var conn = Conn(); diff --git a/TaxBaik.Web/Controllers/RevenueTrackingController.cs b/TaxBaik.Web/Controllers/RevenueTrackingController.cs index c4e4f1b..0534ee1 100644 --- a/TaxBaik.Web/Controllers/RevenueTrackingController.cs +++ b/TaxBaik.Web/Controllers/RevenueTrackingController.cs @@ -24,6 +24,20 @@ public class RevenueTrackingController(RevenueTrackingService service) : Control } } + [HttpGet] + public async Task GetAll() + { + try + { + var revenues = await service.GetAllAsync(); + return Ok(revenues); + } + catch (Exception ex) + { + return StatusCode(500, new { error = "조회 실패", message = ex.Message }); + } + } + [HttpGet("{id:int}")] public async Task GetById(int id) {