package com.finki.icare.controller; import com.finki.icare.dto.PatientDTO; import com.finki.icare.dto.TherapistDTO; import com.finki.icare.service.TherapistService; import com.finki.icare.utils.AuthUtils; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/api/therapists") @CrossOrigin(origins = "http://localhost:3000") @RequiredArgsConstructor public class TherapistController { private final TherapistService therapistService; @GetMapping public ResponseEntity> getAllTherapists() { List therapists = therapistService.getAllTherapistsWithFreeSlots(); return ResponseEntity.ok(therapists); } @GetMapping("/patients") public ResponseEntity> getTherapistPatients(Authentication authentication) { Integer therapistId = AuthUtils.getUserId(authentication); List patients = therapistService.getTherapistPatients(therapistId); return ResponseEntity.ok(patients); } }