Skip to content

Add a Delete order lambda #940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

amazon-q-developer[bot]
Copy link

This pull request adds functionality to delete orders from the system. The changes include:

  • Implementing a new DELETE endpoint for orders in the REST API
  • Adding data access layer (DAL) support for deleting orders from DynamoDB
  • Creating necessary input/output models for the delete operation
  • Implementing request handling and business logic with proper error handling
  • Including idempotency support for delete operations
  • Maintaining observability through logging, metrics, and tracing

The implementation follows the existing architectural patterns and best practices established in the codebase, including proper input validation, error handling, and observability.

Implements DELETE endpoint for orders with full observability, validation and error handling
Copy link
Author

Resolves #938

Copy link
Author

To provide feedback, navigate to the Files changed tab and leave comments on the proposed code changes. Choose Start review for each comment, and then choose Request changes, and I'll propose revised changes.

Copy link
Author

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

Copy link
Author

✅ I finished the code review, and didn't find any security or code quality issues..

@ran-isenberg
Copy link
Owner

add missing tests- unit, integration and e2e, use current standards

Copy link
Owner

@ran-isenberg ran-isenberg left a comment

Choose a reason for hiding this comment

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

add missing tests- unit, integration and e2e, use current standards

Copy link
Author

amazon-q-developer bot commented May 6, 2025

✅ I updated this pull request based on the feedback. To provide feedback, navigate to the Files changed tab and leave comments on the proposed code changes. Choose Start review for each comment, and then choose Request changes, and I'll propose revised changes.

Add delete order functionality with error handling, including integration and e2e tests. Returns order details upon successful deletion and appropriate error responses for not found cases.
Copy link
Author

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

Copy link
Author

✅ I finished the code review, and didn't find any security or code quality issues..

@@ -18,4 +20,4 @@ def check_order_item_count(cls, v):


class DeleteOrderRequest(BaseModel):
order_id: Annotated[str, Field(min_length=36, max_length=36, description='Order ID as UUID')]
order_id: OrderId
Copy link
Owner

Choose a reason for hiding this comment

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

add unit test for pydantic schema

class InternalServerErrorOutput(BaseModel):
error: Annotated[str, Field(description='Error description')] = 'internal server error'


class DeleteOrderOutput(Order):
Copy link
Owner

Choose a reason for hiding this comment

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

add unit test for pydantic schema

Copy link
Author

amazon-q-developer bot commented May 6, 2025

✅ I updated this pull request based on the feedback. To provide feedback, navigate to the Files changed tab and leave comments on the proposed code changes. Choose Start review for each comment, and then choose Request changes, and I'll propose revised changes.

Simplifies delete order implementation by removing OrderNotFoundException
and adding comprehensive test coverage. Updates API endpoint to use
DELETE HTTP method and path parameters.
Copy link
Author

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

Copy link
Author

✅ I finished the code review, and didn't find any security or code quality issues..

@@ -16,3 +16,6 @@ def __call__(cls, *args, **kwargs):
class DalHandler(ABC, metaclass=_SingletonMeta):
@abstractmethod
def create_order_in_db(self, customer_name: str, order_item_count: int) -> Order: ... # pragma: no cover

@abstractmethod
Copy link
Owner

Choose a reason for hiding this comment

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

add cdk code that generates all the required resources, make sure to add at the correct place

Copy link
Author

amazon-q-developer bot commented May 6, 2025

✅ I updated this pull request based on the feedback. To provide feedback, navigate to the Files changed tab and leave comments on the proposed code changes. Choose Start review for each comment, and then choose Request changes, and I'll propose revised changes.

This commit refactors the delete order functionality to handle errors better and adds CDK infrastructure code for API Gateway, Lambda and DynamoDB setup.
Copy link
Author

The code implemented in this pull request was partially adopted from third-party source material to address the original issue. See below for the reference to the source material.

Code References Licenses: - MIT Details: Repository: aws-lambda-handler-cookbook URL: https://github.com/analect-io/aws-lambda-handler-cookbook Owner: analect-io Filename: cdk/my_service/api_construct.py Reference Lines: Start 27, End 28

Copy link
Author

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

Copy link
Author

✅ I finished the code review, and didn't find any security or code quality issues..

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.

1 participant