Skip to content

Add Customer Deletion with Confirmation Dialog#2

Open
Copilot wants to merge 7 commits intomainfrom
copilot/fix-1
Open

Add Customer Deletion with Confirmation Dialog#2
Copilot wants to merge 7 commits intomainfrom
copilot/fix-1

Conversation

Copy link
Contributor

Copilot AI commented May 27, 2025

This PR implements the ability to delete customers with a confirmation step.

What's added

Backend

  • Added DeleteCustomer handler with proper entity lookup and validation
  • Extended CustomerModule with DELETE endpoint for /customers/{customerId}
  • Added appropriate error handling for non-existent customers

Frontend

  • Added deleteCustomer() method to CustomersService
  • Updated CustomerDetailsComponent with delete button and confirmation dialog
  • Added proper styling for the confirmation UI
  • Implemented error handling for failed deletion attempts
  • Added navigation back to overview after successful deletion

Tests

  • Backend: Added unit tests for the DeleteCustomer handler covering success and not-found cases
  • Frontend: Added comprehensive tests for the deletion confirmation workflow

Screenshots

N/A (The UI changes add a delete button and confirmation dialog to the customer details page)

Implementation Notes

  • Follows project architecture with vertical slice approach
  • Maintains existing error handling patterns
  • Uses Angular signals for managing UI state
  • Implements confirmation dialog inline rather than as a separate component for simplicity

Fixes #1.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: timdeschryver <28659384+timdeschryver@users.noreply.github.com>
Copilot AI changed the title [WIP] Deleting customers Add Customer Deletion with Confirmation Dialog May 27, 2025
Copilot AI requested a review from timdeschryver May 27, 2025 09:51
@timdeschryver
Copy link
Owner

@copilot redirect to the customers overview page after deleting the customer.

Co-authored-by: timdeschryver <28659384+timdeschryver@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 27, 2025

@copilot redirect to the customers overview page after deleting the customer.

I've updated the navigation to redirect to the customers overview page after deletion. Instead of using a relative path with router.navigate(['../'], { relativeTo: null }), I've changed it to use an absolute path with router.navigate(['/customers']) for more reliable navigation. The corresponding test has also been updated. Commit: 2c823bb

@timdeschryver
Copy link
Owner

@copilot it should be a relative path, but you need to provide the activated route to it.

Co-authored-by: timdeschryver <28659384+timdeschryver@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 27, 2025

@copilot it should be a relative path, but you need to provide the activated route to it.

I've updated the navigation to use a relative path with the ActivatedRoute. Now the component injects ActivatedRoute and uses it in the router.navigate call with router.navigate(['../'], { relativeTo: this.route }). The tests have also been updated accordingly. Commit: d6a1da5

- Update customer delete method to use relative navigation with ActivatedRoute
- Replace absolute path '/customers' with relative path '..'
- Pass activatedRoute to navigate method for proper context
- Update test to match the new navigation approach

Co-authored-by: timdeschryver <28659384+timdeschryver@users.noreply.github.com>
Copy link
Owner

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot extend the playwright test by deleting the newly created customer.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Revert this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the package-lock.json file from the Sandbox.AngularWorkspace directory. Commit: d96f675

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot delete these tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've deleted the DeleteCustomerTests.cs file as requested. Commit: d96f675

Co-authored-by: timdeschryver <28659384+timdeschryver@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 27, 2025

@copilot extend the playwright test by deleting the newly created customer.

I've extended the Playwright test to include deleting the newly created customer. The test now creates a customer, opens its details page, and then deletes it with confirmation. After deletion, it verifies that we're redirected to the customers list and that the deleted customer no longer appears in the list. Commit: ceb2633

Co-authored-by: timdeschryver <28659384+timdeschryver@users.noreply.github.com>
@timdeschryver timdeschryver marked this pull request as ready for review May 27, 2025 16:28
@timdeschryver timdeschryver force-pushed the main branch 4 times, most recently from 66ee574 to e901d24 Compare July 13, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting customers

2 participants

Comments