Skip to content

Commit 6e9f5cd

Browse files
committed
Decrypting support added
1 parent 433ca4a commit 6e9f5cd

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/GridifyExtensions/Extensions/QueryableExtensions.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static async Task<PagedResponse<TEntity>> GetPagedAsync<TEntity>(this IQu
6363
}
6464

6565
public static async Task<PagedResponse<object>> ColumnDistinctValuesAsync<TEntity>(this IQueryable<TEntity> query,
66-
ColumnDistinctValueQueryModel model,
66+
ColumnDistinctValueQueryModel model, Func<byte[], string>? decryptor = default,
6767
CancellationToken cancellationToken = default)
6868
{
6969
var mapper = EntityGridifyMapperByType[typeof(TEntity)] as GridifyMapper<TEntity>;
@@ -83,8 +83,15 @@ public static async Task<PagedResponse<object>> ColumnDistinctValuesAsync<TEntit
8383
.Select(CreateSelector<TEntity>(model.PropertyName))
8484
.FirstOrDefaultAsync(cancellationToken);
8585

86-
return new PagedResponse<object>(item == null ? [] : [item], 1, 1, 1);
86+
if (item is null)
87+
{
88+
return new PagedResponse<object>([], 1, 1, 0);
89+
}
90+
91+
var decryptedItem = decryptor!((byte[])item);
92+
return new PagedResponse<object>([decryptedItem], 1, 1, 1);
8793
}
94+
8895
private static Expression<Func<T, object>> CreateSelector<T>(string propertyName)
8996
{
9097
var parameter = Expression.Parameter(typeof(T), "x");

src/GridifyExtensions/GridifyExtensions.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<PackageReadmeFile>Readme.md</PackageReadmeFile>
99
<Authors>Pandatech</Authors>
1010
<Copyright>MIT</Copyright>
11-
<Version>1.0.7</Version>
11+
<Version>1.0.8</Version>
1212
<PackageId>Pandatech.GridifyExtensions</PackageId>
1313
<Title>Pandatech.Gridify.Extensions</Title>
1414
<PackageTags>Pandatech, library, Gridify, Pagination, Filters</PackageTags>
1515
<Description>Pandatech.Gridify.Extensions simplifies and extends the functionality of the Gridify NuGet package. It provides additional extension methods and functionality to streamline data filtering and pagination, making it more intuitive and powerful to use in .NET applications. Our enhancements ensure more flexibility, reduce boilerplate code, and improve overall developer productivity when working with Gridify.</Description>
1616
<RepositoryUrl>https://github.com/PandaTechAM/be-lib-gridify-extensions</RepositoryUrl>
17-
<PackageReleaseNotes>Pagination fix</PackageReleaseNotes>
17+
<PackageReleaseNotes>Decrypting support added</PackageReleaseNotes>
1818
</PropertyGroup>
1919

2020
<ItemGroup>

0 commit comments

Comments
 (0)