Sube carpetas API, API.Tests, Application y Domain del Backend
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Domain.Enums;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
|
||||
namespace Application.DTOs.Match.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to create a match.
|
||||
/// </summary>
|
||||
public class CreateMatchRequest
|
||||
{
|
||||
[Required(ErrorMessage = "The MatchDate field is required.")]
|
||||
public required DateTime MatchDate { get; set; }
|
||||
|
||||
[AllowedValues(MatchType.Regular, MatchType.Playoff)]
|
||||
public MatchType? Type { get; set; } = MatchType.Regular;
|
||||
|
||||
[Required(ErrorMessage = "The HomeTeamId field is required.")]
|
||||
public required Guid HomeTeamId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "The VisitorTeamId field is required.")]
|
||||
public required Guid VisitorTeamId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "The DivisionId field is required.")]
|
||||
public required Guid StageId { get; set; }
|
||||
|
||||
public Guid? VenueId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Application.DTOs.Abstract.Request;
|
||||
|
||||
using Domain.Enums;
|
||||
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.Match.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to filter and paginate matches.
|
||||
/// </summary>
|
||||
public class GetMatchesFilteredRequest : PaginatedFilterRequest
|
||||
{
|
||||
public string? HomeTeamName { get; set; }
|
||||
|
||||
public string? VisitorTeamName { get; set; }
|
||||
|
||||
public Guid? StageId { get; set; }
|
||||
|
||||
public Guid? DivisionId { get; set; }
|
||||
|
||||
public Guid? TournamentId { get; set; }
|
||||
|
||||
public MatchType? Type { get; set; }
|
||||
|
||||
public bool? IsFinished { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Application.DTOs.Match.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Request to mark a match as a walkover, awarding the present team the regulation default result.
|
||||
/// </summary>
|
||||
public class LoadWalkOverRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// The walkover winner; must be one of the match's two teams.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public required Guid PresentTeamId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional override for the present team's awarded score; the regulation default is used when omitted.
|
||||
/// </summary>
|
||||
[Range(0, int.MaxValue, ErrorMessage = "The PresentTeamScore must be a non-negative number.")]
|
||||
public int? PresentTeamScore { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.Match.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Request to suspend a match and optionally reschedule it, never changing its round.
|
||||
/// </summary>
|
||||
public class SuspendMatchRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Optional new date and time for the match; null suspends it in place without rescheduling.
|
||||
/// </summary>
|
||||
public DateTime? MatchDate { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.Match.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Request to reschedule a match; edits only the calendar date and venue.
|
||||
/// </summary>
|
||||
public class UpdateMatchRequest
|
||||
{
|
||||
public DateTime? MatchDate { get; set; }
|
||||
|
||||
public Guid? VenueId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Application.DTOs.Match.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to update the score of a match.
|
||||
/// </summary>
|
||||
public class UpdateMatchScoreRequest
|
||||
{
|
||||
[Required]
|
||||
[Range(0, int.MaxValue, ErrorMessage = "The HomeScore must be a non-negative number.")]
|
||||
public required int HomeScore { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(0, int.MaxValue, ErrorMessage = "The VisitorScore must be a non-negative number.")]
|
||||
public required int VisitorScore { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using Application.DTOs.Abstract.Response;
|
||||
using Application.DTOs.Team.Response;
|
||||
using Application.DTOs.Venue.Response;
|
||||
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.Match.Response;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response data for a match.
|
||||
/// </summary>
|
||||
public class DetailedMatchResponse : BaseEntityResponse
|
||||
{
|
||||
public required DateTime MatchDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The 1-based matchday this match belongs to; null for stages with no round-robin matchday.
|
||||
/// </summary>
|
||||
public int? Round { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the match, regular or playoff.
|
||||
/// </summary>
|
||||
public required string MatchType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique, URL-friendly identifier used in public match links.
|
||||
/// </summary>
|
||||
public required string Slug { get; set; }
|
||||
|
||||
public TeamDetailedMatchResponse? HomeTeam { get; set; }
|
||||
|
||||
public TeamDetailedMatchResponse? VisitorTeam { get; set; }
|
||||
|
||||
public VenueResponse? Venue { get; set; }
|
||||
|
||||
public required bool IsFinished { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The result lifecycle state: Scheduled, Played, Suspended, or WalkOver.
|
||||
/// </summary>
|
||||
public string? Status { get; set; }
|
||||
|
||||
public bool WentToOvertime { get; set; }
|
||||
|
||||
public string? WinningTeamName { get; set; }
|
||||
|
||||
public Guid? WinningTeamId { get; set; }
|
||||
|
||||
public Guid? StageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The id of the tournament this match belongs to, letting the public page link back to it directly.
|
||||
/// </summary>
|
||||
public Guid? TournamentId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Application.DTOs.Abstract.Response;
|
||||
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.Match.Response;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the minimal response data for a match, tailored for divisions.
|
||||
/// </summary>
|
||||
public class MinimalMatchResponse : BaseEntityResponse
|
||||
{
|
||||
public required DateTime MatchDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The 1-based matchday this match belongs to; null for stages with no round-robin matchday.
|
||||
/// </summary>
|
||||
public int? Round { get; set; }
|
||||
|
||||
public required string HomeTeamName { get; set; }
|
||||
|
||||
public required string VisitorTeamName { get; set; }
|
||||
|
||||
public int? HomeScore { get; set; }
|
||||
|
||||
public int? VisitorScore { get; set; }
|
||||
|
||||
public string? WinningTeamName { get; set; }
|
||||
|
||||
public required bool IsFinished { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The result lifecycle state: Scheduled, Played, Suspended, or WalkOver.
|
||||
/// </summary>
|
||||
public string? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the match, regular or playoff.
|
||||
/// </summary>
|
||||
public required string MatchType { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Application.DTOs.Match.Response;
|
||||
|
||||
/// <summary>
|
||||
/// A single matchday and its matches, letting the frontend group the fixture by round instead of date.
|
||||
/// </summary>
|
||||
public class RoundMatchesResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The 1-based round number; null groups matches with no round-robin matchday.
|
||||
/// </summary>
|
||||
public int? Round { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The matches played in this round, in a stable order.
|
||||
/// </summary>
|
||||
public List<DetailedMatchResponse> Matches { get; set; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user