Files
dashlibstorage/API.printer.md
2026-09-26 23:06:05 +02:00

4.5 KiB

printer

This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.

printer.create

Source: src/store/printer/create.js

Creates a new printer for the user's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
input object Printer input.
input.address string Printer address (network IP/host/path).
input.type string Printer type ("esc/pos" or "zpl").
[input.model] string Optional printer model name.
[input.serial] string Optional printer serial number.
[input.sort] number Optional sort order (auto-increments if omitted).
[input.desc] string Optional description.
[tx] object Optional transaction to run within.

Returns

Promise<{id: number, company_id: number, address: string, type: string, model: string|null, serial: string|null, sort: number, desc: string|null}>

Throws

Error — If address is missing, type is invalid, or sort is invalid.

Example

const printer = await store.printer.create(googleAuthId, {
  address: '192.168.1.200',
  type: 'esc/pos',
  model: 'TM-T88VI',
  desc: 'Bar receipt printer',
});

printer.delete

Source: src/store/printer/delete.js

Deletes a printer for the user's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
id number The printer ID to delete.
[tx] object Optional transaction to run within.

Returns

Promise<void>

Throws

Error — If printer is not found.

printer.getById

Source: src/store/printer/getById.js

Retrieves a printer by its ID for the user's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
id number The printer ID.
[tx] object Optional transaction to run within.

Returns

Promise<{id: number, company_id: number, address: string, type: string, model: string|null, serial: string|null, sort: number, desc: string|null}|undefined>

Example

const printer = await store.printer.getById(googleAuthId, 1);
// => { id: 1, company_id: 1, address: '192.168.1.100', type: 'esc/pos', ... }

printer.list

Source: src/store/printer/list.js

Lists all printers for the user's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
[tx] object Optional transaction to run within.

Returns

Promise<Array<{id: number, company_id: number, address: string, type: string, model: string|null, serial: string|null, sort: number, desc: string|null}>>

Example

const printers = await store.printer.list(42);
// => [{ id: 1, company_id: 1, address: '192.168.1.100', type: 'esc/pos', ... }]

printer.order

Source: src/store/printer/order.js

Reorders the printers of the user's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
input object The reorder input.
input.printerIds Array<number> The printer ids in their new order.
[tx] object Optional transaction to run within.

Returns

Promise<{printerIds: Array<number>}> — The applied order.

Throws

Error — If the order is invalid.

printer.update

Source: src/store/printer/update.js

Updates a printer for the user's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
id number The printer ID to update.
input object Update payload.
[input.address] string The printer address.
[input.type] string The printer type ("esc/pos" or "zpl").
[input.model] `string null`
[input.serial] `string null`
[input.sort] number The sort order.
[input.desc] `string null`
[tx] object Optional transaction to run within.

Returns

Promise<{id: number, company_id: number, address: string, type: string, model: string|null, serial: string|null, sort: number, desc: string|null}>

Throws

Error — If printer not found, address is empty, type is invalid, or sort is invalid.