mirror of https://github.com/abpframework/abp.git
51 changed files with 1367 additions and 316 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,36 @@ |
|||
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; } |
|||
|
|||
public DocumentPdfGenerateJob(IProjectPdfGenerator projectPdfGenerator, IProjectRepository projectRepository) |
|||
{ |
|||
ProjectPdfGenerator = projectPdfGenerator; |
|||
ProjectRepository = projectRepository; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public async override Task ExecuteAsync(DocumentPdfGenerateJobArgs args) |
|||
{ |
|||
try |
|||
{ |
|||
var project = await ProjectRepository.GetAsync(args.ProjectId, includeDetails: true); |
|||
await ProjectPdfGenerator.GenerateAsync(project, args.Version, args.LanguageCode); |
|||
} |
|||
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,12 @@ |
|||
using System; |
|||
|
|||
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,67 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp; |
|||
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; |
|||
using Volo.Docs.Common.Documents; |
|||
using Volo.Docs.Projects; |
|||
using Volo.Docs.Projects.Pdf; |
|||
|
|||
namespace Volo.Docs.Admin.Documents; |
|||
|
|||
[Authorize(DocsCommonPermissions.Projects.PdfGeneration)] |
|||
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) |
|||
); |
|||
} |
|||
|
|||
[Authorize(DocsAdminPermissions.Projects.ManagePdfFiles)] |
|||
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 |
|||
{ |
|||
} |
|||
@ -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,54 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.Content; |
|||
using Volo.Docs.Projects; |
|||
using Volo.Docs.Projects.Pdf; |
|||
|
|||
namespace Volo.Docs.Common.Documents; |
|||
|
|||
[Authorize(DocsCommonPermissions.Projects.PdfGeneration)] |
|||
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, "application/pdf"); |
|||
} |
|||
|
|||
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,36 @@ |
|||
// 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.Common.Documents; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace Volo.Docs.Documents; |
|||
|
|||
[Dependency(ReplaceServices = true)] |
|||
[ExposeServices(typeof(IDocumentPdfAppService), typeof(DocsDocumentPdfClientProxy))] |
|||
public partial class DocsDocumentPdfClientProxy : ClientProxyBase<IDocumentPdfAppService>, IDocumentPdfAppService |
|||
{ |
|||
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 DocsDocumentPdfClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace Volo.Docs.Documents; |
|||
|
|||
public partial class DocsDocumentPdfClientProxy |
|||
{ |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
// 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.DependencyInjection; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Client.ClientProxying; |
|||
using Volo.Abp.Http.Modeling; |
|||
using Volo.Docs.Common.Projects; |
|||
using Volo.Docs.Documents; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace Volo.Docs.Projects; |
|||
|
|||
[Dependency(ReplaceServices = true)] |
|||
[ExposeServices(typeof(IProjectAppService), typeof(DocsProjectClientProxy))] |
|||
public partial class DocsProjectClientProxy : ClientProxyBase<IProjectAppService>, IProjectAppService |
|||
{ |
|||
public virtual async Task<ListResultDto<ProjectDto>> GetListAsync() |
|||
{ |
|||
return await RequestAsync<ListResultDto<ProjectDto>>(nameof(GetListAsync)); |
|||
} |
|||
|
|||
public virtual async Task<ProjectDto> GetAsync(string shortName) |
|||
{ |
|||
return await RequestAsync<ProjectDto>(nameof(GetAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(string), shortName } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<string> GetDefaultLanguageCodeAsync(string shortName, string version) |
|||
{ |
|||
return await RequestAsync<string>(nameof(GetDefaultLanguageCodeAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(string), shortName }, |
|||
{ typeof(string), version } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<ListResultDto<VersionInfoDto>> GetVersionsAsync(string shortName) |
|||
{ |
|||
return await RequestAsync<ListResultDto<VersionInfoDto>>(nameof(GetVersionsAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(string), shortName } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<LanguageConfig> GetLanguageListAsync(string shortName, string version) |
|||
{ |
|||
return await RequestAsync<LanguageConfig>(nameof(GetLanguageListAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(string), shortName }, |
|||
{ typeof(string), version } |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
// This file is part of DocsProjectClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace Volo.Docs.Projects; |
|||
|
|||
public partial class DocsProjectClientProxy |
|||
{ |
|||
} |
|||
@ -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 Task<IRemoteStreamContent> DownloadPdfAsync(DocumentPdfGeneratorInput input) |
|||
{ |
|||
return DocumentPdfAppService.DownloadPdfAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("exists")] |
|||
public 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; |
|||
} |
|||
} |
|||
@ -1,9 +1,8 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Content; |
|||
|
|||
namespace Volo.Docs.Projects.Pdf; |
|||
|
|||
public interface IProjectPdfGenerator |
|||
{ |
|||
Task<IRemoteStreamContent> GenerateAsync(Project project, string version, string languageCode); |
|||
Task GenerateAsync(Project project, string version, string languageCode); |
|||
} |
|||
@ -0,0 +1,80 @@ |
|||
// 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.DependencyInjection; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Client.ClientProxying; |
|||
using Volo.Abp.Http.Modeling; |
|||
using Volo.Docs.Documents; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace Volo.Docs.Documents; |
|||
|
|||
[Dependency(ReplaceServices = true)] |
|||
[ExposeServices(typeof(IDocumentAppService), typeof(DocsDocumentClientProxy))] |
|||
public partial class DocsDocumentClientProxy : ClientProxyBase<IDocumentAppService>, IDocumentAppService |
|||
{ |
|||
public virtual async Task<DocumentWithDetailsDto> GetAsync(GetDocumentInput input) |
|||
{ |
|||
return await RequestAsync<DocumentWithDetailsDto>(nameof(GetAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(GetDocumentInput), input } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<DocumentWithDetailsDto> GetDefaultAsync(GetDefaultDocumentInput input) |
|||
{ |
|||
return await RequestAsync<DocumentWithDetailsDto>(nameof(GetDefaultAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(GetDefaultDocumentInput), input } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<NavigationNode> GetNavigationAsync(GetNavigationDocumentInput input) |
|||
{ |
|||
return await RequestAsync<NavigationNode>(nameof(GetNavigationAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(GetNavigationDocumentInput), input } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<DocumentResourceDto> GetResourceAsync(GetDocumentResourceInput input) |
|||
{ |
|||
return await RequestAsync<DocumentResourceDto>(nameof(GetResourceAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(GetDocumentResourceInput), input } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<PagedResultDto<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input) |
|||
{ |
|||
return await RequestAsync<PagedResultDto<DocumentSearchOutput>>(nameof(SearchAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(DocumentSearchInput), input } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<bool> FullSearchEnabledAsync() |
|||
{ |
|||
return await RequestAsync<bool>(nameof(FullSearchEnabledAsync)); |
|||
} |
|||
|
|||
public virtual async Task<List<String>> GetUrlsAsync(string prefix) |
|||
{ |
|||
return await RequestAsync<List<String>>(nameof(GetUrlsAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(string), prefix } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<DocumentParametersDto> GetParametersAsync(GetParametersDocumentInput input) |
|||
{ |
|||
return await RequestAsync<DocumentParametersDto>(nameof(GetParametersAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(GetParametersDocumentInput), input } |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
// This file is part of DocsDocumentClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace Volo.Docs.Documents; |
|||
|
|||
public partial class DocsDocumentClientProxy |
|||
{ |
|||
} |
|||
@ -1,3 +1,15 @@ |
|||
{ |
|||
"role": "lib.http-api-client" |
|||
"role": "lib.http-api-client", |
|||
"proxies": { |
|||
"csharp": { |
|||
"VoloDocs.Web-docs": { |
|||
"applicationName": "VoloDocs.Web", |
|||
"module": "docs", |
|||
"url": "https://localhost:5001", |
|||
"folder": "ClientProxies", |
|||
"serviceType": "all", |
|||
"withoutContracts": true |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue