This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LaDOSE.DTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Every recorded meeting between two players, broken down per game.
|
||||
/// Sets belonging to a bracket with no game attached are not in <see cref="Games"/>
|
||||
/// nor in the totals — they are only counted in <see cref="UnknownGameSets"/>.
|
||||
/// </summary>
|
||||
public class PlayerVersusDTO
|
||||
{
|
||||
public int PlayerAId { get; set; }
|
||||
|
||||
/// <summary>Gamertag, falling back to Name, else "#<id>".</summary>
|
||||
public string PlayerA { get; set; }
|
||||
|
||||
public int PlayerBId { get; set; }
|
||||
|
||||
public string PlayerB { get; set; }
|
||||
|
||||
/// <summary>Meetings in a bracket whose game is known — the sum of the rows in <see cref="Games"/>.</summary>
|
||||
public int Sets { get; set; }
|
||||
|
||||
/// <summary>Of those, the ones with a determinable winner.</summary>
|
||||
public int DecidedSets { get; set; }
|
||||
|
||||
public int WinsA { get; set; }
|
||||
public int WinsB { get; set; }
|
||||
|
||||
/// <summary>Meetings dropped because the bracket has no game attached.</summary>
|
||||
public int UnknownGameSets { get; set; }
|
||||
|
||||
/// <summary>One row per game they met in, most-played first.</summary>
|
||||
public List<VersusGameStatsDTO> Games { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>One game's slice of a <see cref="PlayerVersusDTO"/>.</summary>
|
||||
public class VersusGameStatsDTO
|
||||
{
|
||||
public int GameId { get; set; }
|
||||
|
||||
/// <summary>Game name, or "#<id>" when the game row is gone.</summary>
|
||||
public string Game { get; set; }
|
||||
|
||||
public string GameLongName { get; set; }
|
||||
|
||||
/// <summary>Meetings in this game, decided or not.</summary>
|
||||
public int Sets { get; set; }
|
||||
|
||||
/// <summary>Meetings with a determinable winner. Always equals WinsA + WinsB.</summary>
|
||||
public int DecidedSets { get; set; }
|
||||
|
||||
public int WinsA { get; set; }
|
||||
public int WinsB { get; set; }
|
||||
|
||||
/// <summary>Individual games won inside the decided sets.</summary>
|
||||
public int GamesWonA { get; set; }
|
||||
|
||||
public int GamesWonB { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A player who can be picked for a versus lookup: one with at least one set in a
|
||||
/// bracket whose game is known.
|
||||
/// </summary>
|
||||
public class PlayerOptionDTO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>Gamertag, falling back to Name, else "#<id>".</summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>Sets in a bracket with a known game, whoever the opponent was.</summary>
|
||||
public int Sets { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LaDOSE.DTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Body of POST /api/Sheets/Export. The target spreadsheet is deliberately absent: it comes
|
||||
/// from server configuration only, so a caller cannot redirect the export.
|
||||
/// </summary>
|
||||
public class SheetExportRequestDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// One tab per selected event, oldest first. Tab N holds events 1..N merged, so the last
|
||||
/// tab is the full cumulative ranking for the selection.
|
||||
/// </summary>
|
||||
public List<SheetTableDTO> Tabs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>One tab: a players x games grid with a Total column, as built by buildRanking().</summary>
|
||||
public class SheetTableDTO
|
||||
{
|
||||
/// <summary>Desired tab title, e.g. "Ranking #1301". Sanitised server-side.</summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>Provenance and logging only; tabs are addressed by title.</summary>
|
||||
public int EventId { get; set; }
|
||||
|
||||
/// <summary>["Players", <game names...>, "Total"].</summary>
|
||||
public List<string> Header { get; set; }
|
||||
|
||||
public List<SheetRowDTO> Rows { get; set; }
|
||||
|
||||
/// <summary>Provenance lines written below the grid.</summary>
|
||||
public List<string> Footer { get; set; }
|
||||
}
|
||||
|
||||
public class SheetRowDTO
|
||||
{
|
||||
public string Player { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Index-aligned with Header[1..^1]. Typed int, not string, so the values land in the
|
||||
/// sheet as numbers and existing formulas and conditional formatting keep working.
|
||||
/// </summary>
|
||||
public List<int> Points { get; set; }
|
||||
|
||||
public int Total { get; set; }
|
||||
}
|
||||
|
||||
public class SheetExportResultDTO
|
||||
{
|
||||
public string SpreadsheetId { get; set; }
|
||||
public string SpreadsheetUrl { get; set; }
|
||||
public string Writer { get; set; }
|
||||
public List<SheetTabResultDTO> Tabs { get; set; }
|
||||
public List<string> Warnings { get; set; }
|
||||
}
|
||||
|
||||
public class SheetTabResultDTO
|
||||
{
|
||||
public string RequestedName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Rows { get; set; }
|
||||
public int Columns { get; set; }
|
||||
public bool Created { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Response of GET /api/Sheets/Config. Never carries the credentials path or any secret —
|
||||
/// only what the export panel needs to render itself.
|
||||
/// </summary>
|
||||
public class SheetsConfigDTO
|
||||
{
|
||||
/// <summary>"ServiceAccount" | "Logging" | "Disabled".</summary>
|
||||
public string Writer { get; set; }
|
||||
|
||||
public bool Configured { get; set; }
|
||||
public string SpreadsheetId { get; set; }
|
||||
public int MaxTabs { get; set; }
|
||||
public int MaxRowsPerTab { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user