Skip to content

Commit

Permalink
feat: update file-management file repository
Browse files Browse the repository at this point in the history
can get file list by ids
  • Loading branch information
jxnkwlp committed Sep 18, 2023
1 parent 39678f4 commit 7cdab75
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 47 deletions.
23 changes: 21 additions & 2 deletions modules/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>abp, abp-module</PackageTags>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand All @@ -29,8 +31,25 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3"
PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Roslynator.Analyzers" Version="4.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="NoWarnOnRazorViewImportedTypeConflicts" BeforeTargets="RazorCoreCompile">
Expand Down
2 changes: 1 addition & 1 deletion modules/file-management/src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Product>Passingwind.Abp.FileManagement</Product>
<Description>an abp module that provider file and file container management.</Description>
<Version>0.1.0</Version>
<PackageVersion>0.1.9</PackageVersion>
<PackageVersion>0.1.10</PackageVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public interface IFileRepository : IRepository<File, Guid>

Task<List<File>> GetPagedListAsync(int skipCount, int maxResultCount, string? filter = null, Guid? containerId = null, Guid? parentId = null, bool? isDirectory = null, string? sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default);

Task<List<File>> GetListByIdsAsync(IEnumerable<Guid> ids, bool includeDetails = false, CancellationToken cancellationToken = default);

Task<bool> IsFileNameExistsAsync(Guid containerId, string fileName, Guid? parentId = null, CancellationToken cancellationToken = default);

Task<File?> FindByNameAsync(Guid containerId, string fileName, Guid? parentId = null, CancellationToken cancellationToken = default);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ public class FileManagementEntityFrameworkCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<FileManagementDbContext>(options =>
{
/* Add custom repositories here. Example:
* options.AddRepository<Question, EfCoreQuestionRepository>();
*/
});
context.Services.AddAbpDbContext<FileManagementDbContext>(options => options.AddDefaultRepositories());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ namespace Passingwind.Abp.FileManagement.EntityFrameworkCore;
[ConnectionStringName(FileManagementDbProperties.ConnectionStringName)]
public interface IFileManagementDbContext : IEfCoreDbContext
{
/* Add DbSet for each Aggregate Root here. Example:
* DbSet<Question> Questions { get; }
*/

DbSet<FileContainer> FileContainers { get; }
DbSet<File> Files { get; }
DbSet<FileAccessToken> FileAccessTokens { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public virtual async Task<List<File>> GetListAsync(string? filter = null, Guid?
.ToListAsync(cancellationToken);
}

public async Task<List<File>> GetListByIdsAsync(IEnumerable<Guid> ids, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var dbset = await GetDbSetAsync();
return await dbset.Where(x => ids.Contains(x.Id)).ToListAsync(cancellationToken);
}

public virtual async Task<List<File>> GetPagedListAsync(int skipCount, int maxResultCount, string? filter = null, Guid? containerId = null, Guid? parentId = null, bool? isDirectory = null, string? sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var dbset = await GetDbSetAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
FileManagementRemoteServiceConsts.RemoteServiceName
);

Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<FileManagementHttpApiClientModule>();
});

Configure<AbpVirtualFileSystemOptions>(options => options.FileSets.AddEmbedded<FileManagementHttpApiClientModule>());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ public class FileManagementMongoDbModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddMongoDbContext<FileManagementMongoDbContext>(options =>
{
/* Add custom repositories here. Example:
* options.AddRepository<Question, MongoQuestionRepository>();
*/
});
context.Services.AddMongoDbContext<FileManagementMongoDbContext>(options => options.AddDefaultRepositories());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ public async Task<List<File>> GetListAsync(string? filter = null, Guid? containe
.ToListAsync(cancellationToken);
}

public async Task<List<File>> GetListByIdsAsync(IEnumerable<Guid> ids, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var query = await GetMongoQueryableAsync();

return await query.Where(x => ids.Contains(x.Id)).ToListAsync(cancellationToken);
}

public async Task<List<File>> GetPagedListAsync(int skipCount, int maxResultCount, string? filter = null, Guid? containerId = null, Guid? parentId = null, bool? isDirectory = null, string? sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var query = await GetMongoQueryableAsync();
Expand Down

0 comments on commit 7cdab75

Please sign in to comment.