Skip to content

Commit

Permalink
Merge pull request #121 from EasyAbp/file-filter
Browse files Browse the repository at this point in the history
Add `GetFileListInput.Filter` property
  • Loading branch information
gdlcf88 committed Jan 5, 2024
2 parents 78008b6 + 59ae443 commit 3d26acc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common.props
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>5.2.0-preview.1</Version>
<Version>5.2.0-preview.2</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
Expand Down
Expand Up @@ -7,12 +7,14 @@ namespace EasyAbp.FileManagement.Files.Dtos
public class GetFileListInput : PagedAndSortedResultRequestDto
{
public Guid? ParentId { get; set; }

[Required]
public string FileContainerName { get; set; }

public Guid? OwnerUserId { get; set; }

public bool DirectoryOnly { get; set; }

public string Filter { get; set; }
}
}
Expand Up @@ -152,7 +152,8 @@ protected override async Task<IQueryable<File>> CreateFilteredQueryAsync(GetFile
return (await _repository.GetQueryableAsync())
.Where(x => x.ParentId == input.ParentId && x.OwnerUserId == input.OwnerUserId &&
x.FileContainerName == input.FileContainerName)
.WhereIf(input.DirectoryOnly, x => x.FileType == FileType.Directory);
.WhereIf(input.DirectoryOnly, x => x.FileType == FileType.Directory)
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.FileName.Contains(input.Filter));
}

[Authorize]
Expand Down

0 comments on commit 3d26acc

Please sign in to comment.