Sube carpetas API, API.Tests, Application y Domain del Backend
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Application.Utils.Constants.Validation;
|
||||
|
||||
using Domain.Enums;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to create a division.
|
||||
/// </summary>
|
||||
public class CreateDivisionRequest
|
||||
{
|
||||
[Required(ErrorMessage = "The Name field is required.")]
|
||||
[MaxLength(DivisionFieldLengths.NameMaxLength)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "The TournamentId field is required.")]
|
||||
public required Guid TournamentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Marks this division as a cross-division cup that intentionally draws teams from every division.
|
||||
/// </summary>
|
||||
public bool IsCrossDivisionCup { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Points awarded for a win in this division's standings; defaults to 2.
|
||||
/// </summary>
|
||||
[Range(0, int.MaxValue, ErrorMessage = "PointsForWin cannot be negative.")]
|
||||
public int PointsForWin { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Points awarded for a loss in this division's standings; defaults to 1.
|
||||
/// </summary>
|
||||
[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, which must match the parent tournament's category.
|
||||
/// </summary>
|
||||
public TournamentCategory Category { get; set; } = TournamentCategory.Masculine;
|
||||
|
||||
/// <summary>
|
||||
/// Optional position-range to playoff-destination mapping the wizard sends to seed multiple cups.
|
||||
/// </summary>
|
||||
public List<PlayoffMappingRequest>? PlayoffMappings { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
public class EnrollTeamsRequest
|
||||
{
|
||||
public List<Guid> TeamIds { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Application.DTOs.Abstract.Request;
|
||||
|
||||
using System;
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get filtered divisions.
|
||||
/// </summary>
|
||||
public class GetDivisionsFilteredRequest : PaginatedFilterRequest
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
|
||||
public bool? IsFinished { get; set; }
|
||||
|
||||
public Guid? TournamentId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
/// <summary>
|
||||
/// One position-range to playoff-destination entry the wizard sends for a division; ranges must not overlap.
|
||||
/// </summary>
|
||||
public class PlayoffMappingRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// First standings position in the range, 1-based and inclusive.
|
||||
/// </summary>
|
||||
[Range(1, int.MaxValue, ErrorMessage = "FromPosition must be 1 or greater.")]
|
||||
public required int FromPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last standings position in the range, 1-based and inclusive.
|
||||
/// </summary>
|
||||
[Range(1, int.MaxValue, ErrorMessage = "ToPosition must be 1 or greater.")]
|
||||
public required int ToPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The playoff cup the teams in this range qualify for, matching an elimination stage's BracketName.
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "The Destination field is required.")]
|
||||
public required string Destination { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
public class ReassignTeamToSubGroupRequest
|
||||
{
|
||||
public required Guid TeamId { get; set; }
|
||||
|
||||
public required Guid FromStageId { get; set; }
|
||||
|
||||
public required Guid ToStageId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
public class RebuildSubGroupsRequest
|
||||
{
|
||||
[Range(1, int.MaxValue, ErrorMessage = "SubGroupCount must be at least 1.")]
|
||||
public required int SubGroupCount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
public class UnenrollTeamsRequest
|
||||
{
|
||||
public List<Guid> TeamIds { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Application.Utils.Constants.Validation;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace Application.DTOs.Divisions.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to create a division.
|
||||
/// </summary>
|
||||
public class UpdateDivisionRequest
|
||||
{
|
||||
[Required(ErrorMessage = "The Name field is required.")]
|
||||
[MaxLength(DivisionFieldLengths.NameMaxLength)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required bool IsFinished { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When provided, moves the division and everything under it to this tournament; null keeps it in place.
|
||||
/// </summary>
|
||||
public Guid? TournamentId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Application.DTOs.Abstract.Response;
|
||||
using Application.DTOs.Match.Response;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace Application.DTOs.Divisions.Response;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a response for a division, inheriting from the base response.
|
||||
/// </summary>
|
||||
public class DetailedDivisionResponse : BaseEntityResponse
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required bool IsFinished { get; set; }
|
||||
|
||||
public required IEnumerable<PositionResponse> Positions { get; set; }
|
||||
|
||||
public required Guid TournamentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The matches grouped by week in the division.
|
||||
/// </summary>
|
||||
public required IDictionary<int, IEnumerable<MinimalMatchResponse>> MatchesByWeek { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using Domain.Enums;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace Application.DTOs.Divisions.Response;
|
||||
|
||||
/// <summary>
|
||||
/// The response structure for a division, including its matches and positions.
|
||||
/// </summary>
|
||||
public class DivisionResponse
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The unique, URL-friendly identifier used in public division links.
|
||||
/// </summary>
|
||||
public string Slug { get; set; } = string.Empty;
|
||||
|
||||
public bool IsFinished { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For a multi-group cup this is the pooled union across every group; use GroupStandings for per-group tables.
|
||||
/// </summary>
|
||||
public List<PositionResponse>? Positions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// One standings table per Group stage, null or empty when the division has no Group stage yet.
|
||||
/// </summary>
|
||||
public List<GroupStandingsResponse>? GroupStandings { get; set; }
|
||||
|
||||
public Guid TournamentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The parent tournament's slug, when loaded; null otherwise, for building a clean tournament link.
|
||||
/// </summary>
|
||||
public string? TournamentSlug { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this division is a cross-division cup that intentionally draws teams from every division.
|
||||
/// </summary>
|
||||
public bool IsCrossDivisionCup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Competitive category of the division, always matching the parent tournament's category.
|
||||
/// </summary>
|
||||
public TournamentCategory Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Points awarded for a win in this division's standings.
|
||||
/// </summary>
|
||||
public int PointsForWin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Points awarded for a loss in this division's standings.
|
||||
/// </summary>
|
||||
public int PointsForLoss { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// How many teams qualify from each internal group of a multi-group cup; defaults to 1.
|
||||
/// </summary>
|
||||
public int QualifiersPerGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The division's position-range to playoff-destination mapping.
|
||||
/// </summary>
|
||||
public List<PlayoffMappingResponse>? PlayoffMappings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The standings-position ranges that qualify to a playoff cup, ordered top-down; empty when none exist.
|
||||
/// </summary>
|
||||
public List<QualificationRangeResponse>? QualificationRanges { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Application.DTOs.Divisions.Response;
|
||||
|
||||
/// <summary>
|
||||
/// The standings of a single Group stage; a multi-group division sends one entry per internal group.
|
||||
/// </summary>
|
||||
public class GroupStandingsResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The id of the Group stage these standings belong to.
|
||||
/// </summary>
|
||||
public Guid StageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Group stage's name, used as the table label.
|
||||
/// </summary>
|
||||
public string StageName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The ordered standings for the teams in this group.
|
||||
/// </summary>
|
||||
public List<PositionResponse> Positions { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Application.DTOs.Abstract.Response;
|
||||
namespace Application.DTOs.Divisions.Response;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a minimal response for a tournament.
|
||||
/// </summary>
|
||||
public class MinimalDivisionResponse : BaseEntityResponse
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required bool IsFinished { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.Divisions.Response;
|
||||
|
||||
/// <summary>
|
||||
/// One position-range to playoff-destination entry of a division.
|
||||
/// </summary>
|
||||
public class PlayoffMappingResponse
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int FromPosition { get; set; }
|
||||
public int ToPosition { get; set; }
|
||||
public string Destination { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
using Application.DTOs.PointDeductions.Response;
|
||||
|
||||
namespace Application.DTOs.Divisions.Response;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents the position of a team in a division, including various match statistics.
|
||||
/// </summary>
|
||||
public class PositionResponse
|
||||
{
|
||||
public required Guid TeamId { get; set; }
|
||||
|
||||
public required string TeamName { get; set; }
|
||||
|
||||
public required string LogoUrl { get; set; }
|
||||
|
||||
public required int MatchesPlayed { get; set; }
|
||||
|
||||
public required int Wins { get; set; }
|
||||
|
||||
public required int Losses { get; set; }
|
||||
|
||||
public required int PointsFor { get; set; }
|
||||
|
||||
public required int PointsAgainst { get; set; }
|
||||
|
||||
public required int PointsDifference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total points accumulated by the team, with any disciplinary deduction already subtracted.
|
||||
/// </summary>
|
||||
public required int Points { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The disciplinary point deduction applied to this team, or null when there is none.
|
||||
/// </summary>
|
||||
public AppliedPointDeductionResponse? PointDeduction { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Application.DTOs.Divisions.Response;
|
||||
|
||||
/// <summary>
|
||||
/// One standings-position range that qualifies to a playoff cup, derived from the division's mapping set.
|
||||
/// </summary>
|
||||
public class QualificationRangeResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// First standings position in the range, 1-based and inclusive.
|
||||
/// </summary>
|
||||
public int FromPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last standings position in the range, 1-based and inclusive.
|
||||
/// </summary>
|
||||
public int ToPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The cup the teams in this range qualify for.
|
||||
/// </summary>
|
||||
public string CupName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The cup's rank, top-down, where 0 is the top cup; drives the color the frontend paints each range.
|
||||
/// </summary>
|
||||
public int Order { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user