Class ArticlesController

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

@RequestMapping("/api/articles") @RestController public class ArticlesController extends ApiController
  • Constructor Details

    • ArticlesController

      public ArticlesController()
  • Method Details

    • allArticles

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<Article> allArticles()
    • postArticle

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Article postArticle(@RequestParam String title, @RequestParam String url, @RequestParam String explanation, @RequestParam String email, @RequestParam("dateAdded") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateAdded)
    • getById

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Article updateArticleById(@RequestParam Long id, @RequestBody Article incoming)
    • deleteArticleById

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public org.springframework.http.ResponseEntity<String> deleteArticleById(@RequestParam Long id)