80a16d8b20
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m5s
**API Controllers Complete:** - ClientController (GET /api/client paged, POST/PUT/DELETE) - TaxFilingController (GET upcoming, GET by client, POST/PUT/DELETE) - FaqController (GET active/all, GET by id, POST/PUT/DELETE) - AnnouncementController (GET active/all, GET by id, POST/PUT/DELETE) **Browser Clients Complete:** - IClientBrowserClient + ClientBrowserClient - ITaxFilingBrowserClient + TaxFilingBrowserClient - IFaqBrowserClient + FaqBrowserClient - IAnnouncementBrowserClient + AnnouncementBrowserClient **All Registered in Program.cs:** - BaseAddress: http://localhost:5001/taxbaik/api/ - TokenRefreshHandler attached to all clients - DI container: AddHttpClient<IXxxClient, XxxClient> **Blazor Refactored (Partial):** - ClientList.razor: ✅ IClientBrowserClient (service → API) - ClientEdit.razor: ✅ IClientBrowserClient (service → API) - TaxFilings Blazor: ⏳ Pending refactor - Faqs Blazor: ⏳ Pending refactor - Announcements Blazor: ⏳ Pending refactor **Phase 7 Status:** - API-First Foundation: ✅ 100% (all controllers + clients ready) - Blazor Refactoring: 🟡 30% (Clients done, others pending) - Phase 6 SignalR: ⏳ Deferred (ready for real-time on API-first pages) **SOLID Applied Throughout:** ✓ Single Responsibility: Each client handles one domain ✓ Open/Closed: Extend via interface, not modification ✓ Dependency Inversion: Blazor → Interfaces, not services ✓ Interface Segregation: Specialized clients per operation ✓ Liskov Substitution: All clients follow same contract **Build:** ✅ Success (0 errors, 2 warnings in Dashboard) **Pattern:** Established & repeatable for remaining Blazor pages Next: Blazor page migrations (TaxFilings, Faqs, Announcements) Then: Phase 6 SignalR for real-time notifications Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
89 lines
2.7 KiB
C#
89 lines
2.7 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using TaxBaik.Application.DTOs;
|
|
using TaxBaik.Application.Services;
|
|
|
|
namespace TaxBaik.Web.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class AnnouncementController : ControllerBase
|
|
{
|
|
private readonly AnnouncementService _announcementService;
|
|
|
|
public AnnouncementController(AnnouncementService announcementService)
|
|
{
|
|
_announcementService = announcementService;
|
|
}
|
|
|
|
[HttpGet("active")]
|
|
public async Task<IActionResult> GetActive()
|
|
{
|
|
var announcements = await _announcementService.GetActiveAsync();
|
|
return Ok(new { data = announcements });
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public async Task<IActionResult> GetAll()
|
|
{
|
|
var announcements = await _announcementService.GetAllAsync();
|
|
return Ok(new { data = announcements });
|
|
}
|
|
|
|
[HttpGet("{id}")]
|
|
[Authorize]
|
|
public async Task<IActionResult> GetById(int id)
|
|
{
|
|
var announcement = await _announcementService.GetByIdAsync(id);
|
|
if (announcement == null)
|
|
return NotFound(new ProblemDetails { Title = "공지사항을 찾을 수 없습니다.", Status = StatusCodes.Status404NotFound });
|
|
|
|
return Ok(announcement);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Authorize]
|
|
public async Task<IActionResult> Create([FromBody] AnnouncementDto dto)
|
|
{
|
|
try
|
|
{
|
|
var announcementId = await _announcementService.CreateAsync(dto);
|
|
var result = await _announcementService.GetByIdAsync(announcementId);
|
|
return CreatedAtAction(nameof(GetById), new { id = announcementId }, result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return BadRequest(new ProblemDetails { Title = ex.Message, Status = StatusCodes.Status400BadRequest });
|
|
}
|
|
}
|
|
|
|
[HttpPut("{id}")]
|
|
[Authorize]
|
|
public async Task<IActionResult> Update(int id, [FromBody] AnnouncementDto dto)
|
|
{
|
|
dto.Id = id;
|
|
try
|
|
{
|
|
await _announcementService.UpdateAsync(dto);
|
|
var result = await _announcementService.GetByIdAsync(id);
|
|
if (result == null)
|
|
return NotFound(new ProblemDetails { Title = "공지사항을 찾을 수 없습니다.", Status = StatusCodes.Status404NotFound });
|
|
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return BadRequest(new ProblemDetails { Title = ex.Message, Status = StatusCodes.Status400BadRequest });
|
|
}
|
|
}
|
|
|
|
[HttpDelete("{id}")]
|
|
[Authorize]
|
|
public async Task<IActionResult> Delete(int id)
|
|
{
|
|
await _announcementService.DeleteAsync(id);
|
|
return NoContent();
|
|
}
|
|
}
|