1
0
mirror of synced 2025-03-02 16:23:27 +01:00

55 lines
1.6 KiB
C#
Raw Normal View History

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;
}
[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;
}
[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")]
public async Task<ServiceResult<bool>> SetFavoriteMusic(MusicFavoriteDto favorite)
2023-02-17 00:38:01 +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;
}
[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
}