SudoSOS Back-end API / internal/pdf/invoice-pdf-service / InvoicePdfService
Class: InvoicePdfService ​
A PdfService whose output is a record we send to people. Once stored, the PDF is frozen (#141): it is returned as-is, and only re-rendered when force is set or its hash was cleared to mark it stale.
Extends ​
Constructors ​
Constructor ​
ts
new InvoicePdfService(manager?): InvoicePdfService;Parameters ​
| Parameter | Type |
|---|---|
manager? | EntityManager |
Returns ​
InvoicePdfService
Inherited from ​
Properties ​
| Property | Modifier | Type | Default value | Overrides | Inherited from |
|---|---|---|---|---|---|
location | readonly | "./data/invoices" | INVOICE_PDF_LOCATION | StoredPdfService.location | - |
manager | protected | EntityManager | undefined | - | StoredPdfService.manager |
pdfConstructor | readonly | typeof InvoicePdf | InvoicePdf | StoredPdfService.pdfConstructor | - |
render | public | (options) => string | createInvoicePdf | StoredPdfService.render | - |
Methods ​
compile() ​
ts
protected compile(params): Promise<Buffer<ArrayBufferLike>>;Parameters ​
| Parameter | Type |
|---|---|
params | IInvoicePdf |
Returns ​
Promise<Buffer<ArrayBufferLike>>
Inherited from ​
configureLogger() ​
ts
protected configureLogger(logger): void;Parameters ​
| Parameter | Type |
|---|---|
logger | Logger |
Returns ​
void
Inherited from ​
StoredPdfService.configureLogger
getOrCreate() ​
ts
getOrCreate(entity, force?): Promise<InvoicePdf>;Parameters ​
| Parameter | Type | Default value |
|---|---|---|
entity | Invoice | undefined |
force | boolean | false |
Returns ​
Promise<InvoicePdf>
Inherited from ​
getOwner() ​
ts
getOwner(invoice): User;Parameters ​
| Parameter | Type |
|---|---|
invoice | Invoice |
Returns ​
Overrides ​
getParameters() ​
ts
getParameters(invoice): Promise<IInvoicePdf>;Parameters ​
| Parameter | Type |
|---|---|
invoice | Invoice |
Returns ​
Promise<IInvoicePdf>
Overrides ​
StoredPdfService.getParameters
html() ​
ts
html(entity): Promise<Buffer<ArrayBufferLike>>;Parameters ​
| Parameter | Type |
|---|---|
entity | Invoice |
Returns ​
Promise<Buffer<ArrayBufferLike>>
Inherited from ​
output() ​
ts
output(entity, fileType): Promise<Buffer<ArrayBufferLike>>;Parameters ​
| Parameter | Type |
|---|---|
entity | Invoice |
fileType | ReturnFileType |
Returns ​
Promise<Buffer<ArrayBufferLike>>
Inherited from ​
pdf() ​
ts
pdf(entity): Promise<Buffer<ArrayBufferLike>>;Parameters ​
| Parameter | Type |
|---|---|
entity | Invoice |
Returns ​
Promise<Buffer<ArrayBufferLike>>