Skip to content
Snippets Groups Projects

Deploy

1 file
+ 5
4
Compare changes
  • Side-by-side
  • Inline
@@ -20,7 +20,8 @@ package nl.tudelft.queue.controller;
@@ -20,7 +20,8 @@ package nl.tudelft.queue.controller;
import nl.tudelft.queue.service.AdminService;
import nl.tudelft.queue.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.http.HttpStatus;
 
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
@@ -39,10 +40,10 @@ public class RoomController {
@@ -39,10 +40,10 @@ public class RoomController {
*/
*/
@PreAuthorize("@permissionService.isAuthenticated()")
@PreAuthorize("@permissionService.isAuthenticated()")
@GetMapping("/room/map/{id}")
@GetMapping("/room/map/{id}")
public @ResponseBody String getRoomImageFile(@PathVariable("id") Long id) {
public ResponseEntity<String> getRoomImageFile(@PathVariable("id") Long id) {
String fileName = adminService.getRoomFileName(id);
String fileName = adminService.getRoomFileName(id);
if (fileName == null)
if (fileName == null)
throw new ResourceNotFoundException();
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
return "{\"fileName\": \"" + fileName + "\"}";
return ResponseEntity.ok("{\"fileName\": \"" + fileName + "\"}");
}
}
}
}
Loading