Sube carpetas API, API.Tests, Application y Domain del Backend

This commit is contained in:
FrancoRu
2026-09-18 13:35:59 -03:00
parent bbb09554bb
commit 2eb4eeef03
572 changed files with 56405 additions and 0 deletions
@@ -0,0 +1,37 @@
namespace Application.DTOs.Tournament.Response;
/// <summary>
/// One completability violation, with every field except Code optional and populated only where relevant.
/// </summary>
public class CompletabilityIssue
{
/// <summary>
/// The violated rule's stable code, one of the constants in CompletabilityIssueCodes.
/// </summary>
public required string Code { get; set; }
/// <summary>
/// The offending division or zone name, when the rule is about a division.
/// </summary>
public string? DivisionName { get; set; }
/// <summary>
/// The offending team name, when the rule is about a team.
/// </summary>
public string? TeamName { get; set; }
/// <summary>
/// The playoff range's first position, for PlayoffRangeExceedsTeams.
/// </summary>
public int? FromPosition { get; set; }
/// <summary>
/// The number of teams assigned to the offending division or group, for the count-based rules.
/// </summary>
public int? AssignedTeams { get; set; }
/// <summary>
/// The offending team's habilitado player count, not its raw roster size, for TeamTooFewPlayers.
/// </summary>
public int? PlayerCount { get; set; }
}
@@ -0,0 +1,42 @@
namespace Application.DTOs.Tournament.Response;
/// <summary>
/// The stable, English and neutral codes for every completability violation, localized by the frontend.
/// </summary>
public static class CompletabilityIssueCodes
{
/// <summary>
/// A regular zone has fewer than the required assigned teams.
/// </summary>
public const string ZoneTooFewTeams = nameof(ZoneTooFewTeams);
/// <summary>
/// An enrolled team is not assigned to any regular zone.
/// </summary>
public const string TeamNotAssigned = nameof(TeamNotAssigned);
/// <summary>
/// A team is assigned to more than one regular zone.
/// </summary>
public const string TeamInMultipleZones = nameof(TeamInMultipleZones);
/// <summary>
/// A playoff range starts beyond the zone's assigned team count.
/// </summary>
public const string PlayoffRangeExceedsTeams = nameof(PlayoffRangeExceedsTeams);
/// <summary>
/// A cross-division-cup group has fewer than the required assigned teams.
/// </summary>
public const string CrossCupGroupTooFewTeams = nameof(CrossCupGroupTooFewTeams);
/// <summary>
/// An enrolled team has fewer than the required registered players.
/// </summary>
public const string TeamTooFewPlayers = nameof(TeamTooFewPlayers);
/// <summary>
/// A regular division's sub-groups have a group below the minimum size or an imbalance across groups.
/// </summary>
public const string SubGroupTooFewTeams = nameof(SubGroupTooFewTeams);
}
@@ -0,0 +1,19 @@
using System.Collections.Generic;
namespace Application.DTOs.Tournament.Response;
/// <summary>
/// The completability report for a tournament: whether it can be started, and the blocking issues if not.
/// </summary>
public class TournamentCompletabilityResponse
{
/// <summary>
/// True when the tournament has no completability issues and may be started.
/// </summary>
public bool CanStart { get; set; }
/// <summary>
/// Every completability violation found; empty when CanStart is true.
/// </summary>
public List<CompletabilityIssue> Issues { get; set; } = [];
}
@@ -0,0 +1,54 @@
using Application.DTOs.Abstract.Response;
using Application.DTOs.Divisions.Response;
using Domain.Enums;
using System;
using System.Collections.Generic;
namespace Application.DTOs.Tournament.Response;
/// <summary>
/// Represents the response containing details of a tournament.
/// </summary>
public class TournamentResponse : BaseEntityResponse
{
public required string Description { get; set; }
public required string Name { get; set; }
/// <summary>
/// The unique, URL-friendly identifier used in public tournament links.
/// </summary>
public required string Slug { get; set; }
public required IEnumerable<MinimalDivisionResponse> Divisions { get; set; }
/// <summary>
/// The deadline for team registrations; must be earlier than the tournament start date.
/// </summary>
public required DateTime TeamRegistrationDeadline { get; set; }
public required DateTime StartDate { get; set; }
public TournamentStatus Status { get; set; }
/// <summary>
/// Competitive category of the tournament; the feminine competition is played as its own tournament.
/// </summary>
public TournamentCategory Category { get; set; }
/// <summary>
/// Id of the season this tournament belongs to, or null when not grouped under any season.
/// </summary>
public Guid? SeasonId { get; set; }
/// <summary>
/// Name of the season this tournament belongs to, when loaded; null otherwise.
/// </summary>
public string? SeasonName { get; set; }
/// <summary>
/// Slug of the season this tournament belongs to, when loaded, for building a clean season link.
/// </summary>
public string? SeasonSlug { get; set; }
}
@@ -0,0 +1,78 @@
using Application.DTOs.Divisions.Response;
using Domain.Enums;
using System.Collections.Generic;
namespace Application.DTOs.Tournament.Response;
/// <summary>
/// A source tournament's pure structure tree (divisions, their stages and
/// playoff mappings) for the tournament-cloning wizard-prefill flow (HU-cloning).
/// Carries STRUCTURE ONLY — no rosters, matches, standings, sanctions, audit
/// logs, or DrawnAt timestamps — so it can never leak instance data into a
/// clone. Additive: never replaces TournamentResponse/DivisionResponse, which
/// stay unchanged for their existing unrelated pages.
/// </summary>
public class TournamentStructureResponse
{
public required string Name { get; set; }
public string? Description { get; set; }
/// <summary>
/// The source tournament's category, shown for reference only — the clone
/// action always requires the organizer to choose the new category
/// explicitly, never inheriting this value silently.
/// </summary>
public required TournamentCategory Category { get; set; }
public required List<DivisionStructureResponse> Divisions { get; set; }
}
/// <summary>
/// One division's cloneable structure: its scoring/cup configuration, playoff
/// mappings, and full Stage list — everything the reverse-mapper needs to
/// reconstruct a `ZoneConfig` or `CrossCupConfig` (D1), and nothing else.
/// </summary>
public class DivisionStructureResponse
{
public required string Name { get; set; }
public bool IsCrossDivisionCup { get; set; }
public int PointsForWin { get; set; }
public int PointsForLoss { get; set; }
public int QualifiersPerGroup { get; set; }
public List<PlayoffMappingResponse> PlayoffMappings { get; set; } = [];
public required List<StageStructureResponse> Stages { get; set; }
}
/// <summary>
/// One stage's cloneable shape: its type, ordering, and bracket/series
/// configuration. Carries no dates, no DrawnAt, and no match data.
/// </summary>
public class StageStructureResponse
{
public required string Name { get; set; }
/// <summary>
/// Groups parallel elimination brackets under a cup name; null for a
/// division's default/group stage.
/// </summary>
public string? BracketName { get; set; }
public required StageType StageType { get; set; }
public bool IsElimination { get; set; }
public int Order { get; set; }
public int BestOf { get; set; }
public int RoundRobinLegs { get; set; }
}