using System.Threading.Tasks; using GxPress.Auth; using GxPress.Common.Page; using GxPress.Entity.WaitHandle; using GxPress.Request.App.WaitHandle; using GxPress.Result.App.WaitHandle; using GxPress.Service.Interface.WaitHandle; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AppControllers { /// /// 待办事项 /// [Route("api/app/wait-handle")] [ApiController] [Authorize] public class WaitHandleController : ControllerBase { private readonly IWaitHandleService _waitHandleService; private readonly ILoginContext _loginContext; public WaitHandleController(IWaitHandleService waitHandleService, ILoginContext loginContext) { _waitHandleService = waitHandleService; _loginContext = loginContext; } /// /// 添加修改待办事项 /// /// /// [HttpPut("add-update")] public async Task AddOrUpdateWaitHandleAsync(WaitHandleAddOrUpdateRequest request) { request.UserId = _loginContext.AccountId; return await _waitHandleService.AddOrUpdateWaitHandleAsync(request); } /// /// 删除待办事项 /// /// [HttpDelete("delete")] public async Task DeleteWaitHandleAsync(DeleteWaitHandleRequest request) { return await _waitHandleService.DeleteWaitHandleAsync(request); } /// /// 待办搜索 Sort :hand 手动 time按时间 label 标签 level 优先级 /// /// /// [HttpPost("page")] public async Task> PageWaitHandleAsync(PageWaitHandleRequest request) { request.UserId = _loginContext.AccountId; return await _waitHandleService.PageWaitHandleAsync(request); } /// /// 添加修改标签 /// /// /// [HttpPut("add-update-label")] public async Task AddOrUpdateWaitHandleLabelAsync(WaitHandleLabelAddOrUpdateRequest request) { request.UserId = _loginContext.AccountId; return await _waitHandleService.AddOrUpdateWaitHandleLabelAsync(request); } /// /// 删除标签 /// /// /// [HttpDelete("delete-label")] public async Task DeleteWaitHandleLabelAsync(DeleteWaitHandleRequest request) { return await _waitHandleService.DeleteWaitHandleLabelAsync(request); } /// /// 标签 /// /// /// [HttpPost("page-label")] public async Task> PageWaitHandleLabelAsync( PageWaitHandleRequest request) { request.UserId = _loginContext.AccountId; return await _waitHandleService.PageWaitHandleLabelAsync(request); } /// /// 待办搜索 1 手动 2 按时间 3 标签 4 优先级 /// /// /// [HttpPost("list")] public async Task WaitHandleListAsync(ListWaitHandleRequest request) { request.UserId = _loginContext.AccountId; return await _waitHandleService.WaitHandleListAsync(request); } /// /// 设置待办事项 /// /// /// [HttpPut("set/{id}")] public async Task IsFinishAsync(int id) { return await _waitHandleService.IsFinishAsync(id); } } }