Smash test
test debug Result Disctinct by selector Refactoring Smash/Challonge Test Resultat Html for Kiouze
This commit is contained in:
62
LaDOSE.Src/LaDOSE.Api/Controllers/SmashController.cs
Normal file
62
LaDOSE.Src/LaDOSE.Api/Controllers/SmashController.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
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 SmashController : Controller
|
||||
{
|
||||
|
||||
private ITournamentService _service;
|
||||
|
||||
private IMapper _mapper;
|
||||
|
||||
// GET
|
||||
public SmashController(IMapper mapper, ITournamentService 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("GetTournament/{tournamentSlug}")]
|
||||
public async Task<IActionResult> GetSmashTournament(string tournamentSlug)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(tournamentSlug))
|
||||
{
|
||||
var tournaments = await _service.GetSmashResult(tournamentSlug);
|
||||
|
||||
return Ok(tournaments);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//[HttpPost("GetResults")]
|
||||
//public async Task<TournamentsResultDTO> GetResults([FromBody] List<int> ids)
|
||||
//{
|
||||
// if (ids == null)
|
||||
// {
|
||||
// throw new Exception("Invalid arguments");
|
||||
// }
|
||||
|
||||
// var tournamentsResult = await _service.GetTournamentsResult(ids);
|
||||
// return _mapper.Map<TournamentsResultDTO>(tournamentsResult);
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -36,12 +36,10 @@ namespace LaDOSE.Api.Controllers
|
||||
var tournaments = await _service.GetTournaments(dto.From, dto.To);
|
||||
return _mapper.Map<List<TournamentDTO>>(tournaments);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("GetResults")]
|
||||
public async Task<TournamentsResultDTO> GetResults([FromBody] List<int> ids)
|
||||
{
|
||||
@@ -54,5 +52,7 @@ namespace LaDOSE.Api.Controllers
|
||||
return _mapper.Map<TournamentsResultDTO>(tournamentsResult);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
|
||||
using AutoMapper;
|
||||
using LaDOSE.Api.Helpers;
|
||||
using LaDOSE.Business.Helper;
|
||||
using LaDOSE.Business.Provider.ChallongProvider;
|
||||
using LaDOSE.Business.Provider.SmashProvider;
|
||||
using LaDOSE.Entity.Challonge;
|
||||
using LaDOSE.Entity.Wordpress;
|
||||
|
||||
@@ -140,6 +142,7 @@ 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>();
|
||||
|
||||
Reference in New Issue
Block a user