Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several changes to the chat functionality, enhancing the way user-specific chats are retrieved and stored. The key changes include adding user IDs to the
ChatReducedmodel, updating the chat repository to filter chats by user, and modifying the chat controller to handle user authentication.Enhancements to chat functionality:
pkg/models/query/chat_reduced.go: AddedUserIdsfield to theChatReducedstruct to store the IDs of users associated with each chat.Authentication and user-specific chat retrieval:
pkg/query/httphandler/controller/chat_controller.go: Imported theauthpackage to handle user authentication.pkg/query/httphandler/controller/chat_controller.go: Updated theGetChatsmethod to extract the user ID from the authentication token and pass it to the repository method for filtering chats.pkg/query/store/repository/chats_repository.go: Modified theGetAllChatsmethod to accept auserIdparameter and filter the chats by the user ID, ensuring only the chats the user is part of are retrieved.pkg/query/store/repository/chats_repository.go: Added logic to populate theUserIdsfield in theChatReducedstruct by querying the associated users for each chat.