using System.Collections.Generic; using System.Threading.Tasks; using GxPress.Auth; using GxPress.Repository.Interface; using GxPress.Request.ArticleGroupUser; using GxPress.Result.ArticleGroupUser; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AppControllers { /// /// 我的频道 /// [Route("api/app/article-group-user")] [ApiController] [Authorize] public class ArticleGroupUserController : ControllerBase { private readonly IArticleGroupUserRepository _articleGroupUserRepository; private readonly ILoginContext _loginContext; public ArticleGroupUserController(IArticleGroupUserRepository articleGroupUserRepository,ILoginContext loginContext) { _articleGroupUserRepository = articleGroupUserRepository; _loginContext = loginContext; } /// /// 删除 /// /// /// [HttpDelete("{id}")] public async Task Delete(int id) { return await _articleGroupUserRepository.DeleteAsync(id); } /// /// 添加 /// /// /// [HttpPost("add")] public async Task Add([FromBody]ArticleGroupUserInRequest request) { request.UserId = _loginContext.AccountId; return await _articleGroupUserRepository.InsertAsync(request)>0; } /// /// 获取用户的频道 /// /// /// [HttpPost("list")] public async Task> GetArticleGroupUserListByUserId( [FromBody] ArticleGroupUserSearchRequest request) { request.UserId = _loginContext.AccountId; return await _articleGroupUserRepository.GetListAsync(request); } } }