Skip to content

feature/API-64/notify-order-update-only-by-socket#95

Merged
andres15alvarez merged 2 commits into
devfrom
feature/API-64/notify-order-update-only-by-socket
May 14, 2025
Merged

feature/API-64/notify-order-update-only-by-socket#95
andres15alvarez merged 2 commits into
devfrom
feature/API-64/notify-order-update-only-by-socket

Conversation

@andres15alvarez
Copy link
Copy Markdown
Member

This pull request introduces a new WebSocket DTO (UpdateDeliveryWsDTO) and updates the OrderGateway to handle delivery updates via WebSocket. It also includes improvements to error handling, validation, and role-based access control for the new functionality.

New DTO and WebSocket Integration:

  • src/order/dto/order-delivery.dto.ts: Added a new DTO class, UpdateDeliveryWsDTO, to handle delivery updates via WebSocket. It includes fields for the delivery ID, status, and optional employee ID, with appropriate validation and metadata decorators.
  • src/order/order.gateway.ts: Imported the new UpdateDeliveryWsDTO to support the delivery update functionality.

Gateway Enhancements:

  • src/order/order.gateway.ts: Added a new WebSocket event handler, updateDelivery, to update delivery information. This handler validates the incoming data, checks user permissions, and emits a deliveryUpdated event to notify relevant users about the update.

Validation and Error Handling:

  • src/order/order.gateway.ts: Integrated ValidationPipe for structured validation of incoming WebSocket messages, with a custom exception factory to raise WsException on validation errors.

Role-Based Access Control:

  • src/order/order.gateway.ts: Applied AuthGuardWs and RolesGuardWs to the updateDelivery method, restricting access to users with ADMIN or BRANCH_ADMIN roles.

@andres15alvarez andres15alvarez self-assigned this May 10, 2025
@andres15alvarez andres15alvarez added the feature New feature or request label May 10, 2025
@andres15alvarez andres15alvarez marked this pull request as ready for review May 14, 2025 14:49
@andres15alvarez andres15alvarez merged commit bb2b59a into dev May 14, 2025
2 checks passed
@andres15alvarez andres15alvarez deleted the feature/API-64/notify-order-update-only-by-socket branch May 14, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant