feat: wip attach attachments to resource models

This commit is contained in:
Ahmed Bouhuolia
2024-05-26 21:59:39 +02:00
parent 15dbc4137c
commit 2244cc6116
64 changed files with 2052 additions and 54 deletions

View File

@@ -2,6 +2,7 @@ import { Transformer } from '@/lib/Transformer/Transformer';
import { formatNumber } from 'utils';
import { SaleInvoiceTaxEntryTransformer } from './SaleInvoiceTaxEntryTransformer';
import { ItemEntryTransformer } from './ItemEntryTransformer';
import { AttachmentTransformer } from '@/services/Attachments/AttachmentTransformer';
export class SaleInvoiceTransformer extends Transformer {
/**
@@ -25,6 +26,7 @@ export class SaleInvoiceTransformer extends Transformer {
'totalLocalFormatted',
'taxes',
'entries',
'attachments',
];
};
@@ -190,4 +192,13 @@ export class SaleInvoiceTransformer extends Transformer {
currencyCode: invoice.currencyCode,
});
};
/**
* Retrieves the sale invoice attachments.
* @param {ISaleInvoice} invoice
* @returns
*/
protected attachments = (invoice) => {
return this.item(invoice.attachments, new AttachmentTransformer());
};
}