mirror of https://github.com/abpframework/abp.git
committed by
GitHub
113 changed files with 1560 additions and 1711 deletions
@ -0,0 +1,15 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Docs.Admin.Projects; |
||||
|
using Volo.Docs.Common.Documents; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.Documents; |
||||
|
|
||||
|
public interface IDocumentPdfAdminAppService : IDocumentPdfAppService |
||||
|
{ |
||||
|
Task GeneratePdfAsync(DocumentPdfGeneratorInput input); |
||||
|
|
||||
|
Task<PagedResultDto<ProjectPdfFileDto>> GetPdfFilesAsync(GetPdfFilesInput input); |
||||
|
|
||||
|
Task DeletePdfFileAsync(DeletePdfFileInput input); |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Volo.Abp.BackgroundJobs; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Volo.Docs.Projects; |
||||
|
using Volo.Docs.Projects.Pdf; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.BackgroundJobs; |
||||
|
|
||||
|
public class DocumentPdfGenerateJob : AsyncBackgroundJob<DocumentPdfGenerateJobArgs>, ITransientDependency |
||||
|
{ |
||||
|
protected IProjectPdfGenerator ProjectPdfGenerator { get; } |
||||
|
protected IProjectRepository ProjectRepository { get; } |
||||
|
|
||||
|
protected IUnitOfWorkManager UnitOfWorkManager { get; } |
||||
|
|
||||
|
public DocumentPdfGenerateJob(IProjectPdfGenerator projectPdfGenerator, IProjectRepository projectRepository, IUnitOfWorkManager unitOfWorkManager) |
||||
|
{ |
||||
|
ProjectPdfGenerator = projectPdfGenerator; |
||||
|
ProjectRepository = projectRepository; |
||||
|
UnitOfWorkManager = unitOfWorkManager; |
||||
|
} |
||||
|
|
||||
|
public async override Task ExecuteAsync(DocumentPdfGenerateJobArgs args) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
Logger.LogInformation("Generating PDF for project {ProjectId}, version {Version}, language {LanguageCode}", args.ProjectId, args.Version, args.LanguageCode); |
||||
|
using var uow = UnitOfWorkManager.Begin(requiresNew: true); |
||||
|
var project = await ProjectRepository.GetAsync(args.ProjectId, includeDetails: true); |
||||
|
await ProjectPdfGenerator.GenerateAsync(project, args.Version, args.LanguageCode); |
||||
|
await uow.CompleteAsync(); |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
Logger.LogError(e, "Error while generating PDF for project {ProjectId}, version {Version}, language {LanguageCode}", args.ProjectId, args.Version, args.LanguageCode); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.BackgroundJobs; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.BackgroundJobs; |
||||
|
|
||||
|
public class DocumentPdfGenerateJobArgs |
||||
|
{ |
||||
|
public Guid ProjectId { get; set; } |
||||
|
|
||||
|
public string Version { get; set; } |
||||
|
|
||||
|
public string LanguageCode { get; set; } |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.BackgroundJobs; |
||||
|
using Volo.Abp.DistributedLocking; |
||||
|
using Volo.Docs.Admin.BackgroundJobs; |
||||
|
using Volo.Docs.Admin.Projects; |
||||
|
using Volo.Docs.Common.Documents; |
||||
|
using Volo.Docs.Projects; |
||||
|
using Volo.Docs.Projects.Pdf; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.Documents; |
||||
|
|
||||
|
[Authorize(DocsAdminPermissions.Projects.ManagePdfFiles)] |
||||
|
public class DocumentPdfAdminAppService : DocumentPdfAppService, IDocumentPdfAdminAppService |
||||
|
{ |
||||
|
protected IBackgroundJobManager BackgroundJobManager { get; } |
||||
|
protected IAbpDistributedLock DistributedLock { get; } |
||||
|
|
||||
|
public DocumentPdfAdminAppService( |
||||
|
IProjectPdfGenerator projectPdfGenerator, |
||||
|
IProjectRepository projectRepository, |
||||
|
IProjectPdfFileStore projectPdfFileStore, |
||||
|
IOptions<DocsProjectPdfGeneratorOptions> options, |
||||
|
IBackgroundJobManager backgroundJobManager, |
||||
|
IAbpDistributedLock distributedLock) : |
||||
|
base(projectPdfGenerator, projectRepository, projectPdfFileStore, options) |
||||
|
{ |
||||
|
BackgroundJobManager = backgroundJobManager; |
||||
|
DistributedLock = distributedLock; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task GeneratePdfAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
var project = await ProjectRepository.GetAsync(input.ProjectId, includeDetails: true); |
||||
|
await BackgroundJobManager.EnqueueAsync(new DocumentPdfGenerateJobArgs |
||||
|
{ |
||||
|
Version = project.GetFullVersion(input.Version), |
||||
|
LanguageCode = input.LanguageCode, |
||||
|
ProjectId = input.ProjectId, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<PagedResultDto<ProjectPdfFileDto>> GetPdfFilesAsync(GetPdfFilesInput input) |
||||
|
{ |
||||
|
var project = await ProjectRepository.GetAsync(input.ProjectId, includeDetails: true); |
||||
|
|
||||
|
var pdfFiles = project.PdfFiles.Skip(input.SkipCount).Take(input.MaxResultCount).ToList(); |
||||
|
|
||||
|
return new PagedResultDto<ProjectPdfFileDto>( |
||||
|
project.PdfFiles.Count, |
||||
|
ObjectMapper.Map<List<ProjectPdfFile>, List<ProjectPdfFileDto>>(pdfFiles) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeletePdfFileAsync(DeletePdfFileInput input) |
||||
|
{ |
||||
|
var project = await ProjectRepository.GetAsync(input.ProjectId, includeDetails: true); |
||||
|
await ProjectPdfFileStore.DeleteAsync(project, input.Version, input.LanguageCode); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Content; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Http.Client.ClientProxying; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
using Volo.Docs.Admin.Projects; |
||||
|
using Volo.Docs.Common.Documents; |
||||
|
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace Volo.Docs.Admin; |
||||
|
|
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
[ExposeServices(typeof(IDocumentPdfAppService), typeof(DocumentPdfAdminClientProxy))] |
||||
|
public partial class DocumentPdfAdminClientProxy : ClientProxyBase<IDocumentPdfAppService>, IDocumentPdfAppService |
||||
|
{ |
||||
|
public virtual async Task GeneratePdfAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
await RequestAsync(nameof(GeneratePdfAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(DocumentPdfGeneratorInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<PagedResultDto<ProjectPdfFileDto>> GetPdfFilesAsync(GetPdfFilesInput input) |
||||
|
{ |
||||
|
return await RequestAsync<PagedResultDto<ProjectPdfFileDto>>(nameof(GetPdfFilesAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(GetPdfFilesInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeletePdfFileAsync(DeletePdfFileInput input) |
||||
|
{ |
||||
|
await RequestAsync(nameof(DeletePdfFileAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(DeletePdfFileInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<IRemoteStreamContent> DownloadPdfAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
return await RequestAsync<IRemoteStreamContent>(nameof(DownloadPdfAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(DocumentPdfGeneratorInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<bool> ExistsAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
return await RequestAsync<bool>(nameof(ExistsAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(DocumentPdfGeneratorInput), input } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of DocumentPdfAdminClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace Volo.Docs.Admin; |
||||
|
|
||||
|
public partial class DocumentPdfAdminClientProxy |
||||
|
{ |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,60 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Asp.Versioning; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Content; |
||||
|
using Volo.Docs.Admin.Documents; |
||||
|
using Volo.Docs.Admin.Projects; |
||||
|
using Volo.Docs.Common.Documents; |
||||
|
|
||||
|
namespace Volo.Docs.Admin; |
||||
|
[RemoteService(Name = DocsAdminRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area(DocsAdminRemoteServiceConsts.ModuleName)] |
||||
|
[ControllerName("DocumentsPdfAdmin")] |
||||
|
[Route("api/docs/admin/documents/pdf")] |
||||
|
public class DocumentPdfAdminController : AbpControllerBase, IDocumentPdfAdminAppService |
||||
|
{ |
||||
|
private readonly IDocumentPdfAdminAppService _documentPdfAdminAppService; |
||||
|
|
||||
|
public DocumentPdfAdminController(IDocumentPdfAdminAppService documentPdfAdminAppService) |
||||
|
{ |
||||
|
_documentPdfAdminAppService = documentPdfAdminAppService; |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("generate")] |
||||
|
public Task GeneratePdfAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
return _documentPdfAdminAppService.GeneratePdfAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("files")] |
||||
|
public Task<PagedResultDto<ProjectPdfFileDto>> GetPdfFilesAsync(GetPdfFilesInput input) |
||||
|
{ |
||||
|
return _documentPdfAdminAppService.GetPdfFilesAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpDelete] |
||||
|
[Route("delete-file")] |
||||
|
public Task DeletePdfFileAsync(DeletePdfFileInput input) |
||||
|
{ |
||||
|
return _documentPdfAdminAppService.DeletePdfFileAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("download")] |
||||
|
public Task<IRemoteStreamContent> DownloadPdfAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
return _documentPdfAdminAppService.DownloadPdfAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("exists")] |
||||
|
public Task<bool> ExistsAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
return _documentPdfAdminAppService.ExistsAsync(input); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
{ |
||||
|
"role": "Volo.Docs.Application.Contracts" |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Content; |
||||
|
|
||||
|
namespace Volo.Docs.Common.Documents; |
||||
|
|
||||
|
public interface IDocumentPdfAppService : IApplicationService |
||||
|
{ |
||||
|
Task<IRemoteStreamContent> DownloadPdfAsync(DocumentPdfGeneratorInput input); |
||||
|
|
||||
|
Task<bool> ExistsAsync(DocumentPdfGeneratorInput input); |
||||
|
} |
||||
@ -1,10 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Application.Services; |
|
||||
using Volo.Abp.Content; |
|
||||
|
|
||||
namespace Volo.Docs.Common.Documents; |
|
||||
|
|
||||
public interface IDocumentPdfGeneratorAppService : IApplicationService |
|
||||
{ |
|
||||
Task<IRemoteStreamContent> GeneratePdfAsync(DocumentPdfGeneratorInput input); |
|
||||
} |
|
||||
@ -0,0 +1,3 @@ |
|||||
|
{ |
||||
|
"role": "Volo.Docs.Application" |
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Volo.Abp.Content; |
||||
|
using Volo.Abp.Http; |
||||
|
using Volo.Docs.Projects; |
||||
|
using Volo.Docs.Projects.Pdf; |
||||
|
|
||||
|
namespace Volo.Docs.Common.Documents; |
||||
|
|
||||
|
[Authorize(DocsCommonPermissions.Projects.PdfDownload)] |
||||
|
public class DocumentPdfAppService : DocsCommonAppServiceBase, IDocumentPdfAppService |
||||
|
{ |
||||
|
protected IProjectPdfGenerator ProjectPdfGenerator { get; } |
||||
|
protected IProjectRepository ProjectRepository { get; } |
||||
|
protected IProjectPdfFileStore ProjectPdfFileStore { get; } |
||||
|
protected IOptions<DocsProjectPdfGeneratorOptions> Options { get; } |
||||
|
|
||||
|
public DocumentPdfAppService( |
||||
|
IProjectPdfGenerator projectPdfGenerator, |
||||
|
IProjectRepository projectRepository, |
||||
|
IProjectPdfFileStore projectPdfFileStore, |
||||
|
IOptions<DocsProjectPdfGeneratorOptions> options) |
||||
|
{ |
||||
|
ProjectPdfGenerator = projectPdfGenerator; |
||||
|
ProjectRepository = projectRepository; |
||||
|
ProjectPdfFileStore = projectPdfFileStore; |
||||
|
Options = options; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<IRemoteStreamContent> DownloadPdfAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
var project = await ProjectRepository.GetAsync(input.ProjectId); |
||||
|
var version = project.GetFullVersion(input.Version); |
||||
|
var languageCode = input.LanguageCode; |
||||
|
var fileName = Options.Value.CalculatePdfFileName(project, version, languageCode); |
||||
|
var fileStream = await ProjectPdfFileStore.GetOrNullAsync(project, version, languageCode); |
||||
|
|
||||
|
if (fileStream != null) |
||||
|
{ |
||||
|
return new RemoteStreamContent(fileStream, fileName, MimeTypes.Application.Zip); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<bool> ExistsAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
var project = await ProjectRepository.GetAsync(input.ProjectId); |
||||
|
var version = project.GetFullVersion(input.Version); |
||||
|
var languageCode = input.LanguageCode; |
||||
|
var fileName = Options.Value.CalculatePdfFileName(project, version, languageCode); |
||||
|
return project.FindPdfFile(fileName) != null; |
||||
|
} |
||||
|
} |
||||
@ -1,52 +0,0 @@ |
|||||
using System.Text; |
|
||||
using System.Threading.Tasks; |
|
||||
using Microsoft.AspNetCore.Authorization; |
|
||||
using Volo.Abp.Application.Services; |
|
||||
using Volo.Abp.Content; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Docs.Projects; |
|
||||
using Volo.Docs.Projects.Pdf; |
|
||||
|
|
||||
namespace Volo.Docs.Common.Documents; |
|
||||
|
|
||||
[Authorize(DocsCommonPermissions.Projects.PdfGeneration)] |
|
||||
public class DocumentPdfGeneratorAppService : ApplicationService, IDocumentPdfGeneratorAppService |
|
||||
{ |
|
||||
protected IProjectPdfGenerator ProjectPdfGenerator { get; } |
|
||||
protected IProjectRepository ProjectRepository { get; } |
|
||||
|
|
||||
public DocumentPdfGeneratorAppService( |
|
||||
IProjectPdfGenerator projectPdfGenerator, |
|
||||
IProjectRepository projectRepository) |
|
||||
{ |
|
||||
ProjectPdfGenerator = projectPdfGenerator; |
|
||||
ProjectRepository = projectRepository; |
|
||||
} |
|
||||
|
|
||||
public virtual async Task<IRemoteStreamContent> GeneratePdfAsync(DocumentPdfGeneratorInput input) |
|
||||
{ |
|
||||
var project = await ProjectRepository.GetAsync(input.ProjectId, includeDetails: true); |
|
||||
|
|
||||
// https://github.com/abpframework/abp/blob/e96f601641ab8a4bb7d704d3b9df2c00517d96f6/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs#L73
|
|
||||
var inputVersionStringBuilder = new StringBuilder(); |
|
||||
input.Version = inputVersionStringBuilder.Append(GetProjectVersionPrefixIfExist(project)).Append(input.Version).ToString(); |
|
||||
return await ProjectPdfGenerator.GenerateAsync(project, input.Version, input.LanguageCode); |
|
||||
} |
|
||||
|
|
||||
private string GetProjectVersionPrefixIfExist(Project project) |
|
||||
{ |
|
||||
if (GetGithubVersionProviderSource(project) != GithubVersionProviderSource.Branches) |
|
||||
{ |
|
||||
return string.Empty; |
|
||||
} |
|
||||
|
|
||||
return project.GetProperty<string>("VersionBranchPrefix"); |
|
||||
} |
|
||||
|
|
||||
private GithubVersionProviderSource GetGithubVersionProviderSource(Project project) |
|
||||
{ |
|
||||
return project.HasProperty("GithubVersionProviderSource") |
|
||||
? project.GetProperty<GithubVersionProviderSource>("GithubVersionProviderSource") |
|
||||
: GithubVersionProviderSource.Releases; |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of DocsDocumentPdfClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace Volo.Docs.Documents; |
||||
|
|
||||
|
public partial class DocsDocumentPdfClientProxy |
||||
|
{ |
||||
|
} |
||||
@ -1,7 +0,0 @@ |
|||||
// This file is part of DocsDocumentPdfGeneratorClientProxy, you can customize it here
|
|
||||
// ReSharper disable once CheckNamespace
|
|
||||
namespace Volo.Docs.Documents; |
|
||||
|
|
||||
public partial class DocsDocumentPdfGeneratorClientProxy |
|
||||
{ |
|
||||
} |
|
||||
@ -0,0 +1,15 @@ |
|||||
|
{ |
||||
|
"role": "Volo.Docs.HttpApi.Client", |
||||
|
"proxies": { |
||||
|
"csharp": { |
||||
|
"VoloDocs.Web-docs-common": { |
||||
|
"applicationName": "VoloDocs.Web", |
||||
|
"module": "docs-common", |
||||
|
"url": "https://localhost:5001", |
||||
|
"folder": "ClientProxies", |
||||
|
"serviceType": "all", |
||||
|
"withoutContracts": true |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
{ |
||||
|
"role": "Volo.Docs.HttpApi" |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Asp.Versioning; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Content; |
||||
|
using Volo.Docs.Common; |
||||
|
using Volo.Docs.Common.Documents; |
||||
|
|
||||
|
namespace Volo.Docs.Documents; |
||||
|
|
||||
|
[RemoteService(Name = DocsCommonRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area(DocsCommonRemoteServiceConsts.ModuleName)] |
||||
|
[ControllerName("DocumentPdf")] |
||||
|
[Route("api/docs/documents/pdf")] |
||||
|
public class DocsDocumentPdfController : DocsControllerBase, IDocumentPdfAppService |
||||
|
{ |
||||
|
protected IDocumentPdfAppService DocumentPdfAppService { get; } |
||||
|
|
||||
|
public DocsDocumentPdfController(IDocumentPdfAppService documentPdfAppService) |
||||
|
{ |
||||
|
DocumentPdfAppService = documentPdfAppService; |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("download")] |
||||
|
public virtual Task<IRemoteStreamContent> DownloadPdfAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
return DocumentPdfAppService.DownloadPdfAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("exists")] |
||||
|
public virtual Task<bool> ExistsAsync(DocumentPdfGeneratorInput input) |
||||
|
{ |
||||
|
return DocumentPdfAppService.ExistsAsync(input); |
||||
|
} |
||||
|
} |
||||
@ -1,32 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Asp.Versioning; |
|
||||
using Microsoft.AspNetCore.Mvc; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Content; |
|
||||
using Volo.Docs.Common; |
|
||||
using Volo.Docs.Common.Documents; |
|
||||
|
|
||||
namespace Volo.Docs.Documents; |
|
||||
|
|
||||
[RemoteService(Name = DocsCommonRemoteServiceConsts.RemoteServiceName)] |
|
||||
[Area(DocsCommonRemoteServiceConsts.ModuleName)] |
|
||||
[ControllerName("Document")] |
|
||||
[Route("api/docs/documents")] |
|
||||
public class DocsDocumentPdfGeneratorController : DocsControllerBase, IDocumentPdfGeneratorAppService |
|
||||
{ |
|
||||
protected IDocumentPdfGeneratorAppService DocumentPdfGeneratorAppService { get; } |
|
||||
|
|
||||
public DocsDocumentPdfGeneratorController(IDocumentPdfGeneratorAppService documentPdfGeneratorAppService) |
|
||||
{ |
|
||||
DocumentPdfGeneratorAppService = documentPdfGeneratorAppService; |
|
||||
} |
|
||||
|
|
||||
[HttpGet] |
|
||||
[Route("pdf")] |
|
||||
public async Task<IRemoteStreamContent> GeneratePdfAsync(DocumentPdfGeneratorInput input) |
|
||||
{ |
|
||||
var streamContent = await DocumentPdfGeneratorAppService.GeneratePdfAsync(input); |
|
||||
Response.Headers.ContentDisposition = $"inline; filename=\"{streamContent.FileName}\""; |
|
||||
return streamContent; |
|
||||
} |
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue