mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: link pdf template to sales transactions
This commit is contained in:
@@ -31,13 +31,18 @@ export class CreatePdfTemplate {
|
||||
const attributes = invoiceTemplateDTO;
|
||||
|
||||
return this.uow.withTransaction(tenantId, async (trx) => {
|
||||
// Triggers `onPdfTemplateCreating` event.
|
||||
await this.eventPublisher.emitAsync(events.pdfTemplate.onCreating, {
|
||||
tenantId,
|
||||
});
|
||||
|
||||
await PdfTemplate.query(trx).insert({
|
||||
templateName,
|
||||
resource,
|
||||
attributes,
|
||||
});
|
||||
|
||||
await this.eventPublisher.emitAsync(events.pdfTemplate.onInvoiceCreated, {
|
||||
// Triggers `onPdfTemplateCreated` event.
|
||||
await this.eventPublisher.emitAsync(events.pdfTemplate.onCreated, {
|
||||
tenantId,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user