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,51 @@
using Application.DTOs.Divisions.Request;
using Application.Utils.Constants.Validation;
using Domain.Enums;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Application.DTOs.Tournament.Request;
/// <summary>
/// One division within a CreateFullTournamentRequest; the TournamentId is implied by nesting.
/// </summary>
public class CreateFullDivisionRequest
{
[Required(ErrorMessage = "The Name field is required.")]
[MaxLength(DivisionFieldLengths.NameMaxLength)]
public required string Name { get; set; }
/// <summary>
/// Marks a cross-division cup that draws teams from every zone.
/// </summary>
public bool IsCrossDivisionCup { get; set; } = false;
[Range(0, int.MaxValue, ErrorMessage = "PointsForWin cannot be negative.")]
public int PointsForWin { get; set; } = 2;
[Range(0, int.MaxValue, ErrorMessage = "PointsForLoss cannot be negative.")]
public int PointsForLoss { get; set; } = 1;
/// <summary>
/// How many teams qualify from each internal group of a multi-group cross-division cup; defaults to 1.
/// </summary>
[Range(1, int.MaxValue, ErrorMessage = "QualifiersPerGroup must be at least 1.")]
public int QualifiersPerGroup { get; set; } = 1;
/// <summary>
/// Competitive category of the division; a mismatch with the parent tournament aborts the whole create.
/// </summary>
public TournamentCategory Category { get; set; } = TournamentCategory.Masculine;
/// <summary>
/// Optional position-range to playoff-destination mappings.
/// </summary>
public List<PlayoffMappingRequest>? PlayoffMappings { get; set; }
/// <summary>
/// The stages, group and cup elimination rounds alike, to create in this division.
/// </summary>
public List<CreateFullStageRequest> Stages { get; set; } = [];
}
@@ -0,0 +1,49 @@
using Application.Utils.Constants.Stage;
using Domain.Enums;
using System;
using System.ComponentModel.DataAnnotations;
namespace Application.DTOs.Tournament.Request;
/// <summary>
/// One stage within a CreateFullDivisionRequest, mirroring CreateStageRequest minus the DivisionId.
/// </summary>
public class CreateFullStageRequest
{
[Required(ErrorMessage = "Stage name field is required.")]
public required string Name { get; set; }
public string? Description { get; set; }
[AllowedValues(StageType.Group, StageType.RoundOf16, StageType.QuarterFinal, StageType.SemiFinal, StageType.ThirdPlace, StageType.Final)]
public required StageType StageType { get; set; } = StageType.Group;
/// <summary>
/// Defaults to true when null.
/// </summary>
public bool? IsActive { get; set; }
/// <summary>
/// Defaults to true for non-Group stage types when null.
/// </summary>
public bool? IsElimination { get; set; }
[Required(ErrorMessage = "Start date field is required.")]
public required DateTime StartDate { get; set; }
[Required(ErrorMessage = "End date field is required.")]
public required DateTime EndDate { get; set; }
/// <summary>
/// Groups parallel elimination brackets under a cup name.
/// </summary>
public string? BracketName { get; set; }
[AllowedValues(1, 3, 5, 7)]
public int BestOf { get; set; } = 1;
[Range(RoundRobinFormat.MinLegs, RoundRobinFormat.MaxLegs)]
public int RoundRobinLegs { get; set; } = RoundRobinFormat.MinLegs;
}
@@ -0,0 +1,42 @@
using Domain.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Application.DTOs.Tournament.Request;
/// <summary>
/// The whole tournament-wizard payload, persisted atomically so a failure leaves no partial tournament behind.
/// </summary>
public class CreateFullTournamentRequest
{
/// <summary>
/// Optional; neither the create wizard nor the edit form require it.
/// </summary>
public string Description { get; set; } = string.Empty;
[Required(ErrorMessage = "Name is required.")]
public required string Name { get; set; }
[Required(ErrorMessage = "Team registration deadline is required.")]
public required DateTime TeamRegistrationDeadline { get; set; }
[Required(ErrorMessage = "Start date is required.")]
public required DateTime StartDate { get; set; }
/// <summary>
/// Competitive category of the tournament; every division below must share this category.
/// </summary>
public TournamentCategory Category { get; set; } = TournamentCategory.Masculine;
/// <summary>
/// Optional id of the season this tournament belongs to; omitting it leaves the tournament ungrouped.
/// </summary>
public Guid? SeasonId { get; set; }
/// <summary>
/// The divisions to create under this tournament, each with its own stages and playoff mappings.
/// </summary>
public List<CreateFullDivisionRequest> Divisions { get; set; } = [];
}
@@ -0,0 +1,38 @@
using Domain.Enums;
using System;
using System.ComponentModel.DataAnnotations;
namespace Application.DTOs.Tournament.Request;
/// <summary>
/// Represents a request to create a new tournament.
/// </summary>
public class CreateTournamentRequest
{
/// <summary>
/// The description of the tournament. Optional.
/// </summary>
public string Description { get; set; } = string.Empty;
[Required(ErrorMessage = "Name is required.")]
public required string Name { get; set; }
/// <summary>
/// The deadline for team registrations; must be earlier than the tournament start date.
/// </summary>
[Required(ErrorMessage = "Team registration deadline is required.")]
public required DateTime TeamRegistrationDeadline { get; set; }
[Required(ErrorMessage = "Start date is required.")]
public required DateTime StartDate { get; set; }
/// <summary>
/// Competitive category of the tournament; feminine and masculine competitions are separate tournaments.
/// </summary>
public TournamentCategory Category { get; set; } = TournamentCategory.Masculine;
/// <summary>
/// Optional id of the season this tournament belongs to; omitting it leaves the tournament ungrouped.
/// </summary>
public Guid? SeasonId { get; set; }
}
@@ -0,0 +1,24 @@
using System;
namespace Application.DTOs.Tournament.Request;
/// <summary>
/// Payload for enrolling a single team into a tournament's registration phase.
/// </summary>
public class EnrollTeamRequest
{
/// <summary>
/// The existing team to enroll; mutually exclusive with NewTeamName.
/// </summary>
public Guid? ExistingTeamId { get; set; }
/// <summary>
/// The name of a brand-new team to create and enroll; mutually exclusive with ExistingTeamId.
/// </summary>
public string? NewTeamName { get; set; }
/// <summary>
/// Optional source season whose roster is copied in; only allowed together with ExistingTeamId.
/// </summary>
public Guid? CopyRosterFromTournamentId { get; set; }
}
@@ -0,0 +1,16 @@
using Application.DTOs.Abstract.Request;
using Domain.Enums;
namespace Application.DTOs.Tournament.Request;
/// <summary>
/// Represents a request to get filtered tournaments.
/// </summary>
public class GetTournamentsFilteredRequest : PaginatedFilterRequest
{
public string? Name { get; set; }
public string? Description { get; set; }
public TournamentStatus? Status { get; set; }
}
@@ -0,0 +1,8 @@
using Domain.Enums;
namespace Application.DTOs.Tournament.Request;
public class UpdateTournamentRequest : CreateTournamentRequest
{
public TournamentStatus? Status { get; set; }
}