using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Auth;
using GxPress.Entity;
using GxPress.Repository.Interface;
using GxPress.Request.ArticleGroup;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace GxPress.Api.AppControllers
{
    /// <summary>
    /// 文章组
    /// </summary>
    [Route("api/app/article-group")]
    [ApiController]
    [Authorize]
    public class ArticleGroupController : Controller
    {
        private readonly IArticleGroupRepository _processGroupRepository;
        private readonly ILoginContext _loginContext;
        public ArticleGroupController(IArticleGroupRepository processGroupRepository, ILoginContext loginContext)
        {
            
            _processGroupRepository = processGroupRepository;
            _loginContext = loginContext;
        }
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("list")]
        public async Task<IEnumerable<ArticleGroup>> GetList()
        {
            return await _processGroupRepository.GetListAsync(_loginContext.AccountId);
        }
    }
}