Skip to content

Commit

Permalink
Merge pull request #193 from SSchulze1989/feature/select-drop-weeks
Browse files Browse the repository at this point in the history
Feature/select drop weeks
  • Loading branch information
SSchulze1989 authored May 29, 2024
2 parents cb44fab + f9c8f0f commit 777a029
Show file tree
Hide file tree
Showing 156 changed files with 4,676 additions and 345 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace iRLeagueApiCore.Common.Models;

[DataContract]
public sealed class IracingLeagueSeasonModel
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using iRLeagueApiCore.Common.Models.Tracks;

namespace iRLeagueApiCore.Common.Models;

[DataContract]
public sealed class DropweekOverrideModel
{
[DataMember]
public long StandingConfigId { get; set; }
[DataMember]
public long ScoredResultRowId { get; set; }
[DataMember]
public MemberInfoModel? Member { get; set; }
[DataMember]
public TeamInfoModel? Team { get; set; }
[DataMember]
public string EventName { get; set; } = string.Empty;
[DataMember]
public DateTime Date { get; set; }
[DataMember]
public long TrackId { get; set; }
[DataMember]
public string TrackName { get; set; } = string.Empty;
[DataMember]
public string ConfigName { get; set; } = string.Empty;
[DataMember]
public bool ShouldDrop { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace iRLeagueApiCore.Server.Handlers.AdminPanel;

public class AdminHandlerBase<THandler, TRequest> : HandlerBase<THandler, TRequest>
public abstract class AdminHandlerBase<THandler, TRequest, TResponse> : HandlerBase<THandler, TRequest, TResponse> where TRequest : IRequest<TResponse>
{
public AdminHandlerBase(ILogger<THandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<TRequest>> validators)
: base(logger, dbContext, validators)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace iRLeagueApiCore.Server.Handlers.AdminPanel;

public record DeactivatePaymentRequest(Guid Id) : IRequest<PaymentModel>;

public class DeactivatePaymentHandler : AdminHandlerBase<DeactivatePaymentHandler, DeactivatePaymentRequest>,
public class DeactivatePaymentHandler : AdminHandlerBase<DeactivatePaymentHandler, DeactivatePaymentRequest, PaymentModel>,
IRequestHandler<DeactivatePaymentRequest, PaymentModel>
{
public DeactivatePaymentHandler(ILogger<DeactivatePaymentHandler> logger, LeagueDbContext dbContext,
Expand All @@ -13,7 +13,7 @@ public DeactivatePaymentHandler(ILogger<DeactivatePaymentHandler> logger, League
{
}

public async Task<PaymentModel> Handle(DeactivatePaymentRequest request, CancellationToken cancellationToken)
public override async Task<PaymentModel> Handle(DeactivatePaymentRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var payment = await dbContext.Payments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace iRLeagueApiCore.Server.Handlers.AdminPanel;

public record GetAllPaymentsRequest(long? LeagueId = null) : IRequest<IEnumerable<PaymentModel>>;

public class GetAllPaymentsHandler : AdminHandlerBase<GetAllPaymentsHandler, GetAllPaymentsRequest>,
public class GetAllPaymentsHandler : AdminHandlerBase<GetAllPaymentsHandler, GetAllPaymentsRequest, IEnumerable<PaymentModel>>,
IRequestHandler<GetAllPaymentsRequest, IEnumerable<PaymentModel>>
{
public GetAllPaymentsHandler(ILogger<GetAllPaymentsHandler> logger, LeagueDbContext dbContext,
Expand All @@ -14,7 +14,7 @@ public GetAllPaymentsHandler(ILogger<GetAllPaymentsHandler> logger, LeagueDbCont
{
}

public async Task<IEnumerable<PaymentModel>> Handle(GetAllPaymentsRequest request, CancellationToken cancellationToken)
public override async Task<IEnumerable<PaymentModel>> Handle(GetAllPaymentsRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getSubscriptions = await dbContext.Payments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ namespace iRLeagueApiCore.Server.Handlers.AdminPanel;

public record GetPaymentRequest(Guid Id) : IRequest<PaymentModel>;

public class GetPaymentHandler : AdminHandlerBase<GetPaymentHandler, GetPaymentRequest>, IRequestHandler<GetPaymentRequest, PaymentModel>
public class GetPaymentHandler : AdminHandlerBase<GetPaymentHandler, GetPaymentRequest, PaymentModel>
{
public GetPaymentHandler(ILogger<GetPaymentHandler> logger, LeagueDbContext dbContext,
IEnumerable<IValidator<GetPaymentRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<PaymentModel> Handle(GetPaymentRequest request, CancellationToken cancellationToken)
public override async Task<PaymentModel> Handle(GetPaymentRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getPayment = await dbContext.Payments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ namespace iRLeagueApiCore.Server.Handlers.AdminPanel;

public record PostPaymentRequest(long LeagueId, PostPaymentModel Model) : IRequest<PaymentModel>;

public sealed class PostPaymentHandler : AdminHandlerBase<PostPaymentHandler, PostPaymentRequest>,
IRequestHandler<PostPaymentRequest, PaymentModel>
public sealed class PostPaymentHandler : AdminHandlerBase<PostPaymentHandler, PostPaymentRequest, PaymentModel>
{
public PostPaymentHandler(ILogger<PostPaymentHandler> logger, LeagueDbContext dbContext,
IEnumerable<IValidator<PostPaymentRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<PaymentModel> Handle(PostPaymentRequest request, CancellationToken cancellationToken)
public override async Task<PaymentModel> Handle(PostPaymentRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var league = await dbContext.Leagues.FirstAsync(x => x.Id == request.LeagueId, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ namespace iRLeagueApiCore.Server.Handlers.AdminPanel;

public record SetLeagueSubscriptionRequest(long LeagueId, SetLeagueSubscriptionModel Model) : IRequest<LeagueModel>;

public class SetLeagueSubscriptionHandler : LeagueHandlerBase<SetLeagueSubscriptionHandler, SetLeagueSubscriptionRequest>,
IRequestHandler<SetLeagueSubscriptionRequest, LeagueModel>
public class SetLeagueSubscriptionHandler : LeagueHandlerBase<SetLeagueSubscriptionHandler, SetLeagueSubscriptionRequest, LeagueModel>
{
public SetLeagueSubscriptionHandler(ILogger<SetLeagueSubscriptionHandler> logger, LeagueDbContext dbContext,
IEnumerable<IValidator<SetLeagueSubscriptionRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<LeagueModel> Handle(SetLeagueSubscriptionRequest request, CancellationToken cancellationToken)
public override async Task<LeagueModel> Handle(SetLeagueSubscriptionRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var league = await GetLeagueEntityAsync(request.LeagueId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ namespace iRLeagueApiCore.Server.Handlers.Cars;

public record GetCarsFromEventRequest(long EventId) : IRequest<CarListModel>;

public class GetCarsFromEventHandler : HandlerBase<GetCarsFromEventHandler, GetCarsFromEventRequest>,
IRequestHandler<GetCarsFromEventRequest, CarListModel>
public class GetCarsFromEventHandler : HandlerBase<GetCarsFromEventHandler, GetCarsFromEventRequest, CarListModel>
{
public GetCarsFromEventHandler(ILogger<GetCarsFromEventHandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<GetCarsFromEventRequest>> validators) :
base(logger, dbContext, validators)
{
}

public async Task<CarListModel> Handle(GetCarsFromEventRequest request, CancellationToken cancellationToken)
public override async Task<CarListModel> Handle(GetCarsFromEventRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken).ConfigureAwait(false);
var eventCars = (await GetEventCarsPerMemberAsync(request.EventId, cancellationToken));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace iRLeagueApiCore.Server.Handlers.Championships;

public class ChampSeasonHandlerBase<THandler, TRequest> : HandlerBase<THandler, TRequest>
public abstract class ChampSeasonHandlerBase<THandler, TRequest, TResponse> : HandlerBase<THandler, TRequest, TResponse> where TRequest : IRequest<TResponse>
{ public ChampSeasonHandlerBase(ILogger<THandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<TRequest>> validators) :
base(logger, dbContext, validators)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace iRLeagueApiCore.Server.Handlers.Championships;

public class ChampionshipHandlerBase<THandler, TRequest> : HandlerBase<THandler, TRequest>
public abstract class ChampionshipHandlerBase<THandler, TRequest, TResponse> : HandlerBase<THandler, TRequest, TResponse> where TRequest : IRequest<TResponse>
{
public ChampionshipHandlerBase(ILogger<THandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<TRequest>> validators) :
base(logger, dbContext, validators)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record DeleteChampSeasonRequest(long ChampSeasonId) : IRequest;

public sealed class DeleteChampSeasonHandler : ChampSeasonHandlerBase<DeleteChampSeasonHandler, DeleteChampSeasonRequest>,
IRequestHandler<DeleteChampSeasonRequest, Unit>
public sealed class DeleteChampSeasonHandler : ChampSeasonHandlerBase<DeleteChampSeasonHandler, DeleteChampSeasonRequest, Unit>
{
public DeleteChampSeasonHandler(ILogger<DeleteChampSeasonHandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<DeleteChampSeasonRequest>> validators) :
base(logger, dbContext, validators)
{
}

public async Task<Unit> Handle(DeleteChampSeasonRequest request, CancellationToken cancellationToken)
public override async Task<Unit> Handle(DeleteChampSeasonRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var deleteChampSeason = await GetChampSeasonEntityAsync(request.ChampSeasonId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

public record DeleteChampionshipRequest(long ChampionshipId) : IRequest;

public class DeleteChampionshipHandler : ChampionshipHandlerBase<DeleteChampionshipHandler, DeleteChampionshipRequest>,
IRequestHandler<DeleteChampionshipRequest, Unit>
public class DeleteChampionshipHandler : ChampionshipHandlerBase<DeleteChampionshipHandler, DeleteChampionshipRequest, Unit>
{
public DeleteChampionshipHandler(ILogger<DeleteChampionshipHandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<DeleteChampionshipRequest>> validators) :
base(logger, dbContext, validators)
{
}

public async Task<Unit> Handle(DeleteChampionshipRequest request, CancellationToken cancellationToken)
public override async Task<Unit> Handle(DeleteChampionshipRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var deleteChampionship = await GetChampionshipEntityAsync(request.ChampionshipId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record GetChampSeasonFromSeasonChampionshipRequest(long SeasonId, long ChampionshipId) : IRequest<ChampSeasonModel>;

public class GetChampSeasonFromSeasonChampionshipHandler : ChampSeasonHandlerBase<GetChampSeasonFromSeasonChampionshipHandler, GetChampSeasonFromSeasonChampionshipRequest>,
IRequestHandler<GetChampSeasonFromSeasonChampionshipRequest, ChampSeasonModel>
public class GetChampSeasonFromSeasonChampionshipHandler : ChampSeasonHandlerBase<GetChampSeasonFromSeasonChampionshipHandler, GetChampSeasonFromSeasonChampionshipRequest, ChampSeasonModel>
{
public GetChampSeasonFromSeasonChampionshipHandler(ILogger<GetChampSeasonFromSeasonChampionshipHandler> logger, LeagueDbContext dbContext,
IEnumerable<IValidator<GetChampSeasonFromSeasonChampionshipRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<ChampSeasonModel> Handle(GetChampSeasonFromSeasonChampionshipRequest request, CancellationToken cancellationToken)
public override async Task<ChampSeasonModel> Handle(GetChampSeasonFromSeasonChampionshipRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getChampSeason = await GetChampSeasonFromSeasonChampionship(request.SeasonId, request.ChampionshipId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record GetChampSeasonRequest(long ChampSeasonId) : IRequest<ChampSeasonModel>;

public sealed class GetChampSeasonHandler : ChampSeasonHandlerBase<GetChampSeasonHandler, GetChampSeasonRequest>,
IRequestHandler<GetChampSeasonRequest, ChampSeasonModel>
public sealed class GetChampSeasonHandler : ChampSeasonHandlerBase<GetChampSeasonHandler, GetChampSeasonRequest, ChampSeasonModel>
{
public GetChampSeasonHandler(ILogger<GetChampSeasonHandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<GetChampSeasonRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<ChampSeasonModel> Handle(GetChampSeasonRequest request, CancellationToken cancellationToken)
public override async Task<ChampSeasonModel> Handle(GetChampSeasonRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getChampSeason = await MapToChampSeasonModel(request.ChampSeasonId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record GetChampSeasonsFromChampionshipRequest(long ChampionshipId) : IRequest<IEnumerable<ChampSeasonModel>>;

public sealed class GetChampSeasonFromChampionshipHandler : ChampSeasonHandlerBase<GetChampSeasonFromChampionshipHandler, GetChampSeasonsFromChampionshipRequest>,
IRequestHandler<GetChampSeasonsFromChampionshipRequest, IEnumerable<ChampSeasonModel>>
public sealed class GetChampSeasonFromChampionshipHandler : ChampSeasonHandlerBase<GetChampSeasonFromChampionshipHandler, GetChampSeasonsFromChampionshipRequest, IEnumerable<ChampSeasonModel>>
{
public GetChampSeasonFromChampionshipHandler(ILogger<GetChampSeasonFromChampionshipHandler> logger, LeagueDbContext dbContext,
IEnumerable<IValidator<GetChampSeasonsFromChampionshipRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<IEnumerable<ChampSeasonModel>> Handle(GetChampSeasonsFromChampionshipRequest request, CancellationToken cancellationToken)
public override async Task<IEnumerable<ChampSeasonModel>> Handle(GetChampSeasonsFromChampionshipRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getChampSeasons = await MapToChampSeasonModelsFromChampionshipAsync(request.ChampionshipId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record GetChampSeasonsFromSeasonRequest(long SeasonId) : IRequest<IEnumerable<ChampSeasonModel>>;

public sealed class GetChampSeasonFromSeasonHandler : ChampSeasonHandlerBase<GetChampSeasonFromSeasonHandler, GetChampSeasonsFromSeasonRequest>,
IRequestHandler<GetChampSeasonsFromSeasonRequest, IEnumerable<ChampSeasonModel>>
public sealed class GetChampSeasonFromSeasonHandler : ChampSeasonHandlerBase<GetChampSeasonFromSeasonHandler, GetChampSeasonsFromSeasonRequest, IEnumerable<ChampSeasonModel>>
{
public GetChampSeasonFromSeasonHandler(ILogger<GetChampSeasonFromSeasonHandler> logger, LeagueDbContext dbContext,
IEnumerable<IValidator<GetChampSeasonsFromSeasonRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<IEnumerable<ChampSeasonModel>> Handle(GetChampSeasonsFromSeasonRequest request, CancellationToken cancellationToken)
public override async Task<IEnumerable<ChampSeasonModel>> Handle(GetChampSeasonsFromSeasonRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getChampSeasons = await MapToChampSeasonModelsFromSeasonAsync(request.SeasonId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record GetChampionshipRequest(long ChampionshipId) : IRequest<ChampionshipModel>;

public class GetChampionshipHandler : ChampionshipHandlerBase<GetChampionshipHandler, GetChampionshipRequest>,
IRequestHandler<GetChampionshipRequest, ChampionshipModel>
public class GetChampionshipHandler : ChampionshipHandlerBase<GetChampionshipHandler, GetChampionshipRequest, ChampionshipModel>
{
public GetChampionshipHandler(ILogger<GetChampionshipHandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<GetChampionshipRequest>> validators) :
base(logger, dbContext, validators)
{
}

public async Task<ChampionshipModel> Handle(GetChampionshipRequest request, CancellationToken cancellationToken)
public override async Task<ChampionshipModel> Handle(GetChampionshipRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getChampionship = await MapToChampionshipModelAsync(request.ChampionshipId, cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record GetChampionshipsFromLeagueRequest() : IRequest<IEnumerable<ChampionshipModel>>;

public sealed class GetChampionshipsFromLeagueHandler : ChampionshipHandlerBase<GetChampionshipsFromLeagueHandler, GetChampionshipsFromLeagueRequest>,
IRequestHandler<GetChampionshipsFromLeagueRequest, IEnumerable<ChampionshipModel>>
public sealed class GetChampionshipsFromLeagueHandler : ChampionshipHandlerBase<GetChampionshipsFromLeagueHandler, GetChampionshipsFromLeagueRequest, IEnumerable<ChampionshipModel>>
{
public GetChampionshipsFromLeagueHandler(ILogger<GetChampionshipsFromLeagueHandler> logger, LeagueDbContext dbContext,
IEnumerable<IValidator<GetChampionshipsFromLeagueRequest>> validators) :
base(logger, dbContext, validators)
{
}

public async Task<IEnumerable<ChampionshipModel>> Handle(GetChampionshipsFromLeagueRequest request, CancellationToken cancellationToken)
public override async Task<IEnumerable<ChampionshipModel>> Handle(GetChampionshipsFromLeagueRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var getChampionships = await MapToChampionshipModelsFromLeagueAsync(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ namespace iRLeagueApiCore.Server.Handlers.Championships;

public record PostChampSeasonRequest(long ChampionshipId, long SeasonId, LeagueUser User, PostChampSeasonModel Model) : IRequest<ChampSeasonModel>;

public sealed class PostChampSeasonHandler : ChampSeasonHandlerBase<PostChampSeasonHandler, PostChampSeasonRequest>,
IRequestHandler<PostChampSeasonRequest, ChampSeasonModel>
public sealed class PostChampSeasonHandler : ChampSeasonHandlerBase<PostChampSeasonHandler, PostChampSeasonRequest, ChampSeasonModel>
{
public PostChampSeasonHandler(ILogger<PostChampSeasonHandler> logger, LeagueDbContext dbContext, IEnumerable<IValidator<PostChampSeasonRequest>> validators)
: base(logger, dbContext, validators)
{
}

public async Task<ChampSeasonModel> Handle(PostChampSeasonRequest request, CancellationToken cancellationToken)
public override async Task<ChampSeasonModel> Handle(PostChampSeasonRequest request, CancellationToken cancellationToken)
{
await validators.ValidateAllAndThrowAsync(request, cancellationToken);
var postChampSeason = await GetChampSeasonEntityAsync(request.ChampionshipId, request.SeasonId, cancellationToken)
Expand Down
Loading

0 comments on commit 777a029

Please sign in to comment.