[R9] User service class with find user by login method

This commit is contained in:
Mirna Gama 2024-01-11 14:49:22 -03:00 committed by Mirna Gama
parent 20ba14e47e
commit e97f9b3cfe
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,36 @@
package com.mirna.hospitalmanagementapi.application.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
import com.mirna.hospitalmanagementapi.application.usecase.user.FindUserByLoginUseCase;
import com.mirna.hospitalmanagementapi.domain.services.UserService;
/**
* This class is an implementation of the UserService interface.
*
* This class provides methods to perform operations on User entity
*
* @author Mirna Gama
* @version 1.0
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
private FindUserByLoginUseCase findUserByLogin;
/**
* Finds a stored user information by login.
*
* @param id A long representing the user's system login
* @return The corresponding user information if successful, or null if it is non-existent.
*/
@Override
public UserDetails findUserByLogin(String login) {
return findUserByLogin.execute(login);
}
}

View File

@ -0,0 +1,22 @@
package com.mirna.hospitalmanagementapi.domain.services;
import org.springframework.security.core.userdetails.UserDetails;
/**
* User service interface for managing user information.
*
* @see User
* @author Mirna Gama
* @version 1.0
*/
public interface UserService {
/**
* Finds a stored user information by login.
*
* @param id A long representing the user's system login
* @return The corresponding user information if successful, or null if it is non-existent.
*/
public UserDetails findUserByLogin(String login);
}