-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related work items: #513
- Loading branch information
Showing
20 changed files
with
290 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...Fatture.BE.Infrastructure/Common/pagoPA/AnagraficaPSP/Queries/PSPsQuartersRequestQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using MediatR; | ||
using PortaleFatture.BE.Core.Auth; | ||
|
||
namespace PortaleFatture.BE.Infrastructure.Common.pagoPA.AnagraficaPSP.Queries; | ||
|
||
public class PSPsQuartersRequestQuery(IAuthenticationInfo authenticationInfo) : IRequest<IEnumerable<string>> | ||
{ | ||
public IAuthenticationInfo AuthenticationInfo { get; internal set; } = authenticationInfo; | ||
public string? Year { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...re/Common/pagoPA/AnagraficaPSP/Queries/Persistence/PSPsQuartersRequestQueryPersistence.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Data; | ||
using System.Dynamic; | ||
using PortaleFatture.BE.Infrastructure.Common.pagoPA.AnagraficaPSP.Queries.Persistence.Builder; | ||
using PortaleFatture.BE.Infrastructure.Common.Persistence; | ||
|
||
namespace PortaleFatture.BE.Infrastructure.Common.pagoPA.AnagraficaPSP.Queries.Persistence; | ||
|
||
public sealed class PSPsQuartersRequestQueryPersistence(PSPsQuartersRequestQuery command) : DapperBase, IQuery<IEnumerable<string>> | ||
{ | ||
private readonly PSPsQuartersRequestQuery _command = command; | ||
|
||
|
||
private static readonly string _sql = PSPSQLBuilder.SelectQuarters(); | ||
private static readonly string _orderBy = PSPSQLBuilder.OrderByQuarters(); | ||
public async Task<IEnumerable<string>> Execute(IDbConnection? connection, string schema, IDbTransaction? transaction, CancellationToken cancellationToken = default) | ||
{ | ||
var where = string.Empty; | ||
dynamic parameters = new ExpandoObject(); | ||
|
||
if (!string.IsNullOrEmpty(_command.Year)) | ||
{ | ||
where = " WHERE year_quarter like '%' + @year + '%'"; | ||
parameters.Year = _command.Year; | ||
} | ||
|
||
var orderBy = _orderBy; | ||
var sql = _sql + where + orderBy; | ||
|
||
|
||
return await ((IDatabase)this).SelectAsync<string>( | ||
connection!, | ||
sql, | ||
parameters, | ||
transaction); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...frastructure/Common/pagoPA/AnagraficaPSP/QueryHandlers/PSPsQuartersRequestQueryHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using MediatR; | ||
using Microsoft.Extensions.Localization; | ||
using Microsoft.Extensions.Logging; | ||
using PortaleFatture.BE.Core.Resources; | ||
using PortaleFatture.BE.Infrastructure.Common.pagoPA.AnagraficaPSP.Queries; | ||
using PortaleFatture.BE.Infrastructure.Common.pagoPA.AnagraficaPSP.Queries.Persistence; | ||
using PortaleFatture.BE.Infrastructure.Common.Persistence.Schemas; | ||
|
||
namespace PortaleFatture.BE.Infrastructure.Common.pagoPA.AnagraficaPSP.QueryHandlers; | ||
|
||
public sealed class PSPsQuartersRequestQueryHandler : IRequestHandler<PSPsQuartersRequestQuery, IEnumerable<string>> | ||
{ | ||
private readonly IFattureDbContextFactory _factory; | ||
private readonly ILogger<PSPsQuartersRequestQueryHandler> _logger; | ||
private readonly IStringLocalizer<Localization> _localizer; | ||
|
||
public PSPsQuartersRequestQueryHandler( | ||
IFattureDbContextFactory factory, | ||
IStringLocalizer<Localization> localizer, | ||
ILogger<PSPsQuartersRequestQueryHandler> logger) | ||
{ | ||
_factory = factory; | ||
_localizer = localizer; | ||
_logger = logger; | ||
} | ||
|
||
public async Task<IEnumerable<string>> Handle(PSPsQuartersRequestQuery command, CancellationToken ct) | ||
{ | ||
using var uow = await _factory.Create(cancellationToken: ct); | ||
return await uow.Query(new PSPsQuartersRequestQueryPersistence(command), ct); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.