59f1509368
TaxBaik CI/CD / build-and-deploy (push) Successful in 50s
Phase 4 Complete: 4 remaining API Controllers
- TaxFilingScheduleController: schedule CRUD + upcoming dues + completion marking
- ConsultingActivityController: activity logging + pending followups + consultant tracking
- ContractController: contract lifecycle + active/expiring tracking + MRR endpoint
- RevenueTrackingController: invoice/payment tracking + pending payments + monthly/total revenue
All controllers follow RESTful patterns with:
- [Authorize] attribute for access control
- Proper error handling with ValidationException catching
- Record-based request/response DTOs
- Consistent HTTP status codes (201, 400, 404, 500)
Build Status: ✅ Success (0 errors, 3 warnings)
103 lines
3.0 KiB
C#
103 lines
3.0 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 TaxFilingScheduleController(TaxFilingScheduleService service) : ControllerBase
|
|
{
|
|
[HttpPost]
|
|
public async Task<IActionResult> Create([FromBody] CreateTaxFilingScheduleRequest request)
|
|
{
|
|
try
|
|
{
|
|
var id = await service.CreateAsync(request.ClientId, request.FilingType, request.DueDate,
|
|
request.FilingYear, request.AssignedTo);
|
|
return CreatedAtAction(nameof(GetById), new { id }, new { id });
|
|
}
|
|
catch (ValidationException ex)
|
|
{
|
|
return BadRequest(new { error = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("{id:int}")]
|
|
public async Task<IActionResult> GetById(int id)
|
|
{
|
|
try
|
|
{
|
|
var schedule = await service.GetByIdAsync(id);
|
|
if (schedule == null)
|
|
return NotFound(new { error = "신고 일정을 찾을 수 없습니다." });
|
|
return Ok(schedule);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("client/{clientId:int}")]
|
|
public async Task<IActionResult> GetByClientId(int clientId)
|
|
{
|
|
try
|
|
{
|
|
var schedules = await service.GetByClientIdAsync(clientId);
|
|
return Ok(new { data = schedules });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("upcoming")]
|
|
public async Task<IActionResult> GetUpcomingDues([FromQuery] int daysAhead = 30)
|
|
{
|
|
try
|
|
{
|
|
var schedules = await service.GetUpcomingDuesAsync(daysAhead);
|
|
return Ok(new { data = schedules, daysAhead });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("pending-count")]
|
|
public async Task<IActionResult> GetPendingCount()
|
|
{
|
|
try
|
|
{
|
|
var count = await service.GetPendingCountAsync();
|
|
return Ok(new { count });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpPut("{id:int}/complete")]
|
|
public async Task<IActionResult> MarkCompleted(int id)
|
|
{
|
|
try
|
|
{
|
|
await service.MarkCompletedAsync(id);
|
|
return Ok(new { message = "신고 일정이 완료되었습니다." });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "수정 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
public record CreateTaxFilingScheduleRequest(
|
|
int ClientId, string FilingType, DateTime DueDate, int FilingYear,
|
|
int? AssignedTo = null);
|
|
}
|