c2955ad02f
TaxBaik CI/CD / build-and-deploy (push) Successful in 49s
Phase 2: Repository Implementation (Dapper) - TaxProfileRepository: tax profile CRUD + risk level analysis + filing due dates - TaxFilingScheduleRepository: schedule tracking + upcoming due dates + completion marking - ConsultingActivityRepository: CRM activity history + pending followups + consultant tracking - ContractRepository: contract lifecycle + active contracts + expiring alerts + MRR calculation - RevenueTrackingRepository: invoice tracking + payment status + revenue analysis Phase 3: Service Layer (Business Logic) - TaxProfileService: profile creation, risk assessment, upcoming filing detection - TaxFilingScheduleService: schedule management, deadline tracking, completion workflow - ConsultingActivityService: activity logging, followup management, consultant productivity - ContractService: contract management, MRR calculation, expiring contract alerts - RevenueTrackingService: invoice creation, payment tracking, revenue analytics Phase 4: API Controller (REST Endpoints) - TaxProfileController: CRUD operations + high-risk filtering + upcoming filings query Architecture Highlights: - SOLID principles: each layer has clear responsibility - Dapper-based repositories for data access - Comprehensive service layer for business logic - RESTful API design with proper error handling - Ready for Blazor UI implementation and deployment Database Migration V015 executed: - 5 new specialized tables for CRM and tax accounting - Appropriate indexes for query performance - Foreign key constraints for data integrity
98 lines
3.2 KiB
C#
98 lines
3.2 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using TaxBaik.Application.Services;
|
|
|
|
namespace TaxBaik.Web.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
[Authorize]
|
|
public class TaxProfileController(TaxProfileService taxProfileService) : ControllerBase
|
|
{
|
|
[HttpPost]
|
|
public async Task<IActionResult> Create([FromBody] CreateTaxProfileRequest request)
|
|
{
|
|
try
|
|
{
|
|
var id = await taxProfileService.CreateAsync(request.ClientId, request.BusinessType,
|
|
request.BusinessRegistration, request.AccountingMethod, request.EstablishmentDate);
|
|
return CreatedAtAction(nameof(GetByClientId), new { clientId = request.ClientId }, new { id });
|
|
}
|
|
catch (ValidationException ex)
|
|
{
|
|
return BadRequest(new { error = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("client/{clientId:int}")]
|
|
public async Task<IActionResult> GetByClientId(int clientId)
|
|
{
|
|
try
|
|
{
|
|
var profile = await taxProfileService.GetByClientIdAsync(clientId);
|
|
if (profile == null)
|
|
return NotFound(new { error = "세무 프로필을 찾을 수 없습니다." });
|
|
return Ok(profile);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("high-risk")]
|
|
public async Task<IActionResult> GetHighRiskProfiles()
|
|
{
|
|
try
|
|
{
|
|
var profiles = await taxProfileService.GetHighRiskProfilesAsync();
|
|
return Ok(new { data = profiles });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("upcoming-filings")]
|
|
public async Task<IActionResult> GetUpcomingFiliings([FromQuery] int daysAhead = 30)
|
|
{
|
|
try
|
|
{
|
|
var profiles = await taxProfileService.GetUpcomingFilingDuesAsync(daysAhead);
|
|
return Ok(new { data = profiles, daysAhead });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpPut("{id:int}")]
|
|
public async Task<IActionResult> Update(int id, [FromBody] UpdateTaxProfileRequest request)
|
|
{
|
|
try
|
|
{
|
|
await taxProfileService.UpdateAsync(id, request.BusinessType, request.AccountingMethod,
|
|
request.NextFilingDueDate, request.TaxRiskLevel);
|
|
return Ok(new { message = "세무 프로필이 수정되었습니다." });
|
|
}
|
|
catch (ValidationException ex)
|
|
{
|
|
return BadRequest(new { error = ex.Message });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "수정 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
public record CreateTaxProfileRequest(
|
|
int ClientId, string BusinessType, string? BusinessRegistration = null,
|
|
string? AccountingMethod = null, DateTime? EstablishmentDate = null);
|
|
|
|
public record UpdateTaxProfileRequest(
|
|
string? BusinessType = null, string? AccountingMethod = null,
|
|
DateTime? NextFilingDueDate = null, string TaxRiskLevel = "normal");
|
|
}
|