Class UCSBArticlesController

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

@RequestMapping("/api/ucsbarticles") @RestController public class UCSBArticlesController extends ApiController
  • Constructor Details

    • UCSBArticlesController

      public UCSBArticlesController()
  • Method Details

    • allUCSBArticles

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBArticles> allUCSBArticles()
    • postUCSBArticles

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBArticles postUCSBArticles(@RequestParam String title, @RequestParam String url, @RequestParam String explanation, @RequestParam String email, @RequestParam("dateAdded") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateAdded) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getById

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

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

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