Skip to content

Commit a623e6c

Browse files
committed
Fix bugs in NotificationServiceImpl and StudentServiceImpl
1 parent f0d5c4c commit a623e6c

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

BackEnd/No-Country-simulation/src/main/java/com/school/service/implementation/StudentServiceImpl.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,12 @@ public DeleteResponse delete(Long id) {
154154

155155
public StudentResponse verifyChildByDni(String dni) {
156156
// Buscar el hijo por DNI
157-
Student student = studentRepository.findByDniWithParents(dni)
157+
Student student = studentRepository.findByDni(dni)
158158
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND,
159159
"Child not found with DNI: " + dni));
160160

161-
// Obtener la lista de padres
162-
Set<Parent> parents = student.getParents();
163-
164-
if (parents == null || parents.isEmpty()) {
165-
throw new ResponseStatusException(HttpStatus.NOT_FOUND,
166-
"No parents found for the child with DNI: " + dni);
167-
}
168-
Parent parent = parents.iterator().next();
169-
170161
// Devolver la información del hijo como DTO
171-
return new StudentResponse(student.getDni(), student.getName(), student.getLastName(), student.getYear(), student.getSession(), parent.getName(), parent.getLastName());
162+
return new StudentResponse(student.getDni(), student.getName(), student.getLastName(), student.getYear(), student.getSession(), null, null);
172163
}
173164

174165
public Optional<Student> findStudentByDni(String dni) {

0 commit comments

Comments
 (0)