Class StaffController
java.lang.Object
edu.ucsb.cs156.happiercows.controllers.ApiController
edu.ucsb.cs156.happiercows.controllers.StaffController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallStaff()deleteStaff(Long id) getStaffById(Long id) staffForCourse(Long courseId) updateStaff(Long id, StaffDTO staffDTO) uploadStaffCsv(Long courseId, org.springframework.web.multipart.MultipartFile file) Bulk-adds staff to a course from an uploaded CSV file, with a single fixed header format (lastName,firstMiddleName,email).Methods inherited from class ApiController
genericMessage, getCurrentUser, handleBadRequest, handleForbidden, handleGenericException
-
Constructor Details
-
StaffController
public StaffController()
-
-
Method Details
-
allStaff
-
staffForCourse
-
getStaffById
-
postStaff
-
updateStaff
-
deleteStaff
-
uploadStaffCsv
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping(value="/upload/csv", consumes="multipart/form-data") public CsvUploadResult uploadStaffCsv(@RequestParam Long courseId, @RequestParam("file") org.springframework.web.multipart.MultipartFile file) throws IOException Bulk-adds staff to a course from an uploaded CSV file, with a single fixed header format (lastName,firstMiddleName,email). Rows whose email is already on the course's staff list are skipped rather than duplicated.- Parameters:
courseId- the course to add the staff tofile- the uploaded CSV file- Returns:
- a summary of how many staff were created, and which emails were skipped as already-on-roster
- Throws:
IOException
-