Skip to content

Mail functionality added#26

Closed
Goktugberke wants to merge 6 commits into#m-31from
dev
Closed

Mail functionality added#26
Goktugberke wants to merge 6 commits into#m-31from
dev

Conversation

@Goktugberke
Copy link
Contributor

No description provided.

Goktugberke and others added 6 commits October 3, 2025 15:39
Adds chat history retrieval, search, delete, and rename functionalities, enhancing user chat management capabilities.
Integrates CustomOAuth2UserService for user authentication and authorization.
Updates user model with fields from OAuth2, facilitating seamless user data handling.
Added Files:
- user/UserService.java: Service layer for user operations with @transactional support
- chat/dto/ChatRenameRequest.java: DTO with validation annotations for chat rename requests
- error/UnauthorizedAccessException.java: Custom exception for authorization failures (403)
- error/ChatNotFoundException.java: Custom exception for chat not found errors (404)

Modified Files:
- chat/controller/ChatController.java: Added @Valid annotation and userId parameters for authorization
- chat/service/ChatService.java: Implemented ownership validation for all chat operations
- error/GlobalExceptionHandler.java: Added handlers for UnauthorizedAccessException and ChatNotFoundException
- security/CustomOAuth2UserService.java: Standardized to use "sub" claim and added null checks
- user/model/Users.java: Changed ID type from UUID to String for OAuth2 compatibility

Key Changes:
- Transaction management: Streak operations now use @transactional in service layer
- Input validation: Bean Validation added for chat rename with @notblank, @SiZe, @pattern
- Authorization: All chat operations now verify user ownership before execution
- Security: Consistent exception handling across authentication and authorization flows

Breaking Changes:
- ChatService methods now require userId parameter for authorization checks
- Users entity ID changed from UUID to String
Enhances OAuth2 user authentication by adding checks to ensure the principal is an OidcUser and provides fallback mechanism to fetch email.

Refactors chat title validation by introducing a constant for the title pattern, improving code readability and maintainability.

Adds documentation explaining the streak freeze count.
Implement transaction management, validation, and authorization
Improves the `UserNotAuthenticatedException` by adding constructors to handle more specific error messages and include a cause.

This provides better context and debugging information when a user
is not properly authenticated.
Enhances UserNotAuthenticatedException
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.

2 participants