Implement edit and delete operations for custom menu entries (US2)#3308
Implement edit and delete operations for custom menu entries (US2)#3308
Conversation
8476d5e to
1dcd3c8
Compare
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
|
@copilot fix unit tests |
Fixed in commit e315ced. All 29 MenuEntry tests now passing (was 26/29). The issue was incorrect HTTP content type assertions - tests expected |
|
@copilot some tests still failed |
Fixed in commit 8ea8478. All 1610 tests now passing (was 1577/1610). The issue was that NavMenu and MainLayout tests were missing the |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3308 +/- ##
==========================================
- Coverage 81.38% 79.83% -1.56%
==========================================
Files 376 387 +11
Lines 14360 14845 +485
Branches 1224 1282 +58
==========================================
+ Hits 11687 11851 +164
- Misses 2295 2605 +310
- Partials 378 389 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…tries) Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
…d migrations for MenuEntry - Added MenuEntryRead and MenuEntryWrite permissions to PortalPermissions enum - Added menu entry policies (GetAllMenuEntries, GetMenuEntry, CreateMenuEntry, UpdateMenuEntry, DeleteMenuEntry, UpdateMenuEntryOrder) - Created MenuEntry entity with properties: Id, Name, Url, Order, IsEnabled, IsExternal, CreatedAt, UpdatedAt - Created MenuEntryDto with validation attributes - Created IMenuEntryRepository interface with GetByNameAsync method - Implemented MenuEntryRepository - Added MenuEntries DbSet to PortalDbContext - Created database migrations for PostgreSQL and MySQL - Registered MenuEntryRepository in DI container Completed tasks: T001-T009
- Created IMenuEntryService interface with CRUD and order management methods
- Created MenuEntryProfile AutoMapper configuration
- Implemented MenuEntryService with validation:
* Name required, max 100 chars
* Valid HTTP/HTTPS URL format
* Duplicate name check
* Auto-detect external URLs
- Created MenuEntriesController with REST API endpoints:
* POST /api/menu-entries - Create menu entry (menuentry:write)
* GET /api/menu-entries - List all menu entries (menuentry:read)
* GET /api/menu-entries/{id} - Get single menu entry (menuentry:read)
* PUT /api/menu-entries/{id} - Update menu entry (menuentry:write)
* DELETE /api/menu-entries/{id} - Delete menu entry (menuentry:write)
* PATCH /api/menu-entries/{id}/order - Update order (menuentry:write)
- Registered MenuEntryService in DI container
- Added proper error handling: 400 Bad Request, 401 Unauthorized, 404 Not Found, 409 Conflict, 500 Internal Server Error
Completed tasks: T015-T022
- Created IMenuEntryClientService interface with all CRUD methods
- Implemented MenuEntryClientService using HttpClient:
* CreateMenuEntry - POST to /api/menu-entries
* GetMenuEntries - GET /api/menu-entries
* GetMenuEntryById - GET /api/menu-entries/{id}
* UpdateMenuEntry - PUT /api/menu-entries/{id}
* DeleteMenuEntry - DELETE /api/menu-entries/{id}
* UpdateMenuEntryOrder - PATCH /api/menu-entries/{id}/order
- Registered MenuEntryClientService in Program.cs DI container
- Added proper error handling with EnsureSuccessStatusCode
Completed tasks: T023-T025
…u integration) Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
…tries) Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
- Add edit and delete functionality for menu entries - Implement PUT and DELETE endpoints in MenuEntriesController - Add UpdateMenuEntry and DeleteMenuEntry methods to MenuEntryService - Create EditMenuEntryDialog component for editing entries - Add edit and delete buttons to MenuEntryListPage with confirmation - Update MenuEntryClientService with update and delete operations - Fix migration files to follow code style conventions - Update controller to return 204 No Content for successful updates - Reorganize validation order in MenuEntryService (URL before duplicate check) - Add proper error handling for 404 Not Found responses - Mark tasks T036-T056 as complete in tasks.md All core US2 tests passing (26/29 total MenuEntry tests pass)
…ntService Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
Co-authored-by: kbeaugrand <9513635+kbeaugrand@users.noreply.github.com>
8ea8478 to
67ebf97
Compare
Description
What's new?
Adds full CRUD capabilities to custom menu entries feature. User Story 1 (create/list) was complete; this implements User Story 2 (edit/delete).
Backend changes:
PUT /api/menu-entries/{id}- Updates entry with validation (name uniqueness excluding self, URL format, 100 char limit)DELETE /api/menu-entries/{id}- Hard deletes entry after existence checkmenuentry:writeauthorizationFrontend changes:
Test coverage:
PostAsJsonAsync/PutAsJsonAsync/PatchAsJsonAsyncimplementationIMenuEntryClientServicemock to NavMenu and MainLayout test fixtures to support component renderingValidation enforced:
What kind of change does this PR introduce?
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.