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
-
objectControllerBasePdfTemplateConfigsController
Constructors
PdfTemplateConfigsController(SettingsDbContext, ITenantIdContext, PdfPreviewService, ILogger<PdfTemplateConfigsController>)
public PdfTemplateConfigsController(SettingsDbContext db, ITenantIdContext tenantContext, PdfPreviewService previewService, ILogger<PdfTemplateConfigsController> logger)
Parameters
dbSettingsDbContexttenantContextITenantIdContextpreviewServicePdfPreviewServiceloggerILogger<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
tenantIdGuidrequestSavePdfTemplateConfigRequestcancellationTokenCancellationToken
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
tenantIdGuididGuidcancellationTokenCancellationToken
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
tenantIdGuidcancellationTokenCancellationToken
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
tenantIdGuididGuidcancellationTokenCancellationToken
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
tenantIdGuiddocumentTypestringrequestPreviewPdfBrandingRequest
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
tenantIdGuididGuidrequestSavePdfTemplateConfigRequestcancellationTokenCancellationToken
Returns
- Task<ActionResult<PdfTemplateConfigResponse>>