# Edit Category

<!-- User story defining a specific requirement within a business flow.
The name of the story should start with the actor followed by `--` and the story name.
 -->

<!-- This section should contain the following subsections in order: -->
<!-- 1. ## User Story (required) -->
<!-- 2. ## Story Diagram (required) -->
<!-- 3. ## Scenario Patterns (required) -->
<!-- 4. ## Test Cases (required) -->
<!-- 5. ## Screens (required) -->
<!-- 6. ## Resolvers (required) -->

## User Story

As a product manager, I want to update a category's name, so that I can correct or improve how the category is labelled.

## Story Diagram

<!-- Mermaid flowchart showing user interactions with screens.
Focus on actors, UI screens, and business outcomes.
Avoid technical details (APIs, databases, endpoints).
 -->

<!-- Code block requirements: -->
<!-- Minimum 1 mermaid code blocks required -->

```mermaid
flowchart TD
    A([Product Manager]) --> B[Category List Screen]
    B --> C[Category Detail Screen]
    C --> D[Edit Category Form]
    D --> E{Submit}
    E --> F{Category found?}
    F -- Yes --> G[Category name updated]
    F -- No --> H[Error: Category not found]
    G --> C
```

## Scenario Patterns

- Successful edit: product manager updates the name of an existing category; the new name is saved and shown immediately
- Category not found error: attempting to edit a category that no longer exists returns an error

## Test Cases

- Given a valid category ID and a new name, the category name is updated successfully
- Given a category ID that does not exist, the edit fails with a not found error

## Screens

- [category-detail](../../../screen/category-detail.md)
- [category-edit-form](../../../screen/category-edit-form.md)

## Resolvers

<!-- Link to resolver docs that implement this story's backend operations.
Write "None" if this story does not require any resolvers.
 -->

- [updateCategory](../../../resolver/updateCategory.md)
