using System.Threading.Tasks;
using GxPress.Auth;
using GxPress.Repository.Interface;
using GxPress.Request.AddressBookGroupUser;
using GxPress.Result.AddressBookGroupUser;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace GxPress.Api.AppControllers
{
///
/// 通讯录用户信息
///
[Route("api/app/address-book-group-user")]
[ApiController]
[Authorize]
public class AddressBookGroupUserController : ControllerBase
{
private readonly ILogger _logger;
private readonly IAddressBookGroupUserRepository _addressBookGroupUserRepository;
private readonly ILoginContext _loginContext;
public AddressBookGroupUserController(ILogger logger, IAddressBookGroupUserRepository addressBookGroupUserRepository, ILoginContext loginContext)
{
_logger = logger;
_addressBookGroupUserRepository = addressBookGroupUserRepository;
_loginContext = loginContext;
}
///
/// 删除
///
///
///
[HttpDelete("{id}")]
public async Task Delete(int id)
{
return await _addressBookGroupUserRepository.DeleteAsync(id);
}
///
/// 删除自建分组用户
///
///
[HttpPost("delete")]
public async Task Deletes(AddressBookGroupUserDeleteRequest request)
{
return await _addressBookGroupUserRepository.DeletesAsync(request.Ids);
}
///
/// 获取
///
///
///
[HttpPost("list")]
public async Task GetAddressBookGroupUserList(
AddressBookGroupUserSearchRequest request)
{
var userId = _loginContext.AccountId;
return await _addressBookGroupUserRepository.GetAddressBookGroupUserListAsync(request, userId);
}
///
/// 添加
///
///
///
[HttpPost("add")]
public async Task Insert(AddressBookGroupUserInRequest request)
{
return await _addressBookGroupUserRepository.InsertAsync(request);
}
///
/// 移动分组成员
///
/// ///
///
[HttpPost("move")]
public async Task AddressBookGroupUserMove(AddressBookGroupUserMoveRequest request)
{
return await _addressBookGroupUserRepository.AddressBookGroupUserMoveAsync(request);
}
}
}