[R2] Add get method in doctor controller

This commit is contained in:
Mirna Gama 2024-01-04 16:59:33 -03:00 committed by Mirna Gama
parent 6ad63db9d1
commit 74616bae4e

View File

@ -1,13 +1,17 @@
package com.mirna.hospitalmanagementapi.application.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mirna.hospitalmanagementapi.domain.dtos.DoctorDTO;
import com.mirna.hospitalmanagementapi.domain.dtos.DoctorPublicDataDTO;
import com.mirna.hospitalmanagementapi.domain.entities.Doctor;
import com.mirna.hospitalmanagementapi.domain.services.DoctorService;
@ -43,4 +47,19 @@ public class DoctorController {
return ResponseEntity.ok(doctor);
}
/**
* Get method to receive a list of objects containing data transfer objects with Doctor public information
*
* @param
*
* @return A response entity containing the list of doctors if successful
*/
@GetMapping
public ResponseEntity<Object> getDoctors() {
List<DoctorPublicDataDTO> doctors = doctorService.findDoctors();
return ResponseEntity.ok(doctors);
}
}