Files
dashlibstorage/API.attributename.md
2026-10-11 18:55:08 +02:00

113 lines
3.0 KiB
Markdown

# attributename
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `attributename.create`
*Source: `src/store/attributename/create.js`*
Creates an attribute name for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `input` | `object` | The attribute name input. |
| `input.name` | `string` | The attribute name. |
| `[input.sort]` | `number` | Optional sort order. |
| `[input.exclusive=false]` | `boolean` | Whether values are mutually exclusive on an article. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{id: number, name: string, sort: number, exclusive: boolean, values: Array}>`
**Throws**
`Error` — If the name is missing or already exists for the company.
## `attributename.delete`
*Source: `src/store/attributename/delete.js`*
Deletes an attribute name for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The attribute name id. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<void>`
**Throws**
`Error` — If attribute name not found or in use.
## `attributename.list`
*Source: `src/store/attributename/list.js`*
Lists the attribute names for the user's selected company, including values.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<{id: number, name: string, sort: number, exclusive: boolean, articleCount: number, values: Array<{id: number, value: string, sort: number, articleCount: number}>}>>`
## `attributename.order`
*Source: `src/store/attributename/order.js`*
Reorders the attribute names for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `input` | `object` | Reorder input. |
| `input.attributenameIds` | `Array<number>` | IDs in their new order. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{attributenameIds: Array<number>}>`
## `attributename.update`
*Source: `src/store/attributename/update.js`*
Updates an attribute name for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The attribute name id. |
| `input` | `object` | Update patch. |
| `[input.name]` | `string` | New name. |
| `[input.sort]` | `number` | New sort. |
| `[input.exclusive]` | `boolean` | New exclusive flag. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{id: number, name: string, sort: number, exclusive: boolean, values: Array}>`
**Throws**
`Error` — If the attribute name is unknown, the name is missing, or the name is already taken.