Files
dashlibstorage/API.attributevalue.md
2026-10-04 11:25:14 +02:00

106 lines
2.6 KiB
Markdown

# attributevalue
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `attributevalue.create`
*Source: `src/store/attributevalue/create.js`*
Creates an attribute value under a given attribute.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `attributeId` | `number` | The attribute id. |
| `input` | `object` | Input value data. |
| `input.value` | `string` | The value text. |
| `[input.sort]` | `number` | Optional sort order. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{id: number, attributeId: number, value: string, sort: number}>`
## `attributevalue.delete`
*Source: `src/store/attributevalue/delete.js`*
Deletes an attribute value.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The attribute value id. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<void>`
**Throws**
`Error` — If attribute value not found or in use.
## `attributevalue.listByAttributeId`
*Source: `src/store/attributevalue/listByAttributeId.js`*
Lists the values for an attribute.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `attributeId` | `number` | The attribute id. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<{id: number, attributeId: number, value: string, sort: number}>>`
## `attributevalue.order`
*Source: `src/store/attributevalue/order.js`*
Reorders attribute values under an attribute.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `attributeId` | `number` | The attribute id. |
| `input` | `object` | Reorder input. |
| `input.attributevalueIds` | `Array<number>` | Value IDs in their new order. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{attributevalueIds: Array<number>}>`
## `attributevalue.update`
*Source: `src/store/attributevalue/update.js`*
Updates an attribute value.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The attribute value id. |
| `input` | `object` | Update patch. |
| `[input.value]` | `string` | New value text. |
| `[input.sort]` | `number` | New sort order. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{id: number, attributeId: number, value: string, sort: number}>`