Start of the Structure of event not tied to Challonge or smash.

Lads und Canzer \o>
This commit is contained in:
2022-03-20 02:59:48 +01:00
parent ab02d292da
commit 87c9883245
22 changed files with 709 additions and 445 deletions

View File

@@ -18,12 +18,12 @@ namespace LaDOSE.Api.Controllers
public class SmashController : Controller
{
private ITournamentService _service;
private IEventService _service;
private IMapper _mapper;
// GET
public SmashController(IMapper mapper, ITournamentService service)
public SmashController(IMapper mapper, IEventService service)
{
_mapper = mapper;
_service = service;
@@ -36,6 +36,7 @@ namespace LaDOSE.Api.Controllers
{
if (!String.IsNullOrEmpty(tournamentSlug))
{
var tournaments = await _service.GetSmashResult(tournamentSlug);
return Ok(tournaments);
@@ -43,8 +44,19 @@ namespace LaDOSE.Api.Controllers
return null;
}
[HttpGet("AddTournament/{tournamentSlug}")]
public async Task<IActionResult> AddSmashTournament(string tournamentSlug)
{
if (!String.IsNullOrEmpty(tournamentSlug))
{
var tournaments = await _service.GetSmashResult2(tournamentSlug);
return Ok(tournaments);
}
return null;
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using LaDOSE.Business.Interface;
using LaDOSE.DTO;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
#if DEBUG
[AllowAnonymous]
#endif
[Produces("application/json")]
[Route("api/[controller]")]
public class TestController : Controller
{
private IEventService _service;
private IMapper _mapper;
// GET
public TestController(IMapper mapper, IEventService service)
{
_mapper = mapper;
_service = service;
}
//This may be a get , but i dont know what the RFC State for Get request with Body
//As i don't like to populate GET request with body this will be a post (and i think
//it will be easier to proxy.
[HttpGet("Test/{tournamentSlug}")]
public async Task<IActionResult> GetSmashTournament(string tournamentSlug)
{
if (!String.IsNullOrEmpty(tournamentSlug))
{
var tournaments = await _service.GetSmashResult(tournamentSlug);
return Ok(tournaments);
}
return null;
}
}
}

View File

@@ -15,12 +15,12 @@ namespace LaDOSE.Api.Controllers
public class TournamentController : Controller
{
private ITournamentService _service;
private IEventService _service;
private IMapper _mapper;
// GET
public TournamentController(IMapper mapper,ITournamentService service)
public TournamentController(IMapper mapper, IEventService service)
{
_mapper = mapper;
_service = service;
@@ -49,6 +49,7 @@ namespace LaDOSE.Api.Controllers
}
var tournamentsResult = await _service.GetTournamentsResult(ids);
return _mapper.Map<TournamentsResultDTO>(tournamentsResult);
}

View File

@@ -143,14 +143,16 @@ namespace LaDOSE.Api
{
services.AddTransient<IChallongeProvider>(p => new ChallongeProvider(this.Configuration["ApiKey:ChallongeApiKey"]));
services.AddTransient<ISmashProvider>(p => new SmashProvider(this.Configuration["ApiKey:SmashApiKey"]));
services.AddScoped<IUserService, UserService>();
services.AddScoped<IGameService, GameService>();
services.AddScoped<IEventService, EventService>();
services.AddScoped<IWordPressService, WordPressService>();
services.AddScoped<ITodoService, TodoService>();
services.AddScoped<ITournamentService, TournamentService>();
services.AddScoped<IEventService, EventService>();
services.AddScoped<IPlayerService, PlayerService>();
services.AddScoped<ISmashProvider>(p => new SmashProvider(p.GetRequiredService<IGameService>(), p.GetRequiredService<IPlayerService>(), this.Configuration["ApiKey:SmashApiKey"]));
}