Table of Contents

Class PdfTemplateConfigsController

Namespace
KadicErp.WebApi.Controllers.Settings
Assembly
KadicErp.WebApi.dll
[ApiController]
[Authorize]
[Route("api/tenants/{tenantId:guid}/pdf-template-configs")]
[Produces("application/json", new string[] { })]
public class PdfTemplateConfigsController : ControllerBase
Inheritance
object
ControllerBase
PdfTemplateConfigsController

Constructors

PdfTemplateConfigsController(SettingsDbContext, ITenantIdContext, PdfPreviewService, ILogger<PdfTemplateConfigsController>)

public PdfTemplateConfigsController(SettingsDbContext db, ITenantIdContext tenantContext, PdfPreviewService previewService, ILogger<PdfTemplateConfigsController> logger)

Parameters

db SettingsDbContext
tenantContext ITenantIdContext
previewService PdfPreviewService
logger ILogger<PdfTemplateConfigsController>

Methods

Create(Guid, SavePdfTemplateConfigRequest, CancellationToken)

Create a new PDF template config for a tenant.

[HttpPost]
[Authorize(Policy = "SETTINGS_PDF_TEMPLATE_CONFIGS_WRITE")]
[ProducesResponseType(typeof(PdfTemplateConfigResponse), 201)]
[ProducesResponseType(422)]
public Task<ActionResult<PdfTemplateConfigResponse>> Create(Guid tenantId, SavePdfTemplateConfigRequest request, CancellationToken cancellationToken)

Parameters

tenantId Guid
request SavePdfTemplateConfigRequest
cancellationToken CancellationToken

Returns

Task<ActionResult<PdfTemplateConfigResponse>>

Delete(Guid, Guid, CancellationToken)

Delete a PDF template config.

[HttpDelete("{id:guid}")]
[Authorize(Policy = "SETTINGS_PDF_TEMPLATE_CONFIGS_DELETE")]
[ProducesResponseType(204)]
[ProducesResponseType(404)]
public Task<IActionResult> Delete(Guid tenantId, Guid id, CancellationToken cancellationToken)

Parameters

tenantId Guid
id Guid
cancellationToken CancellationToken

Returns

Task<IActionResult>

GetAll(Guid, CancellationToken)

List all PDF template configs for a tenant.

[HttpGet]
[Authorize(Policy = "SETTINGS_PDF_TEMPLATE_CONFIGS_VIEW")]
[ProducesResponseType(typeof(List<PdfTemplateConfigResponse>), 200)]
public Task<ActionResult<List<PdfTemplateConfigResponse>>> GetAll(Guid tenantId, CancellationToken cancellationToken)

Parameters

tenantId Guid
cancellationToken CancellationToken

Returns

Task<ActionResult<List<PdfTemplateConfigResponse>>>

GetById(Guid, Guid, CancellationToken)

Get a specific PDF template config by ID.

[HttpGet("{id:guid}")]
[Authorize(Policy = "SETTINGS_PDF_TEMPLATE_CONFIGS_VIEW")]
[ProducesResponseType(typeof(PdfTemplateConfigResponse), 200)]
[ProducesResponseType(404)]
public Task<ActionResult<PdfTemplateConfigResponse>> GetById(Guid tenantId, Guid id, CancellationToken cancellationToken)

Parameters

tenantId Guid
id Guid
cancellationToken CancellationToken

Returns

Task<ActionResult<PdfTemplateConfigResponse>>

Preview(Guid, string, PreviewPdfBrandingRequest)

Generate a PDF preview with the given branding config.

[HttpPost("preview")]
[Authorize(Policy = "SETTINGS_PDF_TEMPLATE_CONFIGS_VIEW")]
[ProducesResponseType(typeof(FileContentResult), 200)]
[ProducesResponseType(400)]
public IActionResult Preview(Guid tenantId, string documentType, PreviewPdfBrandingRequest request)

Parameters

tenantId Guid
documentType string
request PreviewPdfBrandingRequest

Returns

IActionResult

Update(Guid, Guid, SavePdfTemplateConfigRequest, CancellationToken)

Update an existing PDF template config.

[HttpPut("{id:guid}")]
[Authorize(Policy = "SETTINGS_PDF_TEMPLATE_CONFIGS_WRITE")]
[ProducesResponseType(typeof(PdfTemplateConfigResponse), 200)]
[ProducesResponseType(404)]
public Task<ActionResult<PdfTemplateConfigResponse>> Update(Guid tenantId, Guid id, SavePdfTemplateConfigRequest request, CancellationToken cancellationToken)

Parameters

tenantId Guid
id Guid
request SavePdfTemplateConfigRequest
cancellationToken CancellationToken

Returns

Task<ActionResult<PdfTemplateConfigResponse>>