|
@@ -53,7 +53,7 @@ namespace Hotline.Api.Controllers
|
|
|
public async Task<PagedDto<CallDto>> GetCallList([FromQuery] GetCallListRequest request)
|
|
|
{
|
|
|
var (total, items) = await _callRepository.Queryable()
|
|
|
- .Includes(d=>d.CallDetails)
|
|
|
+ .Includes(d => d.CallDetails)
|
|
|
.WhereIF(!string.IsNullOrEmpty(request.PhoneNum), d => d.FromNo.Contains(request.PhoneNum!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(request.ToNum), d => d.ToNo.Contains(request.ToNum!))
|
|
|
.WhereIF(request.Direction is not null, d => d.CallDirection == request.Direction)
|
|
@@ -73,14 +73,14 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpGet("messed-paged")]
|
|
|
public async Task<PagedDto<CallDto>> GetCallListMissed([FromQuery] GetCallListRequest request)
|
|
|
{
|
|
|
- var(total, items) = await _callRepository.Queryable()
|
|
|
+ var (total, items) = await _callRepository.Queryable()
|
|
|
.Where(x => !x.CallDetails.Any(d => d.EventName == "ANSWERED"))
|
|
|
.WhereIF(!string.IsNullOrEmpty(request.PhoneNum), d => d.FromNo.Contains(request.PhoneNum!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(request.ToNum), d => d.ToNo.Contains(request.ToNum!))
|
|
|
.WhereIF(request.Direction is not null, d => d.CallDirection == request.Direction)
|
|
|
.Includes(d => d.CallDetails)
|
|
|
.OrderByDescending(d => d.CreationTime)
|
|
|
- .ToPagedListAsync(request.PageIndex,request.PageSize);
|
|
|
+ .ToPagedListAsync(request.PageIndex, request.PageSize);
|
|
|
return new PagedDto<CallDto>(total, _mapper.Map<IReadOnlyList<CallDto>>(items));
|
|
|
}
|
|
|
|
|
@@ -134,10 +134,7 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpPost("blacklist")]
|
|
|
public async Task AddBlacklist([FromBody] AddBlacklistDto dto)
|
|
|
{
|
|
|
- var exists = await _blacklistRepository.AnyAsync(d => d.PhoneNo == dto.PhoneNo);
|
|
|
- if (exists) return;
|
|
|
- var blacklist = _mapper.Map<Blacklist>(dto);
|
|
|
- await _blacklistDomainService.AddAsync(blacklist, HttpContext.RequestAborted);
|
|
|
+ await _blacklistDomainService.AddAsync(dto, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -148,7 +145,7 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpDelete("blacklist/{phone}")]
|
|
|
public void RemoveBlacklist(string phone)
|
|
|
{
|
|
|
- _blacklistDomainService.Remove(phone);
|
|
|
+ _blacklistDomainService.RemoveAsync(phone);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|