8cb6245560
Injects I1099FormService into Form1099ReportController and adds two
Read-gated GET endpoints: recipient/{payeeId}/copy-b (Copy B PDF) and
export-csv (filing-data CSV). Registers Form1099FormService in DI.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using ROLAC.API.Authorization;
|
|
using ROLAC.API.Services;
|
|
|
|
namespace ROLAC.API.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/form1099-report")]
|
|
[HasPermission(Modules.Form1099, PermissionActions.Read)]
|
|
public class Form1099ReportController : ControllerBase
|
|
{
|
|
private readonly IForm1099ReportService _svc;
|
|
private readonly I1099FormService _form;
|
|
public Form1099ReportController(IForm1099ReportService svc, I1099FormService form)
|
|
{
|
|
_svc = svc;
|
|
_form = form;
|
|
}
|
|
|
|
[HttpGet("boxes")]
|
|
public async Task<IActionResult> Boxes() => Ok(await _svc.GetBoxesAsync());
|
|
|
|
[HttpGet("summary")]
|
|
public async Task<IActionResult> Summary([FromQuery] int taxYear)
|
|
=> Ok(await _svc.GetAnnualSummaryAsync(taxYear));
|
|
|
|
[HttpGet("recipient/{payeeId:int}")]
|
|
public async Task<IActionResult> Recipient(int payeeId, [FromQuery] int taxYear)
|
|
=> await _svc.GetRecipientDetailAsync(payeeId, taxYear) is { } d ? Ok(d) : NotFound();
|
|
|
|
[HttpGet("recipient/{payeeId:int}/copy-b")]
|
|
public async Task<IActionResult> CopyB(int payeeId, [FromQuery] int taxYear)
|
|
{
|
|
var (stream, contentType, fileName) = await _form.RenderCopyBAsync(payeeId, taxYear);
|
|
return File(stream, contentType, fileName);
|
|
}
|
|
|
|
[HttpGet("export-csv")]
|
|
public async Task<IActionResult> ExportCsv([FromQuery] int taxYear)
|
|
{
|
|
var (stream, contentType, fileName) = await _form.ExportFilingCsvAsync(taxYear);
|
|
return File(stream, contentType, fileName);
|
|
}
|
|
}
|