Skip to content

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 ​

ParameterType
manager?EntityManager

Returns ​

InvoicePdfService

Inherited from ​

StoredPdfService.constructor

Properties ​

PropertyModifierTypeDefault valueOverridesInherited from
locationreadonly"./data/invoices"INVOICE_PDF_LOCATIONStoredPdfService.location-
managerprotectedEntityManagerundefined-StoredPdfService.manager
pdfConstructorreadonlytypeof InvoicePdfInvoicePdfStoredPdfService.pdfConstructor-
renderpublic(options) => stringcreateInvoicePdfStoredPdfService.render-

Methods ​

compile() ​

ts
protected compile(params): Promise<Buffer<ArrayBufferLike>>;

Parameters ​

ParameterType
paramsIInvoicePdf

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

StoredPdfService.compile


configureLogger() ​

ts
protected configureLogger(logger): void;

Parameters ​

ParameterType
loggerLogger

Returns ​

void

Inherited from ​

StoredPdfService.configureLogger


getOrCreate() ​

ts
getOrCreate(entity, force?): Promise<InvoicePdf>;

Parameters ​

ParameterTypeDefault value
entityInvoiceundefined
forcebooleanfalse

Returns ​

Promise<InvoicePdf>

Inherited from ​

StoredPdfService.getOrCreate


getOwner() ​

ts
getOwner(invoice): User;

Parameters ​

ParameterType
invoiceInvoice

Returns ​

User

Overrides ​

StoredPdfService.getOwner


getParameters() ​

ts
getParameters(invoice): Promise<IInvoicePdf>;

Parameters ​

ParameterType
invoiceInvoice

Returns ​

Promise<IInvoicePdf>

Overrides ​

StoredPdfService.getParameters


html() ​

ts
html(entity): Promise<Buffer<ArrayBufferLike>>;

Parameters ​

ParameterType
entityInvoice

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

StoredPdfService.html


output() ​

ts
output(entity, fileType): Promise<Buffer<ArrayBufferLike>>;

Parameters ​

ParameterType
entityInvoice
fileTypeReturnFileType

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

StoredPdfService.output


pdf() ​

ts
pdf(entity): Promise<Buffer<ArrayBufferLike>>;

Parameters ​

ParameterType
entityInvoice

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

StoredPdfService.pdf