Bot Event

This commit is contained in:
2022-07-30 18:22:49 +02:00
parent bfcca7132c
commit c0d469eac6
18 changed files with 2884 additions and 190 deletions

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using LaDOSE.Business.Interface;
using LaDOSE.DTO;
using LaDOSE.Entity;
using LaDOSE.Entity.BotEvent;
using LaDOSE.Entity.Wordpress;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
[AllowAnonymous]
//[Authorize]
[Produces("application/json")]
[Route("api/[controller]")]
public class BotEventController : GenericControllerDTO<IBotEventService, BotEvent, BotEventDTO>
{
public BotEventController(IMapper mapper,IBotEventService service) : base(mapper,service)
{
}
[Route("CreateBotEvent/{eventName}")]
public bool CreateBotEvent(String eventName)
{
return this._service.CreateEvent(eventName);
}
[HttpPost]
[Route("ResultBotEvent/")]
public bool ResultBotEvent([FromBody] BotEventSendDTO result)
{
return this._service.SetResult(result.DiscordId,result.DiscordName,result.Present);
}
[Route("GetLastBotEvent/")]
public BotEventDTO GetLastBotEvent()
{
return this._mapper.Map<BotEventDTO>(this._service.GetLastEvent());
}
}
}

View File

@@ -31,6 +31,7 @@ using LaDOSE.Business.Provider.SmashProvider;
using LaDOSE.Entity.Challonge;
using LaDOSE.Entity.Wordpress;
using Result = LaDOSE.Entity.Challonge.Result;
using LaDOSE.Entity.BotEvent;
namespace LaDOSE.Api
{
@@ -123,6 +124,8 @@ namespace LaDOSE.Api
cfg.CreateMap<WPEvent, LaDOSE.DTO.WPEventDTO>();
cfg.CreateMap<Result, LaDOSE.DTO.ResultDTO>();
cfg.CreateMap<Event, LaDOSE.DTO.EventDTO>();
cfg.CreateMap<BotEventResult, LaDOSE.DTO.BotEventResultDTO>();
cfg.CreateMap<BotEvent, LaDOSE.DTO.BotEventDTO>();
cfg.CreateMap<TournamentsResult, LaDOSE.DTO.TournamentsResultDTO>();
cfg.CreateMap<ChallongeParticipent, LaDOSE.DTO.ParticipentDTO>();
@@ -150,6 +153,7 @@ namespace LaDOSE.Api
services.AddScoped<IWordPressService, WordPressService>();
services.AddScoped<ITodoService, TodoService>();
services.AddScoped<IEventService, EventService>();
services.AddScoped<IBotEventService, BotEventService>();
services.AddScoped<IPlayerService, PlayerService>();
services.AddTransient<IChallongeProvider>(p => new ChallongeProvider( p.GetRequiredService<IGameService>(),