Replace MSAL and custom cookie auth with Microsoft.Identity.EntityFramework Also some UI redesign to accommodate different login experience.
25 lines
757 B
C#
25 lines
757 B
C#
using Dapper;
|
|
using Shogi.Api.Repositories.Dto;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace Shogi.Api.Repositories;
|
|
|
|
public class QueryRepository(IConfiguration configuration)
|
|
{
|
|
private readonly string connectionString = configuration.GetConnectionString("ShogiDatabase")
|
|
?? throw new InvalidOperationException("No database configured for QueryRepository.");
|
|
|
|
public async Task<IEnumerable<SessionDto>> ReadSessionsMetadata(string playerId)
|
|
{
|
|
using var connection = new SqlConnection(this.connectionString);
|
|
|
|
var results = await connection.QueryMultipleAsync(
|
|
"session.ReadSessionsMetadata",
|
|
new { PlayerId = playerId },
|
|
commandType: CommandType.StoredProcedure);
|
|
|
|
return await results.ReadAsync<SessionDto>();
|
|
}
|
|
}
|