Files
dashlibstorage/API.printerjob.md
2026-10-31 21:02:50 +01:00

101 lines
2.9 KiB
Markdown

# printerjob
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `printerjob.create`
*Source: `src/store/printerjob/create.js`*
Creates a new printer job for an agent printer belonging to the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `input` | `object` | |
| `input.agentprinterId` | `number` | Target agent printer ID. |
| `input.data` | `string` | Job payload (ZPL code, etc.). |
| `[input.type]` | `string` | Job type ("zpl", "pdf", etc., defaults to agentprinter type or "zpl"). |
| `[input.state]` | `string` | Initial state (defaults to "pending"). |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<object>` — Created printer job with printeragentId attached.
## `printerjob.delete`
*Source: `src/store/printerjob/delete.js`*
Deletes a printer job belonging to the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | Printer job ID. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<object>` — The deleted job's snapshot.
## `printerjob.getById`
*Source: `src/store/printerjob/getById.js`*
Retrieves a printer job by ID. If caller is an agent ({ agentId: number }), checks that the job belongs to that printer agent. If caller is a user (googleAuthId: number), checks that the job belongs to the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `auth` | `number|{agentId: number}` | User's googleAuthId or { agentId }. |
| `id` | `number` | Printer job ID. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<object|null>`
## `printerjob.list`
*Source: `src/store/printerjob/list.js`*
Lists printer jobs. If caller is an agent ({ agentId: number }), lists jobs for that agent. If caller is a user (googleAuthId: number), lists jobs for the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `auth` | `number|{agentId: number}` | User's googleAuthId or { agentId }. |
| `[filters]` | `object` | |
| `[filters.agentprinterId]` | `number` | Filter by agentprinterId (company callers only). |
| `[filters.state]` | `string` | Filter by job state (e.g. "pending"). |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<object>>`
## `printerjob.updateState`
*Source: `src/store/printerjob/updateState.js`*
Updates a printer job's state ("processing", "completed", "cancelled", etc.).
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `auth` | `number|{agentId: number}` | User's googleAuthId or { agentId }. |
| `id` | `number` | Printer job ID. |
| `state` | `string` | New state. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<object>` — Updated printer job.