using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SPiluSZharuContracts.AdapterContracts; namespace SPiluSZharuWebApi.Controllers; [Authorize] [Route("api/[controller]/[action]")] [ApiController] [Produces("application/json")] public class SalaryController(ISalaryAdapter adapter) : ControllerBase { private readonly ISalaryAdapter _adapter = adapter; [HttpGet] public IActionResult GetRecords(DateTime fromDate, DateTime toDate) { return _adapter.GetAllSalariesByPeriod(fromDate, toDate).GetResponse(Request, Response); } [HttpGet] public IActionResult GetRecordsByWorker(DateTime fromDate, DateTime toDate, string workerId) { return _adapter.GetAllSalariesByPeriodByWorker(fromDate, toDate, workerId).GetResponse(Request, Response); } [HttpPost] public IActionResult Calculate(DateTime date) { return _adapter.CalculateSalaryByMounth(date).GetResponse(Request, Response); } }