|
@@ -17,14 +17,14 @@ class ProjectController(
|
|
) {
|
|
) {
|
|
|
|
|
|
@GetMapping("/projects")
|
|
@GetMapping("/projects")
|
|
- fun getProject(@RequestParam(required = false) name: String?): ResponseEntity<List<Project>?> {
|
|
|
|
|
|
+ fun getProject(@RequestParam(required = false) name: String?): Any {
|
|
return try {
|
|
return try {
|
|
val projects: List<Project> =
|
|
val projects: List<Project> =
|
|
if (name == null) projectRepository.findAll() as List<Project> else projectRepository.findByNameContaining(
|
|
if (name == null) projectRepository.findAll() as List<Project> else projectRepository.findByNameContaining(
|
|
name
|
|
name
|
|
) as List<Project>
|
|
) as List<Project>
|
|
if (projects.isEmpty()) {
|
|
if (projects.isEmpty()) {
|
|
- ResponseEntity<List<Project>?>(HttpStatus.NO_CONTENT)
|
|
|
|
|
|
+ arrayOf<String>()
|
|
} else ResponseEntity<List<Project>?>(projects, HttpStatus.OK)
|
|
} else ResponseEntity<List<Project>?>(projects, HttpStatus.OK)
|
|
} catch (e: Exception) {
|
|
} catch (e: Exception) {
|
|
ResponseEntity<List<Project>?>(null, HttpStatus.INTERNAL_SERVER_ERROR)
|
|
ResponseEntity<List<Project>?>(null, HttpStatus.INTERNAL_SERVER_ERROR)
|