corregir metodo de getTeamLeadName
All checks were successful
PR Builder / Build-PR (pull_request) Successful in 2m46s
All checks were successful
PR Builder / Build-PR (pull_request) Successful in 2m46s
This commit is contained in:
parent
0e142934fa
commit
9e53bc33d7
Binary file not shown.
@ -9,8 +9,7 @@ import java.util.UUID;
|
||||
|
||||
public interface EmployeeRepository extends JpaRepository<Employee, UUID> {
|
||||
Optional<Employee> findByUsername(String username);
|
||||
|
||||
Optional<Employee> findByPersonalEmail(String personalEmail);
|
||||
Optional<Employee> findByTeamId(UUID teamId);
|
||||
List<Employee> findAllByTeamId(UUID teamId);
|
||||
List<Employee> findByTeamName(String teamName);
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
package com.primefactorsolutions.service;
|
||||
import com.google.common.base.Strings;
|
||||
import com.primefactorsolutions.model.Employee;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -50,7 +51,10 @@ public class EmployeeService {
|
||||
|
||||
public String getTeamLeadName(final UUID teamId) {
|
||||
// Encuentra al empleado con el rol de lead_manager en el equipo especificado
|
||||
Optional<Employee> leadManager = employeeRepository.findByTeamId(teamId);
|
||||
List<Employee> teamMembers = employeeRepository.findAllByTeamId(teamId);
|
||||
Optional<Employee> leadManager = teamMembers.stream()
|
||||
.filter(e -> Strings.isNullOrEmpty(e.getLeadManager()))
|
||||
.findFirst();
|
||||
|
||||
return leadManager.map(employee -> employee.getFirstName() + " " + employee.getLastName())
|
||||
.orElse("No asignado");
|
||||
|
Loading…
Reference in New Issue
Block a user