u
This commit is contained in:
@@ -85,7 +85,7 @@ const article = await store.article.createUnderParent({ googleAuthId: 42, parent
|
||||
|
||||
*Source: `src/store/article/delete.js`*
|
||||
|
||||
Deletes an article by its SKU, refusing when it still has children.
|
||||
Deletes an article by its SKU, refusing when it still has children unless cascade is true.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@@ -93,7 +93,8 @@ Deletes an article by its SKU, refusing when it still has children.
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `sku` | `string` | The article SKU. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
| `[optionsOrTx]` | `object|*` | Options object ({ cascade?: boolean }) or optional transaction. |
|
||||
| `[maybeTx]` | `object` | Optional transaction if options was passed. |
|
||||
|
||||
**Returns**
|
||||
|
||||
@@ -101,12 +102,13 @@ Deletes an article by its SKU, refusing when it still has children.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the article has children or is not found.
|
||||
`Error` — If the article has children (when cascade=false) or is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
await store.article.delete(42, 'SKU-1');
|
||||
await store.article.delete(42, 'SKU-1', { cascade: true });
|
||||
```
|
||||
|
||||
## `article.deleteImage`
|
||||
@@ -353,6 +355,7 @@ Removes a child article from a father article, either by unlinking or deleting i
|
||||
| `childSku` | `string` | The child article SKU. |
|
||||
| `[options]` | `object` | |
|
||||
| `[options.deleteArticle=false]` | `boolean` | Whether to delete the child article entity entirely. |
|
||||
| `[options.cascade=true]` | `boolean` | Whether to cascade delete child subtrees when deleteArticle is true. |
|
||||
| `[tx]` | `object` | Optional transaction. |
|
||||
|
||||
**Returns**
|
||||
|
||||
Reference in New Issue
Block a user