Class HotelsController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.HotelsController

@RequestMapping("/api/hotels") @RestController public class HotelsController extends ApiController
  • Constructor Details

    • HotelsController

      public HotelsController()
  • Method Details

    • allHotels

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<Hotel> allHotels()
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public Hotel getById(@RequestParam Long id)
    • postHotel

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Hotel postHotel(@RequestParam String name, @RequestParam String address, @RequestParam String description) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteHotel

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteHotel(@RequestParam Long id)
    • updateHotel

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Hotel updateHotel(@RequestParam Long id, @RequestBody @Valid @Valid Hotel incoming)