# attributevalue This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`. ## `attributevalue.addImage` *Source: `src/store/attributevalue/addImage.js`* Adds an image to an attribute value, processing full, thumb, and 32px-edge small-thumb AVIF variants. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `attributeValueId` | `number` | The id of the attribute value. | | `image` | `Buffer` | The source image buffer. | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise<{id: number, fullHash: string, thumbW: number, thumbH: number, thumbHash: string, smallThumbW: number, smallThumbH: number, pics: Array}>` ## `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}>` **Throws** `Error` — If the value is missing, the attribute is unknown, or the value already exists for the attribute. ## `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` **Throws** `Error` — If attribute value not found or in use. ## `attributevalue.deleteImage` *Source: `src/store/attributevalue/deleteImage.js`* Deletes the image of an attribute value. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `attributeValueId` | `number` | The id of the attribute value. | | `[tx]` | `object` | Optional transaction. | **Returns** `Promise<{id: number, thumbW: null, thumbH: null, thumbHash: null, pics: Array}>` **Throws** `Error` — If attribute value not found or image not found. ## `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>` ## `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` | Value IDs in their new order. | | `[tx]` | `object` | Optional transaction. | **Returns** `Promise<{attributevalueIds: Array}>` ## `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}>` **Throws** `Error` — If the attribute value is unknown, the value is missing, or the value is already taken.