Smart Filter Encoding Fix (#2387)

This commit is contained in:
Joe Milazzo 2023-11-02 08:35:43 -05:00 committed by GitHub
parent b6d4938e22
commit 9894a2623c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
133 changed files with 677 additions and 471 deletions

View file

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using API.Constants;
using API.Data;
using API.Data.Repositories;
using API.DTOs.Dashboard;
@ -10,23 +9,22 @@ using API.DTOs.Filtering.v2;
using API.Entities;
using API.Extensions;
using API.Helpers;
using EasyCaching.Core;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers;
#nullable enable
/// <summary>
/// This is responsible for Filter caching
/// </summary>
public class FilterController : BaseApiController
{
private readonly IUnitOfWork _unitOfWork;
private readonly IEasyCachingProviderFactory _cacheFactory;
public FilterController(IUnitOfWork unitOfWork, IEasyCachingProviderFactory cacheFactory)
public FilterController(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
_cacheFactory = cacheFactory;
}
/// <summary>
@ -93,4 +91,26 @@ public class FilterController : BaseApiController
await _unitOfWork.CommitAsync();
return Ok();
}
/// <summary>
/// Encode the Filter
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("encode")]
public ActionResult<string> EncodeFilter(FilterV2Dto dto)
{
return Ok(SmartFilterHelper.Encode(dto));
}
/// <summary>
/// Decodes the Filter
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("decode")]
public ActionResult<FilterV2Dto> DecodeFilter(DecodeFilterDto dto)
{
return Ok(SmartFilterHelper.Decode(dto.EncodedFilter));
}
}