using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Auth;
using GxPress.Repository.Interface;
using GxPress.Request.App.Middle;
using GxPress.Request.NoticeFolder;
using GxPress.Result.NoticeFolder;
using GxPress.Service.Interface.Middle;
using Microsoft.AspNetCore.Mvc;
namespace GxPress.Api.AppControllers
{
///
/// 通知文件夹
///
[Route("api/app/notice-folder")]
[ApiController]
public class NoticeFolderController : ControllerBase
{
private readonly INoticeFolderRepository _noticeFolderRepository;
private readonly ILoginContext _loginContext;
private readonly IMiddleService _middleService;
public NoticeFolderController(INoticeFolderRepository noticeFolderRepository, ILoginContext loginContext,
IMiddleService middleService)
{
_noticeFolderRepository = noticeFolderRepository;
_loginContext = loginContext;
_middleService = middleService;
}
///
/// 创建通知文件夹
///
///
///
[HttpPut("add")]
public async Task Insert(NoticeFolderInRequest request)
{
request.UserId = _loginContext.AccountId;
var middleInsertRequest = new MiddleInsertRequest
{
FolderName = request.FolderName,
FolderType = 1,
ParentId = request.ParentId,
UserId = request.UserId
};
return await _middleService.InsertAsync(middleInsertRequest) > 0;
}
/////
///// 删除通知文件夹
/////
/////
/////
//[HttpDelete("{id}")]
//public async Task Delete(int id)
//{
// return await _noticeFolderRepository.DeleteAsync(id);
//}
/////
///// 修改通知文件夹
/////
/////
/////
//[HttpPost("update")]
//public async Task Update(NoticeFolderUpRequest request)
//{
// return await _noticeFolderRepository.UpdateAsync(request);
//}
/////
///// 插入通知文件夹
/////
/////
/////
//[HttpPost("add-notice")]
//public async Task InsertNotice(NoticeFolderInNoticeRequest request)
//{
// return await _noticeFolderRepository.InsertNoticeAsync(request);
//}
/////
///// 文件夹移除通知
/////
/////
/////
//[HttpPost("remove-notice")]
//public async Task NoticeFolderDeleteNotice(NoticeFolderDeleteNoticeRequest request)
//{
// return await _noticeFolderRepository.NoticeFolderDeleteNoticeAsync(request);
//}
///
/// 获取通知文件夹
///
///
[HttpPost("find")]
public async Task> GetNoticeFolderByUserId(NoticeFolderFindRequest request)
{
request.UserId = _loginContext.AccountId;
return await _noticeFolderRepository.GetNoticeFolderByUserIdAsync(request);
}
/////
///// 设置文件夹置顶
/////
/////
/////
//[HttpPost("set-is-top")]
//public async Task SetNoticeFolderIsTop(NoticeFolderFindRequest request)
//{
// return await _noticeFolderRepository.SetNoticeFolderIsTopAsync(request);
//}
}
}