llTheBlankll / attendance-system-api-springboot

This project is an Attendance System API built using Spring Boot, WebSocket, and JWT Authentication. The system provides a robust solution for tracking and managing attendance records, with support for real-time updates through WebSocket communication. This attendance is based on the education system of the Philippines
GNU General Public License v3.0
5 stars 3 forks source link

Cannot invoke "com.pshs.attendance_system.entities.User.toDTO()" because the return value of "com.pshs.attendance_system.entities.Teacher.getUser()" is null #36

Open llTheBlankll opened 3 months ago

llTheBlankll commented 3 months ago

Describe the bug A clear and concise description of what the bug is.

Failed to complete request: java.lang.NullPointerException: Cannot invoke "com.pshs.attendance_system.entities.User.toDTO()" because the return value of "com.pshs.attendance_system.entities.Teacher.getUser()" is null

This happens when a teacher that has no user account is searched to picked up by the API which causes an error.

To Reproduce Steps to reproduce the behavior:

  1. Making a request to this endpoint /api/v1/teachers/search?firstName=Shepperd&page=0&size=10,

Expected behavior A clear and concise description of what you expected to happen. A JSON content that contains the paging of the teachers.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.