Class UserService

java.lang.Object
com.mindstore.backend.service.UserService

@Service public class UserService extends Object
Service class for user entity
  • Constructor Details

    • UserService

      public UserService(UserRepository userRepository)
      user service
      Parameters:
      userRepository - repository for user actions
  • Method Details

    • findAll

      public List<User> findAll()
      function: searches for all users in the user repo
      Returns:
      a list of users available
    • save

      public User save(User user)
      function: adds a new user to the user repo
      Parameters:
      user - the user we want to save
      Returns:
      the saved User
    • findUserById

      public Optional<User> findUserById(Long id)
      function: find a specific user in the user repo
      Parameters:
      id - - the user id we are searching for
      Returns:
      an Optional User
    • deleteUserById

      public void deleteUserById(Long id)
      function: deletes a user from the user repo
      Parameters:
      id - the id of the user we want to delete
    • getRecentUser

      public User getRecentUser(String email, LocalDateTime createdAt)
      function: search for a user with email that was created before a specific Date
      Parameters:
      email - string of the user we are looking for
      createdAt - LocalDateTime of user creation
      Returns:
      User that is found with that query