Class AnnouncementsController

java.lang.Object
edu.ucsb.cs156.happiercows.controllers.ApiController
edu.ucsb.cs156.happiercows.controllers.AnnouncementsController

@RequestMapping("/api/announcements") @RestController public class AnnouncementsController extends ApiController
  • Constructor Details

    • AnnouncementsController

      public AnnouncementsController()
  • Method Details

    • createAnnouncement

      @PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_ADMIN\')") @PostMapping("/post") public org.springframework.http.ResponseEntity<Object> createAnnouncement(@RequestParam Long commonsId, @RequestParam(required=false) @DateTimeFormat(iso=DATE_TIME) LocalDateTime startDate, @RequestParam(required=false) @DateTimeFormat(iso=DATE_TIME) LocalDateTime endDate, @RequestParam String announcementText)
    • getAnnouncements

      @PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_ADMIN\')") @GetMapping("/all") public org.springframework.http.ResponseEntity<Object> getAnnouncements(@RequestParam Long commonsId)
    • getAnnouncementById

      @PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_ADMIN\')") @GetMapping("/getbyid") public org.springframework.http.ResponseEntity<Object> getAnnouncementById(@RequestParam Long id)
    • editAnnouncement

      @PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_ADMIN\')") @PutMapping("/put") public org.springframework.http.ResponseEntity<Object> editAnnouncement(@RequestParam Long id, @RequestParam Long commonsId, @RequestParam(required=false) @DateTimeFormat(iso=DATE_TIME) LocalDateTime startDate, @RequestParam(required=false) @DateTimeFormat(iso=DATE_TIME) LocalDateTime endDate, @RequestParam String announcementText)
    • deleteAnnouncement

      @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\')") @DeleteMapping("") public org.springframework.http.ResponseEntity<Object> deleteAnnouncement(@RequestParam Long id)