Skip to content

Feat/4/support chat nest webhook#7

Open
Frompaje wants to merge 9 commits into
mainfrom
feat/4/support-chat-nest-webhook
Open

Feat/4/support chat nest webhook#7
Frompaje wants to merge 9 commits into
mainfrom
feat/4/support-chat-nest-webhook

Conversation

@Frompaje

@Frompaje Frompaje commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Closes #4

Frompaje added 9 commits May 28, 2026 16:53
…pics and idempotency key

- Updated the `conversations` table to include a `topic` field, referencing the new `conversationTopics` enum for better categorization of conversations.
- Added an `idempotencyKey` field to the `messages` table to ensure unique message submissions and prevent duplicates.
- Enhanced indexing on the `conversations` table for improved query performance based on topic and status.
- Created migration scripts to reflect these schema changes in the database.
…raints

- Introduced `conversationStatus` and `messageRole` enums to standardize status and role fields in the `conversations` and `messages` tables, respectively.
- Updated the `status` field in the `conversations` table to use the new `conversationStatus` enum.
- Changed the `role` field in the `messages` table to utilize the `messageRole` enum for better clarity.
- Added a unique constraint on the `idempotencyKey` field in the `messages` table to prevent duplicate submissions.
- Created migration scripts to implement these changes in the database schema.
…ign key constraints

- Created new tables: `conversations`, `messages`, `orders`, and `order_items` to support chat and order management functionalities.
- Introduced `conversation_topic` enum for categorizing conversations.
- Established foreign key relationships to ensure data integrity and cascading deletes.
- Added indexes to optimize query performance for common operations.
- Updated migration journal to reflect the new schema changes.
- Introduced `ACCESS_TOKEN_COOKIE_NAME` constant for consistent access token management.
- Added `CONVERSATION_TOPIC_VALUES` array to define standard conversation topics with a corresponding type.
- Updated the `index.ts` file to export the new constants and types for broader accessibility.
- Created a new `oneHourInMs` constant for time management.
- Refactored the `SendChatMessageDto` to utilize the new conversation topic constants and added a context for chat message details.
- Introduced `ConversationRepository` to manage conversation-related database operations, including finding open conversations, creating new conversations, and appending messages.
- Added new DTO exports in `index.ts` for `SendChatMessageDto` and `ChatMessageContextDto` to facilitate data transfer in chat functionalities.
- Implemented methods for querying and updating conversation data, enhancing the chat management capabilities of the application.
- Added `@nestjs/platform-socket.io` and `@nestjs/websockets` dependencies to enhance real-time communication capabilities.
- Introduced a new `userRole` enum to standardize user roles in the database schema.
- Refactored the `role` field in the `users` table to utilize the new `userRole` enum for improved clarity and maintainability.
- Removed the obsolete `ChatMessageContextDto` to streamline the DTO structure in the support module.
- Introduced `ChatModule` and `ChatGateway` to handle real-time chat interactions using WebSocket.
- Implemented `ChatRealtimeService` for managing WebSocket server interactions and emitting events to users.
- Created `SupportController` to manage chat-related API endpoints, including sending messages and managing conversations.
- Added use cases for handling agent replies, assigning conversations, and closing conversations, enhancing chat management capabilities.
- Updated package dependencies to include `@socket.io/admin-ui`, `@socket.io/redis-adapter`, and `redis` for improved WebSocket functionality and message handling.
- Added new WebSocket event handlers in `ChatGateway` for managing agent and user interactions, including joining rooms and typing indicators.
- Implemented `emitToAgents` method in `ChatRealtimeService` to broadcast messages to agents.
- Expanded `SupportController` with a new endpoint for retrieving active conversations for agents.
- Updated `ConversationRepository` to include methods for finding conversations by participant and listing active conversations.
- Introduced new components for the support chat interface, including `SupportChat`, `ChatPanel`, and `TopicSelector`, enhancing user experience.
- Integrated real-time message handling in the chat interface, allowing for dynamic updates and typing indicators.
- Updated package dependencies to include `socket.io-client` for improved WebSocket communication.
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.

feat: chatbot de atendimento com webhook no NestJS

1 participant