This commit is contained in:
seb
2026-10-08 16:11:44 +02:00
parent 46ea04c0cb
commit d36c2827cc
4 changed files with 406 additions and 38 deletions

View File

@@ -59,7 +59,7 @@ const category = await store.category.createUnderParent({ googleAuthId: 42, pare
*Source: `src/store/category/delete.js`*
Deletes a category, refusing to delete the company's root category.
Deletes a category, refusing to delete the company's root category. If recursive is true, recursively deletes the subtree and articles that only belong to it.
**Parameters**
@@ -68,6 +68,7 @@ Deletes a category, refusing to delete the company's root category.
| `input` | `object` | The delete input. |
| `input.googleAuthId` | `number` | The id of the Google auth user. |
| `input.id` | `number` | The id of the category to delete. |
| `[input.recursive=false]` | `boolean` | Whether to delete the category subtree recursively. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
@@ -76,12 +77,13 @@ Deletes a category, refusing to delete the company's root category.
**Throws**
`Error` — If the category is the root category or contains articles/subcategories.
`Error` — If the category is the root category or contains articles/subcategories (when recursive is false).
**Example**
```js
await store.category.delete({ googleAuthId: 42, id: 5 });
await store.category.delete({ googleAuthId: 42, id: 5, recursive: true });
```
## `category.deleteImage`