Skip to content

Commit

Permalink
Merge pull request #98 from EasyAbp/v4
Browse files Browse the repository at this point in the history
Decouple with the ABP BLOB storing module
  • Loading branch information
gdlcf88 committed Oct 14, 2023
2 parents 97713aa + c863f83 commit fb9c3cf
Show file tree
Hide file tree
Showing 67 changed files with 1,104 additions and 695 deletions.
7 changes: 7 additions & 0 deletions EasyAbp.FileManagement.sln
Expand Up @@ -59,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.FileManagement.Blaz
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.FileManagement.Blazor.WebAssembly", "src\EasyAbp.FileManagement.Blazor.WebAssembly\EasyAbp.FileManagement.Blazor.WebAssembly.csproj", "{9D060D93-B97D-4640-9770-6B507F97C295}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.FileManagement.Domain.Core", "src\EasyAbp.FileManagement.Domain.Core\EasyAbp.FileManagement.Domain.Core.csproj", "{1CB06CFE-6095-43E1-A624-3A42739ED575}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -165,6 +167,10 @@ Global
{9D060D93-B97D-4640-9770-6B507F97C295}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D060D93-B97D-4640-9770-6B507F97C295}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D060D93-B97D-4640-9770-6B507F97C295}.Release|Any CPU.Build.0 = Release|Any CPU
{1CB06CFE-6095-43E1-A624-3A42739ED575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1CB06CFE-6095-43E1-A624-3A42739ED575}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CB06CFE-6095-43E1-A624-3A42739ED575}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1CB06CFE-6095-43E1-A624-3A42739ED575}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -195,6 +201,7 @@ Global
{FF70CED3-39D6-42BA-83B4-C11478153993} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{2553DA49-445E-4911-B40E-109CE3815AEB} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{9D060D93-B97D-4640-9770-6B507F97C295} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{1CB06CFE-6095-43E1-A624-3A42739ED575} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}
Expand Down
2 changes: 1 addition & 1 deletion common.props
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>3.0.1</Version>
<Version>4.0.0-preview.1</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
Expand Down
Expand Up @@ -66,7 +66,7 @@ public class BasicFileOperationAuthorizationHandler : FileOperationAuthorization

await SetSucceedIfUserIsManagerAsync(context, requirement);

var configuration = _configurationProvider.Get(resource.FileContainerName);
var configuration = _configurationProvider.Get<FileContainerConfiguration>(resource.FileContainerName);

await SetFailIfUserIsNotPersonalContainerOwnerAsync(configuration, context, resource);
}
Expand Down

Large diffs are not rendered by default.

@@ -1,15 +1,41 @@
using System;
using JetBrains.Annotations;

namespace EasyAbp.FileManagement.Files
{
public class FileOperationInfoModel
{
public Guid? ParentId { get; set; }


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


[CanBeNull]
public string FileName { get; set; }

[CanBeNull]
public string MimeType { get; set; }

public FileType? FileType { get; set; }

public long? ByteSize { get; set; }

public Guid? OwnerUserId { get; set; }


[CanBeNull]
public File File { get; set; }

public FileOperationInfoModel(Guid? parentId, [NotNull] string fileContainerName, [CanBeNull] string fileName,
[CanBeNull] string mimeType, FileType? fileType, long? byteSize, Guid? ownerUserId, [CanBeNull] File file)
{
ParentId = parentId;
FileContainerName = fileContainerName;
FileName = fileName;
MimeType = mimeType;
FileType = fileType;
ByteSize = byteSize;
OwnerUserId = ownerUserId;
File = file;
}
}
}

This file was deleted.

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace />
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="EasyAbp.FileManagement.Domain" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="$(AbpVersion)" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="$(AbpVersion)" />
<ProjectReference Include="..\EasyAbp.FileManagement.Domain.Shared\EasyAbp.FileManagement.Domain.Shared.csproj" />
</ItemGroup>

</Project>
@@ -0,0 +1,36 @@
using EasyAbp.FileManagement.Files;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Domain;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.Modularity;

namespace EasyAbp.FileManagement
{
[DependsOn(
typeof(FileManagementDomainSharedModule),
typeof(AbpAutoMapperModule),
typeof(AbpDddDomainModule)
)]
public class FileManagementDomainCoreModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpDistributedEntityEventOptions>(options =>
{
options.EtoMappings.Add<File, FileEto>(typeof(FileManagementDomainCoreModule));
options.AutoEventSelectors.Add<File>();
});
}

public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<FileManagementDomainCoreModule>();

Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<FileManagementDomainAutoMapperProfile>(validate: true);
});
}
}
}
@@ -1,24 +1,20 @@
using System;
using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace EasyAbp.FileManagement.Files
{
public class File : FullAuditedAggregateRoot<Guid>, IMultiTenant
public class File : FullAuditedAggregateRoot<Guid>, IFile, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }

public virtual Guid? ParentId { get; protected set; }

[NotNull]
public virtual string FileContainerName { get; protected set; }

[NotNull]
public virtual string FileName { get; protected set; }

[CanBeNull]
public virtual string MimeType { get; protected set; }

public virtual FileType FileType { get; protected set; }
Expand All @@ -27,15 +23,12 @@ public class File : FullAuditedAggregateRoot<Guid>, IMultiTenant

public virtual long ByteSize { get; protected set; }

[CanBeNull]
public virtual string Hash { get; protected set; }

[CanBeNull]
public virtual string BlobName { get; protected set; }

public virtual Guid? OwnerUserId { get; protected set; }

[CanBeNull]
public virtual string Flag { get; protected set; }

protected File()
Expand Down
@@ -0,0 +1,13 @@
using Volo.Abp;

namespace EasyAbp.FileManagement.Files
{
public class FileContainerConflictException : BusinessException
{
public FileContainerConflictException() : base(
"FileContainerConflict",
$"Multiple file upload requests attempted to save files in the same file container.")
{
}
}
}
Expand Up @@ -2,9 +2,9 @@

namespace EasyAbp.FileManagement.Files
{
public class FileIsMovedToSubDirectoryException : BusinessException
public class FileIsMovingToSubDirectoryException : BusinessException
{
public FileIsMovedToSubDirectoryException() : base(
public FileIsMovingToSubDirectoryException() : base(
message: "A directory cannot be moved from a directory to one of its sub directories.")
{
}
Expand Down

0 comments on commit fb9c3cf

Please sign in to comment.