Rework the UI

Fix Score
Add Kiouze CSS
Rework the tournaments API
This commit is contained in:
2022-03-22 00:14:46 +01:00
parent 3a86fdbdf4
commit 0150402ca6
17 changed files with 890 additions and 280 deletions

View File

@@ -11,7 +11,8 @@ using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
[Authorize]
[AllowAnonymous]
//[Authorize]
[Produces("application/json")]
[Route("api/[controller]")]
public class EventController : GenericController<IEventService, Event>

View File

@@ -1,62 +0,0 @@
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 IExternalProviderService _service;
private IMapper _mapper;
// GET
public SmashController(IMapper mapper, IExternalProviderService 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;
}
[HttpGet("AddTournament/{tournamentSlug}")]
public async Task<IActionResult> AddSmashTournament(string tournamentSlug)
{
if (!String.IsNullOrEmpty(tournamentSlug))
{
//var tournaments = await _service.GetSmashResult2(tournamentSlug);
return Ok();
//return Ok(tournaments);
}
return null;
}
}
}

View File

@@ -1,50 +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;
//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
{
//namespace LaDOSE.Api.Controllers
//{
//#if DEBUG
// [AllowAnonymous]
//#endif
// [Produces("application/json")]
// [Route("api/[controller]")]
// public class TestController : Controller
// {
private IExternalProviderService _service;
// private IExternalProviderService _service;
private IMapper _mapper;
// private IMapper _mapper;
// GET
public TestController(IMapper mapper, IExternalProviderService 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);
// // GET
// public TestController(IMapper mapper, IExternalProviderService 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 Ok(tournaments);
// }
return null;
}
// return null;
// }
}
}
// }
//}

View File

@@ -25,9 +25,11 @@ namespace LaDOSE.Api.Controllers
_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.
[HttpPost("GetTournaments")]
public async Task<List<TournamentDTO>> GetChallonges([FromBody] TimeRangeDTO dto)
{
@@ -48,14 +50,36 @@ namespace LaDOSE.Api.Controllers
throw new Exception("Invalid arguments");
}
var test = await _service.GetChallongeEvents(ids);
//var tournamentsResult = await _service.GetTournamentsResult(ids);
return _mapper.Map<TournamentsResultDTO>(new TournamentsResultDTO());
var test = await _service.GetEventsResult(ids);
return _mapper.Map<TournamentsResultDTO>(test);
}
[HttpGet("ParseSmash/{tournamentSlug}")]
public async Task<bool> AddSmashTournament(string tournamentSlug)
{
if (!String.IsNullOrEmpty(tournamentSlug))
{
var smash = await _service.ParseSmash(tournamentSlug);
//var tournaments = await _service.GetSmashResult2(tournamentSlug);
return smash != null;
//return Ok(tournaments);
}
return false;
}
[HttpPost("ParseChallonge")]
public async Task<bool> ParseChallonge([FromBody] List<int> ids)
{
if (ids != null)
{
var tournaments = await _service.ParseChallonge(ids);
return tournaments.Count>0;
}
return false;
}
}
}