mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
feat: catch exceptions link attachment service
This commit is contained in:
@@ -96,13 +96,15 @@ export class AttachmentsOnBills {
|
||||
tenantId,
|
||||
billDTO,
|
||||
bill,
|
||||
trx
|
||||
}: IBillEditedPayload) {
|
||||
const keys = billDTO.attachments?.map((attachment) => attachment.key);
|
||||
await this.unlinkAttachmentService.unlinkUnpresentedKeys(
|
||||
tenantId,
|
||||
keys,
|
||||
'Bill',
|
||||
bill.id
|
||||
bill.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ export class AttachmentsOnCreditNote {
|
||||
tenantId,
|
||||
creditNoteEditDTO,
|
||||
oldCreditNote,
|
||||
trx,
|
||||
}: ICreditNoteEditedPayload) {
|
||||
const keys = creditNoteEditDTO.attachments?.map(
|
||||
(attachment) => attachment.key
|
||||
@@ -104,7 +105,8 @@ export class AttachmentsOnCreditNote {
|
||||
tenantId,
|
||||
keys,
|
||||
'CreditNote',
|
||||
oldCreditNote.id
|
||||
oldCreditNote.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,13 +96,15 @@ export class AttachmentsOnExpenses {
|
||||
tenantId,
|
||||
expenseDTO,
|
||||
expense,
|
||||
trx,
|
||||
}: IExpenseEventEditPayload) {
|
||||
const keys = expenseDTO.attachments?.map((attachment) => attachment.key);
|
||||
await this.unlinkAttachmentService.unlinkUnpresentedKeys(
|
||||
tenantId,
|
||||
keys,
|
||||
'Expense',
|
||||
expense.id
|
||||
expense.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export class AttachmentsOnManualJournals {
|
||||
tenantId,
|
||||
manualJournalDTO,
|
||||
manualJournal,
|
||||
trx
|
||||
}: IManualJournalEventEditedPayload) {
|
||||
const keys = manualJournalDTO.attachments?.map(
|
||||
(attachment) => attachment.key
|
||||
@@ -106,7 +107,8 @@ export class AttachmentsOnManualJournals {
|
||||
tenantId,
|
||||
keys,
|
||||
'SaleInvoice',
|
||||
manualJournal.id
|
||||
manualJournal.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ValidateAttachments } from '../ValidateAttachments';
|
||||
import { UnlinkAttachment } from '../UnlinkAttachment';
|
||||
|
||||
@Service()
|
||||
export class AttachmentsOnBillPayments{
|
||||
export class AttachmentsOnBillPayments {
|
||||
@Inject()
|
||||
private linkAttachmentService: LinkAttachment;
|
||||
|
||||
@@ -98,6 +98,7 @@ export class AttachmentsOnBillPayments{
|
||||
tenantId,
|
||||
billPaymentDTO,
|
||||
oldBillPayment,
|
||||
trx,
|
||||
}: IBillPaymentEventEditedPayload) {
|
||||
const keys = billPaymentDTO.attachments?.map(
|
||||
(attachment) => attachment.key
|
||||
@@ -106,7 +107,8 @@ export class AttachmentsOnBillPayments{
|
||||
tenantId,
|
||||
keys,
|
||||
'BillPayment',
|
||||
oldBillPayment.id
|
||||
oldBillPayment.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export class AttachmentsOnPaymentsReceived {
|
||||
tenantId,
|
||||
paymentReceiveDTO,
|
||||
oldPaymentReceive,
|
||||
trx,
|
||||
}: IPaymentReceiveEditedPayload) {
|
||||
const keys = paymentReceiveDTO.attachments?.map(
|
||||
(attachment) => attachment.key
|
||||
@@ -106,7 +107,8 @@ export class AttachmentsOnPaymentsReceived {
|
||||
tenantId,
|
||||
keys,
|
||||
'PaymentReceive',
|
||||
oldPaymentReceive.id
|
||||
oldPaymentReceive.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export class AttachmentsOnSaleEstimates {
|
||||
tenantId,
|
||||
estimateDTO,
|
||||
oldSaleEstimate,
|
||||
trx
|
||||
}: ISaleEstimateEditedPayload) {
|
||||
const keys = estimateDTO.attachments?.map((attachment) => attachment.key);
|
||||
|
||||
@@ -105,7 +106,8 @@ export class AttachmentsOnSaleEstimates {
|
||||
tenantId,
|
||||
keys,
|
||||
'SaleEstimate',
|
||||
oldSaleEstimate.id
|
||||
oldSaleEstimate.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export class AttachmentsOnSaleInvoiceCreated {
|
||||
tenantId,
|
||||
saleInvoiceDTO,
|
||||
saleInvoice,
|
||||
trx,
|
||||
}: ISaleInvoiceEditedPayload) {
|
||||
// if (isEmpty(saleInvoiceDTO.attachments)) return;
|
||||
|
||||
@@ -108,7 +109,8 @@ export class AttachmentsOnSaleInvoiceCreated {
|
||||
tenantId,
|
||||
keys,
|
||||
'SaleInvoice',
|
||||
saleInvoice.id
|
||||
saleInvoice.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export class AttachmentsOnSaleReceipt {
|
||||
tenantId,
|
||||
saleReceiptDTO,
|
||||
saleReceipt,
|
||||
trx,
|
||||
}: ISaleReceiptEditedPayload) {
|
||||
const keys = saleReceiptDTO.attachments?.map(
|
||||
(attachment) => attachment.key
|
||||
@@ -106,7 +107,8 @@ export class AttachmentsOnSaleReceipt {
|
||||
tenantId,
|
||||
keys,
|
||||
'SaleReceipt',
|
||||
saleReceipt.id
|
||||
saleReceipt.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export class AttachmentsOnVendorCredits {
|
||||
tenantId,
|
||||
vendorCreditDTO,
|
||||
oldVendorCredit,
|
||||
trx,
|
||||
}: IVendorCreditEditedPayload) {
|
||||
const keys = vendorCreditDTO.attachments?.map(
|
||||
(attachment) => attachment.key
|
||||
@@ -106,7 +107,8 @@ export class AttachmentsOnVendorCredits {
|
||||
tenantId,
|
||||
keys,
|
||||
'VendorCredit',
|
||||
oldVendorCredit.id
|
||||
oldVendorCredit.id,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user