package com.plannaplan.controllers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import com.plannaplan.App; import com.plannaplan.services.AssignmentService; /** * Rest controller to enpoint that help deveopler test the app */ @RestController @CrossOrigin @RequestMapping("/api/" + App.API_VERSION + "/developer") @Api(tags = { "DeveloperController" }, value = "DeveloperController", description = "All endpoints to use in development time to help app testing") public class DeveloperController { @Autowired private AssignmentService assignmentService; /** * @return if accept algoythm was perfomed */ @PreAuthorize("hasRole('ROLE_DEVELOPER')") @PostMapping(path = "/algoythm/accept") public ResponseEntity performAcceptAlgorythm() { this.assignmentService.callAcceptAlgorythm(); return new ResponseEntity<>("Success", HttpStatus.OK); } }