Sube carpetas API, API.Tests, Application y Domain del Backend
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// The sensitive, auditable actions tracked for traceability, persisted as the enum name so the trail survives numeric reordering.
|
||||
/// </summary>
|
||||
public enum AuditAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Full tournament-domain data wipe, triggered by DataMaintenanceService.
|
||||
/// </summary>
|
||||
DataWipe,
|
||||
|
||||
/// <summary>
|
||||
/// Database restore from a backup, triggered by BackupRestoreService.
|
||||
/// </summary>
|
||||
BackupRestore,
|
||||
|
||||
/// <summary>
|
||||
/// A tournament lifecycle status change, triggered by TournamentService.
|
||||
/// </summary>
|
||||
TournamentStatusChange,
|
||||
|
||||
/// <summary>
|
||||
/// An admin-triggered password reset, from user management.
|
||||
/// </summary>
|
||||
PasswordReset,
|
||||
|
||||
/// <summary>
|
||||
/// A bracket seeding draw, initial or re-draw, recorded for transparency.
|
||||
/// </summary>
|
||||
PlayoffDraw,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// How a catalogued database backup was created.
|
||||
/// </summary>
|
||||
public enum BackupOrigin
|
||||
{
|
||||
/// <summary>
|
||||
/// Triggered on-demand by an Admin from the Data Administration panel.
|
||||
/// </summary>
|
||||
Manual,
|
||||
|
||||
/// <summary>
|
||||
/// Created automatically by the scheduled DatabaseBackupHostedService.
|
||||
/// </summary>
|
||||
Job
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// How a playoffs-only bracket's first-round team order is produced: shuffled server-side or set by an admin.
|
||||
/// </summary>
|
||||
public enum DrawMode
|
||||
{
|
||||
Random,
|
||||
Manual,
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// The lifecycle state of a match's result, distinct from the boolean Match.IsFinished flag.
|
||||
/// </summary>
|
||||
public enum MatchStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The default state: the fixture exists but no result has been loaded yet.
|
||||
/// </summary>
|
||||
Scheduled,
|
||||
|
||||
/// <summary>
|
||||
/// The match was played and a decisive result was loaded.
|
||||
/// </summary>
|
||||
Played,
|
||||
|
||||
/// <summary>
|
||||
/// The match was postponed or suspended and has no result.
|
||||
/// </summary>
|
||||
Suspended,
|
||||
|
||||
/// <summary>
|
||||
/// One team did not show up, so the regulation default result was applied to the present team.
|
||||
/// </summary>
|
||||
WalkOver,
|
||||
|
||||
/// <summary>
|
||||
/// The match will never be played because its tournament was canceled or force-closed while it was still pending.
|
||||
/// </summary>
|
||||
Canceled
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
public enum MatchType
|
||||
{
|
||||
Regular,
|
||||
Playoff
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Medical-record eligibility status of a player's season registration, scoped per player, team, and tournament.
|
||||
/// </summary>
|
||||
public enum MedicalRecordStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Default for a brand-new registration: no medical record uploaded yet, or uploaded but not yet reviewed.
|
||||
/// </summary>
|
||||
Pending,
|
||||
|
||||
/// <summary>
|
||||
/// The owner or admin reviewed and approved the medical record, making the player habilitado for that team and tournament.
|
||||
/// </summary>
|
||||
Approved,
|
||||
|
||||
/// <summary>
|
||||
/// The owner or admin rejected the medical record, usually with a reason, leaving the player not habilitado.
|
||||
/// </summary>
|
||||
Rejected,
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Compile-time string constants for every UserRoleType value, used in authorization attributes to avoid magic strings.
|
||||
/// </summary>
|
||||
public static class Roles
|
||||
{
|
||||
public const string Admin = nameof(UserRoleType.ADMIN);
|
||||
public const string Owner = nameof(UserRoleType.OWNER);
|
||||
public const string Guest = nameof(UserRoleType.GUEST);
|
||||
|
||||
/// <summary>
|
||||
/// Every staff role that may operate the panel: the Owner account and the Admin IT account.
|
||||
/// </summary>
|
||||
public const string AdminOrOwner = $"{Admin},{Owner}";
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
public enum SanctionAppealStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// No appeal has been submitted.
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// An appeal was submitted and is awaiting a decision.
|
||||
/// </summary>
|
||||
Pending,
|
||||
|
||||
/// <summary>
|
||||
/// The appeal was accepted and the sanction is overturned.
|
||||
/// </summary>
|
||||
Accepted,
|
||||
|
||||
/// <summary>
|
||||
/// The appeal was rejected and the sanction stands.
|
||||
/// </summary>
|
||||
Rejected
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// The kind of subject a PlayerSanction is applied to: an individual player, a whole team, or a staff member.
|
||||
/// </summary>
|
||||
public enum SanctionSubjectType
|
||||
{
|
||||
/// <summary>
|
||||
/// The sanction targets an individual player, identified by PlayerSanction.PlayerId.
|
||||
/// </summary>
|
||||
Player,
|
||||
|
||||
/// <summary>
|
||||
/// The sanction targets a whole team as an institutional sanction, identified by PlayerSanction.TeamId.
|
||||
/// </summary>
|
||||
Team,
|
||||
|
||||
/// <summary>
|
||||
/// The sanction targets a staff member, identified only by PlayerSanction.StaffName.
|
||||
/// </summary>
|
||||
Staff
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
public enum StageType
|
||||
{
|
||||
/// <summary>
|
||||
/// Group stage, where teams play in a round-robin format.
|
||||
/// </summary>
|
||||
Group,
|
||||
|
||||
/// <summary>
|
||||
/// Round of 16 stage.
|
||||
/// </summary>
|
||||
RoundOf16,
|
||||
|
||||
QuarterFinal,
|
||||
SemiFinal,
|
||||
ThirdPlace,
|
||||
Final
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
public enum StatisticType
|
||||
{
|
||||
Points,
|
||||
Assists
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// The role a member of a team's technical staff holds for a given season.
|
||||
/// </summary>
|
||||
public enum TeamStaffRole
|
||||
{
|
||||
/// <summary>
|
||||
/// Head coach.
|
||||
/// </summary>
|
||||
Coach,
|
||||
|
||||
/// <summary>
|
||||
/// Assistant coach.
|
||||
/// </summary>
|
||||
AssistantCoach
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// The group-stage tiebreaker criteria, in the exact priority order the club's rulebook applies them.
|
||||
/// </summary>
|
||||
public enum TiebreakerCriterion
|
||||
{
|
||||
/// <summary>
|
||||
/// Table points awarded for wins and losses.
|
||||
/// </summary>
|
||||
Points,
|
||||
|
||||
/// <summary>
|
||||
/// Games won across the whole zone.
|
||||
/// </summary>
|
||||
GamesWon,
|
||||
|
||||
/// <summary>
|
||||
/// Points for minus points against, across the whole zone.
|
||||
/// </summary>
|
||||
PointsDifference,
|
||||
|
||||
/// <summary>
|
||||
/// Head-to-head result among the tied teams.
|
||||
/// </summary>
|
||||
HeadToHead,
|
||||
|
||||
/// <summary>
|
||||
/// Points difference considering only the games played among the tied teams.
|
||||
/// </summary>
|
||||
HeadToHeadPointsDifference,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Competitive gender category of a tournament, living on the Tournament as the source of truth every division must share.
|
||||
/// </summary>
|
||||
public enum TournamentCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// Masculine competition, the default for existing or unspecified tournaments.
|
||||
/// </summary>
|
||||
Masculine = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Feminine competition, played as its own separate tournament.
|
||||
/// </summary>
|
||||
Feminine = 1
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Lifecycle status of a Tournament; see TournamentStatusTransitions for the allowed moves between these values.
|
||||
/// </summary>
|
||||
public enum TournamentStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The tournament is scheduled but not yet open for team registrations.
|
||||
/// </summary>
|
||||
Scheduled,
|
||||
OpenForRegistration,
|
||||
/// <summary>
|
||||
/// Registration has closed, freezing structural changes: the roster is fixed and teams are assigned to divisions.
|
||||
/// </summary>
|
||||
RegistrationClosed,
|
||||
Ongoing,
|
||||
Finished,
|
||||
/// <summary>
|
||||
/// The tournament has been canceled and will not take place.
|
||||
/// </summary>
|
||||
Canceled,
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Encodes the tournament lifecycle state machine, a linear happy path from Scheduled through Finished plus a Canceled escape from any non-terminal state.
|
||||
/// </summary>
|
||||
public static class TournamentStatusTransitions
|
||||
{
|
||||
/// <summary>
|
||||
/// The set of states each status may move to next, an absent status meaning an invalid transition.
|
||||
/// </summary>
|
||||
private static readonly IReadOnlyDictionary<TournamentStatus, TournamentStatus[]> AllowedNextStates =
|
||||
new Dictionary<TournamentStatus, TournamentStatus[]>
|
||||
{
|
||||
[TournamentStatus.Scheduled] = [TournamentStatus.OpenForRegistration, TournamentStatus.Canceled],
|
||||
[TournamentStatus.OpenForRegistration] = [TournamentStatus.RegistrationClosed, TournamentStatus.Canceled],
|
||||
[TournamentStatus.RegistrationClosed] = [TournamentStatus.Ongoing, TournamentStatus.Canceled],
|
||||
// Ongoing may revert to RegistrationClosed to fix a division mis-assignment, tearing down the generated fixture so restarting rebuilds it correctly.
|
||||
[TournamentStatus.Ongoing] = [TournamentStatus.Finished, TournamentStatus.RegistrationClosed, TournamentStatus.Canceled],
|
||||
[TournamentStatus.Finished] = [],
|
||||
[TournamentStatus.Canceled] = [],
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Whether a status is terminal, meaning it has no outgoing transition.
|
||||
/// </summary>
|
||||
public static bool IsTerminal(TournamentStatus status) =>
|
||||
status is TournamentStatus.Finished or TournamentStatus.Canceled;
|
||||
|
||||
/// <summary>
|
||||
/// Whether transitioning from one given status to another is allowed, with a same-status no-op always considered valid.
|
||||
/// </summary>
|
||||
public static bool IsValidTransition(TournamentStatus from, TournamentStatus to)
|
||||
{
|
||||
if (from == to)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return AllowedNextStates.TryGetValue(from, out TournamentStatus[]? nextStates)
|
||||
&& nextStates.Contains(to);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
public enum UserRoleType
|
||||
{
|
||||
ADMIN = 0,
|
||||
OWNER = 1,
|
||||
GUEST = 2
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Domain.Enums;
|
||||
|
||||
public static class UserRoleTypeExtensions
|
||||
{
|
||||
public static string ToRoleName(this UserRoleType role)
|
||||
{
|
||||
return role.ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user