Skip to content

Backend: Missing section UPDATE and DELETE endpoints (PUT/DELETE /sections/:id) #49

@brainless

Description

@brainless

Description

The frontend menu management system requires the ability to update and delete menu sections, but these endpoints are missing from the backend implementation.

Missing Endpoints

1. Update Menu Section

PUT /sections/:id

Expected request body:

{
  "name": "string", // optional
  "display_order": number // optional
}

2. Delete Menu Section

DELETE /sections/:id

Should also delete all menu items within the section.

Current Backend Implementation

The backend currently only has:

  • POST /restaurants/{id}/menu/sections - Create section
  • GET /restaurants/{id}/menu/sections - List sections

Frontend Code Expecting These

File: adminapp/src/services/menu.ts

  • Line 41: updateSection()
  • Line 53: deleteSection()

Used in menu management interface:
File: adminapp/src/pages/MenuDashboard.tsx

  • Line 267: Edit section functionality
  • Line 273: Delete section with confirmation

Impact

  • Cannot edit existing menu section names
  • Cannot delete menu sections
  • Users stuck with sections once created
  • Menu organization is severely limited

Acceptance Criteria

  • Implement PUT /sections/:id endpoint
  • Implement DELETE /sections/:id endpoint
  • Ensure proper authentication and authorization
  • Validate that section belongs to user's restaurant
  • Handle cascading delete of menu items when section is deleted
  • Return appropriate response codes and error messages

Technical Implementation Notes

  • DELETE should use database transaction to remove section and all items
  • UPDATE should validate display_order conflicts
  • Both endpoints should verify user has menu management permissions

Testing

If needed, I can test the edit and delete functionality using Chromium remote debugging to verify the UI interactions work correctly.

Related Issues

Estimated Effort

2-3 hours


COMPLETED - Implementation finished in PR #86

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions