Update gestione ceck esistenza tipo report (da subfolder)

This commit is contained in:
Samuele Locatelli
2026-04-09 12:18:23 +02:00
parent f3bfe84fe3
commit 52f1bd94ef
17 changed files with 82 additions and 93 deletions
+27 -2
View File
@@ -1,4 +1,5 @@
using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.Services.Catalog;
using EgwCoreLib.Lux.Data.Services.Sales;
namespace Lux.API.Controllers
@@ -13,10 +14,14 @@ namespace Lux.API.Controllers
/// Costruttore metodo
/// </summary>
/// <param name="offService"></param>
public ReportController(IOfferService offService, IOrderService ordService)
public ReportController(
IOfferService offService,
IOrderService ordService,
ITemplateService tplService)
{
_offService = offService;
_ordService = ordService;
_tplService = tplService;
// Configurazione serializzatore JSON per risolvere errore di loop circolare
JSSettings = new JsonSerializerSettings()
{
@@ -40,7 +45,7 @@ namespace Lux.API.Controllers
Stopwatch sw = new Stopwatch();
sw.Start();
// recupera dal DB l'offerta con le righe relative
OfferModel? offData = await _offService.GetByIdAsync(id);
var offData = await _offService.GetByIdAsync(id);
sw.Stop();
Log.Info($"Offert | {id} | {sw.Elapsed.TotalMilliseconds:N3} ms");
@@ -65,6 +70,25 @@ namespace Lux.API.Controllers
return Ok(ordData);
}
/// <summary>
/// Chiamata GET: riceve TemplateID, restituisce Json Template (catalogo) + righe
/// GET: api/report/offert/1
/// </summary>
/// <param name="id">id univoco</param>
/// <returns></returns>
[HttpGet("template/{id}")]
public async Task<IActionResult> Template(int id)
{
Stopwatch sw = new Stopwatch();
sw.Start();
// recupera dal DB l'offerta con le righe relative
var ordData = await _tplService.GetByIdAsync(id);
sw.Stop();
Log.Info($"Template | {id} | {sw.Elapsed.TotalMilliseconds:N3} ms");
return Ok(ordData);
}
/// <summary>
/// Chiamata GET: riceve ELENCO Offerte dato periodo
/// GET: api/report/offert-list/?from=2026-01-01&to=2026-04-01
@@ -104,6 +128,7 @@ namespace Lux.API.Controllers
private static Logger Log = LogManager.GetCurrentClassLogger();
private IOfferService _offService;
private IOrderService _ordService;
private ITemplateService _tplService;
private JsonSerializerSettings JSSettings;
#endregion Private Fields