Package se.bth.pulse.controller
Class ProjectAdminRestController
java.lang.Object
se.bth.pulse.controller.ProjectAdminRestController
This class is a REST controller that exposes endpoints for project administration.
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
createProject
(String name, String description, Project.ReportInterval reportInterval, Date startDate, Date endDate) This method is used to create a new project.org.springframework.http.ResponseEntity
deleteUser
(Integer id) Rest endpoint for deleting a project.org.springframework.http.ResponseEntity
editProject
(Integer id, String name, String description, Project.ReportInterval reportInterval, Date startDate, Date endDate) This method is used to edit a project.org.springframework.http.ResponseEntity
editProjectUsers
(se.bth.pulse.controller.ProjectAdminRestController.Payload payload) This method is used to edit the users connected to a project.
-
Method Details
-
createProject
@PostMapping("/api/admin/project/add") public org.springframework.http.ResponseEntity createProject(String name, String description, Project.ReportInterval reportInterval, @DateTimeFormat(iso=DATE_TIME) Date startDate, @DateTimeFormat(iso=DATE_TIME) Date endDate) This method is used to create a new project. It takes the name, description, report interval and report day as parameters. It returns a response entity with the created project as a JSON object. If the project could not be created, it returns a response entity with an error message.- Parameters:
name
- - the name of the projectdescription
- - the description of the projectreportInterval
- - the report interval of the project- Returns:
- ResponseEntity - the response entity returned as a JSON object
-
editProject
@PostMapping("/api/admin/project/edit") public org.springframework.http.ResponseEntity editProject(Integer id, String name, String description, Project.ReportInterval reportInterval, @DateTimeFormat(iso=DATE_TIME) Date startDate, @DateTimeFormat(iso=DATE_TIME) Date endDate) This method is used to edit a project. It takes the id, name, description, report interval and report day as parameters. It returns a response entity with the edited project as a JSON object. If the project could not be edited, it returns a response entity with an error message.- Parameters:
id
- - the id of the project to be editedname
- - the new or old name of the projectdescription
- - the new or old description of the projectreportInterval
- - the new or old report interval of the project- Returns:
- ResponseEntity - the response entity returned as a JSON object
-
editProjectUsers
@PostMapping(value="/api/admin/project/users", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity editProjectUsers(@RequestBody se.bth.pulse.controller.ProjectAdminRestController.Payload payload) This method is used to edit the users connected to a project. It takes the project id and a list of user ids as parameters. It returns a response entity with the edited project as a JSON object. If the project could not be edited, it returns a response entity with an error message.- Parameters:
payload
- - the payload containing the project id and a list of user ids- Returns:
- ResponseEntity - the response entity returned as a JSON object
-
deleteUser
@Transactional @PostMapping("/api/admin/project/delete/{id}") public org.springframework.http.ResponseEntity deleteUser(@PathVariable("id") Integer id) Rest endpoint for deleting a project. It takes the id of the project to be deleted as a path variable.- Parameters:
id
- - the id of the project to be deleted- Returns:
- ResponseEntity - the response entity returned as a JSON object
-