Skip to content

Feature: Add an 'Edit Song' Form #88

@david

Description

@david

1. User Story & Rationale

  • Parent Epic Issue: Ability to edit songs #75
  • DDD Subdomain: Songs
  • User Story: As an Administrator, I want to access an editing interface for any song directly from the song list so that I can quickly make necessary corrections.
  • Rationale: This feature provides the primary user interface for administrators to modify song attributes, which is a core capability of the "Ability to Edit Songs" epic.

2. Acceptance Criteria (BDD Scenarios)

Scenario 1: Successful Song Edit

  • Scenario Name: Administrator successfully edits and saves a song.
  • GIVEN: An administrator is viewing the list of songs.
  • WHEN: The administrator clicks the "Edit" button for a specific song.
  • AND: They modify the title and body in the form.
  • AND: They click the "Save" button.
  • THEN: The system saves the changes and redirects the administrator back to the song list.
  • AND: The updated title is visible in the song list.
  • AND: A confirmation message like "Song updated successfully" is displayed.

Scenario 2: Unauthorized User Access

  • Scenario Name: A non-administrator attempts to access the edit form.
  • GIVEN: A user is logged in who is not an administrator.
  • WHEN: The user attempts to navigate directly to the "Edit Song" URL.
  • THEN: The system denies access and redirects the user to an appropriate error page (e.g., "Unauthorized").

Scenario 3: Cross-Organization Access by Administrator

  • Scenario Name: An administrator from one organization attempts to edit a song from another.
  • GIVEN: An administrator for "Organization A" is logged in.
  • AND: A song exists that belongs to "Organization B".
  • WHEN: The administrator from "Organization A" attempts to access the "Edit Song" page for the song belonging to "Organization B".
  • THEN: The system denies access and returns a "Not Found" or "Unauthorized" error.

Scenario 4: Invalid Song Edit

  • Scenario Name: Administrator attempts to save a song with invalid data.
  • GIVEN: An administrator is on the "Edit Song" form.
  • WHEN: The administrator clears the title field, leaving it blank.
  • AND: They click the "Save" button.
  • THEN: The system does not save the changes.
  • AND: It displays a validation error message, such as "Title can't be blank," next to the title field.
  • AND: The form remains on the screen with the invalid data entered by the user.

3. UI/UX Flow

  1. Navigate to Song List: The Administrator navigates to the /admin/songs page, which displays a table of all songs.
  2. Initiate Edit: The Administrator clicks the "Edit" button next to a song in the list.
  3. Display Edit Form: The system navigates to /admin/songs/:id/edit. The page displays a form with the following fields pre-populated with the song's current data:
    • Title (text input)
    • Body (textarea)
  4. Modify and Save: The Administrator modifies the Title and/or Body and clicks the "Save" button.
  5. Confirm and Redirect: The system saves the changes to the database, displays a flash message saying "Song updated successfully," and redirects the Administrator back to the song list at /admin/songs.
  6. Cancel Edit: If the Administrator clicks the "Cancel" button, the system discards any changes and redirects them back to the song list at /admin/songs.

4. Permissions

  • Administrator:
    • Can access the "Edit Song" page.
    • Can view and modify the title and body fields.
    • Can save changes to a song within their own organization.
  • Congregation Member:
    • Cannot access the "Edit Song" page.
    • Any attempt to navigate to the edit URL will result in an "Unauthorized" error.
  • Unauthenticated User:
    • Cannot access the "Edit Song" page.
    • Any attempt to navigate to the edit URL will result in a redirection to the login page.

5. Out of Scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions