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,49 @@
using Microsoft.AspNetCore.Http;
using System;
using System.ComponentModel.DataAnnotations;
namespace Application.DTOs.Team.Request;
/// <summary>
/// Represents a request to create a team.
/// </summary>
public class CreateTeamRequest
{
[Required(ErrorMessage = "The Name field is required.")]
public required string Name { get; init; }
[Required(ErrorMessage = "The Three-letter code field is required.")]
[MaxLength(3)]
public required string ThreeLetterCode { get; init; }
[Required(ErrorMessage = "The ShirtColor field is required")]
public required string ShirtColor { get; set; }
/// <summary>
/// The jersey kit pattern applied over the primary shirt color; defaults to "solid" when not supplied.
/// </summary>
[MaxLength(20)]
public string JerseyStyle { get; set; } = "solid";
/// <summary>
/// Optional secondary #rrggbb hex color used for the jersey pattern or trim.
/// </summary>
[MaxLength(9)]
public string? ShirtSecondaryColor { get; set; }
/// <summary>
/// Optional third #rrggbb hex color, used only by tri-color kit templates as a second accent.
/// </summary>
[MaxLength(9)]
public string? ShirtTertiaryColor { get; set; }
/// <summary>
/// The logo image file to upload, which must be JPEG or PNG.
/// </summary>
[Required(ErrorMessage = "The Logo image is required.")]
[DataType(DataType.Upload)]
public required IFormFile LogoFile { get; init; }
public Guid? TournamentId { get; init; }
}
@@ -0,0 +1,20 @@
using Application.DTOs.Abstract.Request;
using System;
namespace Application.DTOs.Team.Request;
/// <summary>
/// Represents a request to get filtered teams.
/// </summary>
public class GetTeamsFilteredRequest : PaginatedFilterRequest
{
public string? Name { get; set; }
public string? ThreeLetterCode { get; set; }
public string? ShirtColor { get; set; }
public Guid? StageId { get; set; }
public Guid? TournamentId { get; set; }
}
@@ -0,0 +1,21 @@
using Microsoft.AspNetCore.Http;
using System;
using System.ComponentModel.DataAnnotations;
namespace Application.DTOs.Team.Request;
/// <summary>
/// Represents a request to update a team's logo.
/// </summary>
public class UpdateTeamLogoRequest
{
[Required(ErrorMessage = "The TeamId field is required.")]
public required Guid TeamId { get; init; }
/// <summary>
/// The logo image file to upload, which must be JPEG or PNG.
/// </summary>
[Required(ErrorMessage = "The Logo image is required.")]
[DataType(DataType.Upload)]
public required IFormFile LogoFile { get; init; }
}
@@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
namespace Application.DTOs.Team.Request;
/// <summary>
/// Represents a request to update a team's details.
/// </summary>
public class UpdateTeamRequest
{
public string? Name { get; init; }
[MaxLength(3)]
public string? ThreeLetterCode { get; init; }
public string? ShirtColor { get; set; }
/// <summary>
/// The jersey kit pattern applied over the primary shirt color; left unchanged when not supplied.
/// </summary>
[MaxLength(20)]
public string? JerseyStyle { get; set; }
/// <summary>
/// Optional secondary #rrggbb hex color used for the jersey pattern or trim.
/// </summary>
[MaxLength(9)]
public string? ShirtSecondaryColor { get; set; }
/// <summary>
/// Optional third #rrggbb hex color, used only by tri-color kit templates as a second accent.
/// </summary>
[MaxLength(9)]
public string? ShirtTertiaryColor { get; set; }
}
@@ -0,0 +1,45 @@
using Application.DTOs.Player.Response;
using Application.DTOs.Scorer.Response;
using System;
using System.Collections.Generic;
namespace Application.DTOs.Team.Response;
/// <summary>
/// Represents the response data for a team in a match.
/// </summary>
public class TeamDetailedMatchResponse
{
public required Guid Id { get; set; }
public required string Name { get; set; }
public required string LogoUrl { get; set; }
/// <summary>
/// Primary shirt color as #rrggbb, for rendering the kit.
/// </summary>
public string? ShirtColor { get; set; }
/// <summary>
/// Jersey kit pattern.
/// </summary>
public string? JerseyStyle { get; set; }
/// <summary>
/// Secondary shirt color as #rrggbb, for the kit trim or pattern.
/// </summary>
public string? ShirtSecondaryColor { get; set; }
/// <summary>
/// Third shirt color as #rrggbb, used only by tri-color kit templates.
/// </summary>
public string? ShirtTertiaryColor { get; set; }
public int Score { get; set; }
public List<ScorerByPlayerResponse> Scorers { get; set; } = [];
public List<PublicPlayerResponse> Players { get; set; } = [];
}
@@ -0,0 +1,69 @@
using System;
namespace Application.DTOs.Team.Response;
/// <summary>
/// A single match projected from a team's point of view, with scores and result oriented relative to the team.
/// </summary>
public class TeamMatchResponse
{
/// <summary>
/// The id of the match.
/// </summary>
public required Guid MatchId { get; set; }
/// <summary>
/// The scheduled or played calendar date of the match.
/// </summary>
public DateTime? MatchDate { get; set; }
/// <summary>
/// Whether the match has finished, meaning a decisive result exists.
/// </summary>
public required bool IsFinished { get; set; }
/// <summary>
/// The match lifecycle status name: Scheduled, Played, Suspended, or WalkOver.
/// </summary>
public required string Status { get; set; }
/// <summary>
/// True when the team played this match at home.
/// </summary>
public required bool IsHome { get; set; }
/// <summary>
/// The opponent team's id; Guid.Empty when the opponent slot is unassigned.
/// </summary>
public required Guid OpponentTeamId { get; set; }
/// <summary>
/// The opponent team's name; empty when the opponent slot is unassigned.
/// </summary>
public required string OpponentName { get; set; }
/// <summary>
/// The opponent team's logo URL, when available.
/// </summary>
public string? OpponentLogoUrl { get; set; }
/// <summary>
/// The team's own score, when the match has a result.
/// </summary>
public int? TeamScore { get; set; }
/// <summary>
/// The opponent's score, when the match has a result.
/// </summary>
public int? OpponentScore { get; set; }
/// <summary>
/// "W" or "L" from the team's perspective when finished; null otherwise.
/// </summary>
public string? Result { get; set; }
/// <summary>
/// The venue's name, when the match has a venue assigned.
/// </summary>
public string? VenueName { get; set; }
}
@@ -0,0 +1,49 @@
using System;
namespace Application.DTOs.Team.Response;
/// <summary>
/// One tournament a team participated in, enriched with season info for the public trajectory list.
/// </summary>
public class TeamParticipationResponse
{
/// <summary>
/// The id of the tournament the team participated in.
/// </summary>
public required Guid TournamentId { get; set; }
/// <summary>
/// The tournament's display name.
/// </summary>
public required string TournamentName { get; set; }
/// <summary>
/// The tournament's public slug.
/// </summary>
public string? TournamentSlug { get; set; }
/// <summary>
/// The tournament's competitive category name, Masculine or Feminine.
/// </summary>
public required string Category { get; set; }
/// <summary>
/// The id of the season the tournament belongs to, when grouped under one.
/// </summary>
public Guid? SeasonId { get; set; }
/// <summary>
/// The season's display name, when the tournament belongs to a season.
/// </summary>
public string? SeasonName { get; set; }
/// <summary>
/// The season's calendar year, when known.
/// </summary>
public int? Year { get; set; }
/// <summary>
/// True when this is the team's current tournament.
/// </summary>
public required bool IsCurrent { get; set; }
}
@@ -0,0 +1,55 @@
using Application.DTOs.Abstract.Response;
using Application.DTOs.Player.Response;
using System;
using System.Collections.Generic;
namespace Application.DTOs.Team.Response;
/// <summary>
/// Represents a response for a team, inheriting from the base response.
/// </summary>
public class TeamResponse : BaseEntityResponse
{
public required string Name { get; set; }
/// <summary>
/// The unique, URL-friendly identifier used in public team links.
/// </summary>
public required string Slug { get; set; }
public required string ThreeLetterCode { get; set; }
public required string ShirtColor { get; set; }
/// <summary>
/// The jersey kit pattern applied over the primary shirt color; see the frontend's JERSEY_STYLES list.
/// </summary>
public string JerseyStyle { get; set; } = "solid";
/// <summary>
/// Optional secondary #rrggbb hex color used for the jersey pattern or trim; null means no accent color.
/// </summary>
public string? ShirtSecondaryColor { get; set; }
/// <summary>
/// Optional third #rrggbb hex color, used only by tri-color kit templates; null when unused.
/// </summary>
public string? ShirtTertiaryColor { get; set; }
public required string LogoUrl { get; set; }
public Guid? TournamentId { get; set; }
/// <summary>
/// The team's current tournament name, disambiguating same-named teams across seasons; null when TournamentId is null.
/// </summary>
public string? TournamentName { get; set; }
/// <summary>
/// The club this team belongs to, letting the frontend link to it; null when not associated with a club.
/// </summary>
public Guid? ClubId { get; set; }
public required List<PublicPlayerResponse> Players { get; set; } = [];
}
@@ -0,0 +1,64 @@
using System;
namespace Application.DTOs.Team.Response;
/// <summary>
/// A team's current standing row inside its group-stage table for a single tournament.
/// </summary>
public class TeamSummaryResponse
{
/// <summary>
/// The id of the division whose group standings contain the team.
/// </summary>
public required Guid DivisionId { get; set; }
/// <summary>
/// The division's display name.
/// </summary>
public required string DivisionName { get; set; }
/// <summary>
/// The team's 1-based rank within its group table.
/// </summary>
public required int Position { get; set; }
/// <summary>
/// The number of teams in the same group table.
/// </summary>
public required int TotalTeams { get; set; }
/// <summary>
/// Matches played by the team in the group stage.
/// </summary>
public required int Played { get; set; }
/// <summary>
/// Matches won.
/// </summary>
public required int Wins { get; set; }
/// <summary>
/// Matches lost.
/// </summary>
public required int Losses { get; set; }
/// <summary>
/// Total points scored by the team.
/// </summary>
public required int PointsFor { get; set; }
/// <summary>
/// Total points scored against the team.
/// </summary>
public required int PointsAgainst { get; set; }
/// <summary>
/// PointsFor minus PointsAgainst.
/// </summary>
public required int PointsDifference { get; set; }
/// <summary>
/// Table points accumulated, per the division's configured win and loss values.
/// </summary>
public required int Points { get; set; }
}