Smash test

test debug

Result

Disctinct by selector
Refactoring Smash/Challonge

Test Resultat

Html for Kiouze
This commit is contained in:
2022-03-11 01:14:56 +01:00
parent 45768fff80
commit aebc60d17f
16 changed files with 459 additions and 22 deletions

View 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);
//}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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>();