fleencorp / fleen-feen

Fleen Feen connects you with the world
GNU General Public License v3.0
0 stars 1 forks source link

Implement Follower Service, OAuth2 Enhancements, and Localization Support #19

Closed aalamu closed 2 months ago

aalamu commented 2 months ago

Description:

This pull request addresses the following key features and improvements based on JIRA Ticket FLEENFEEN-10:

  1. Follower Service Implementation:

    • Added FollowerService to handle user following functionalities:
      • Retrieve the list of users that a given user is following.
      • Retrieve the list of followers for a user.
      • Follow and unfollow users.
    • Created response classes to encapsulate data related to followers and following actions.
    • Integrated these functionalities into the existing user management system.
  2. OAuth2 Enhancements:

    • Removed unused Oauth2AuthorizationRepository.findByMember(Member) method.
    • Refactored repository calls in GoogleOauth2Service and LiveBroadcastServiceImpl to use findByMemberAndServiceType(Member, Oauth2ServiceType).
    • Added methods for handling OAuth2 token refresh and checking token expiry.
    • Updated Oauth2AuthenticationRequest to include refreshToken and Oauth2Authorization.
    • Renamed googleOauthAuthorizationId to oauth2AuthorizationId in the Oauth2Authorization entity for consistency.
  3. Localization Support:

    • Introduced ApiResponse and LocalizedResponse classes to enable localized messaging in response classes.
    • Created message source files for error, response, and default messages.
    • Configured MessageSource to manage different message sources in MessageSourceConfiguration.
    • Updated services, including AuthenticationServiceImpl and MfaServiceImpl, to return localized responses based on the user's locale.
    • Added message keys to response classes extending ApiResponse for localization.
  4. General Refactoring and Bug Fixes:

    • Conducted general refactoring across various classes and methods to improve code quality and maintainability.
    • Added of(String) method to all enums for easier creation of enum instances from strings.
    • Removed redundant methods like parseEnumOrNull and used the newly added of(String) method.
    • Refactored MfaService and AuthenticationService for enhanced security and functionality.
    • Fixed bugs related to MFA code verification and message publishing in ProfileRequestPublisher.
    • Enabled JPA Auditing and added EntityListener to FleenFeenEntity for automatic management of timestamps.
    • Updated Liquibase migration scripts to reflect changes in the Oauth2Authorization entity and reordered SQL insert statements.
  5. Additional Implementations:

    • Implemented UserDetailsServiceImpl for managing user details.
    • Added and updated various controllers such as AuthenticationController, MfaController, VerificationController, and Oauth2Controller.
    • Created new methods for handling user sign-up and location details.
    • Implemented MaskedEmailAddress and MaskedPhoneNumber classes to mask sensitive data.

Testing:

Notes: