2023-02-17 00:38:01 +08:00
|
|
|
|
using Application.Api;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2023-02-18 01:29:20 +08:00
|
|
|
|
using Shared.Dto.Api;
|
|
|
|
|
using Shared.Models;
|
2023-02-17 00:38:01 +08:00
|
|
|
|
|
|
|
|
|
namespace MainServer.Controllers.API;
|
|
|
|
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
public class ProfilesController : BaseController<ProfilesController>
|
|
|
|
|
{
|
|
|
|
|
[HttpGet]
|
2023-02-21 22:45:51 +08:00
|
|
|
|
public async Task<ServiceResult<List<ClientCardDto>>> GetAllCards()
|
2023-02-17 00:38:01 +08:00
|
|
|
|
{
|
|
|
|
|
var result = await Mediator.Send(new GetCardsQuery());
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-22 02:55:32 +08:00
|
|
|
|
[HttpGet("TotalResult/{cardId:long}")]
|
2023-02-21 22:45:51 +08:00
|
|
|
|
public async Task<ServiceResult<TotalResultData>> GetCardTotalResultById(long cardId)
|
2023-02-17 00:38:01 +08:00
|
|
|
|
{
|
|
|
|
|
var result = await Mediator.Send(new GetTotalResultQuery(cardId));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-23 00:35:59 +08:00
|
|
|
|
[HttpGet("SongPlayRecords/{cardId:long}")]
|
|
|
|
|
public async Task<ServiceResult<List<SongPlayRecord>>> GetSongPlayRecords(long cardId)
|
|
|
|
|
{
|
|
|
|
|
var result = await Mediator.Send(new GetSongPlayRecordsQuery(cardId));
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost("SetFavorite")]
|
2023-02-22 02:55:32 +08:00
|
|
|
|
public async Task<ServiceResult<bool>> SetFavoriteMusic(MusicFavoriteDto favorite)
|
2023-02-17 00:38:01 +08:00
|
|
|
|
{
|
2023-02-22 02:55:32 +08:00
|
|
|
|
var result = await Mediator.Send(new SetFavoriteMusicCommand(favorite));
|
2023-02-17 00:38:01 +08:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost("PlayerName")]
|
2023-02-21 22:45:51 +08:00
|
|
|
|
public async Task<ServiceResult<bool>> SetPlayerName(ClientCardDto card)
|
2023-02-17 00:38:01 +08:00
|
|
|
|
{
|
|
|
|
|
var result = await Mediator.Send(new SetPlayerNameCommand(card));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2023-02-22 02:55:32 +08:00
|
|
|
|
|
|
|
|
|
[HttpPost("UnlockAllMusic/{cardId:long}")]
|
|
|
|
|
public async Task<ServiceResult<bool>> UnlockAllMusic(long cardId)
|
|
|
|
|
{
|
|
|
|
|
var result = await Mediator.Send(new UnlockAllMusicCommand(cardId));
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2023-02-17 00:38:01 +08:00
|
|
|
|
}
|