feat: hook up the invice customize api

This commit is contained in:
Ahmed Bouhuolia
2024-09-12 14:16:07 +02:00
parent a7df23cebc
commit 632c4629de
21 changed files with 391 additions and 169 deletions

View File

@@ -30,11 +30,14 @@ export class EditPdfTemplate {
const { PdfTemplate } = this.tenancy.models(tenantId);
return this.uow.withTransaction(tenantId, async (trx) => {
await PdfTemplate.query(trx)
.patch({
...editTemplateDTO,
})
.where('id', templateId);
await this.eventPublisher.emitAsync(events.pdfTemplate.onEditing, {
tenantId,
templateId,
});
await PdfTemplate.query(trx).where('id', templateId).update({
templateName: editTemplateDTO.templateName,
attributes: editTemplateDTO.attributes,
});
await this.eventPublisher.emitAsync(events.pdfTemplate.onEdited, {
tenantId,