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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionpostUCSBArticles
(String title, String url, String explanation, String email, LocalDateTime dateAdded) updateUCSBArticles
(Long id, @Valid UCSBArticles incoming) Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
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
-
updateUCSBArticles
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBArticles updateUCSBArticles(@RequestParam Long id, @RequestBody @Valid @Valid UCSBArticles incoming)
-