/** DELETE /teams/:id -> delete the "id" team. */ @RequestMapping( value = "/teams/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> deleteTeam(@PathVariable Long id) { log.debug("REST request to delete Team : {}", id); teamRepository.delete(id); return ResponseEntity.ok() .headers(HeaderUtil.createEntityDeletionAlert("team", id.toString())) .build(); }
/** PUT /teams -> Updates an existing team. */ @RequestMapping( value = "/teams", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Team> updateTeam(@Valid @RequestBody Team team) throws URISyntaxException { log.debug("REST request to update Team : {}", team); if (team.getId() == null) { return createTeam(team); } Team result = teamRepository.save(team); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert("team", team.getId().toString())) .body(result); }
/** POST /teams -> Create a new team. */ @RequestMapping( value = "/teams", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Team> createTeam(@Valid @RequestBody Team team) throws URISyntaxException { log.debug("REST request to save Team : {}", team); if (team.getId() != null) { return ResponseEntity.badRequest() .header("Failure", "A new team cannot already have an ID") .body(null); } Team result = teamRepository.save(team); return ResponseEntity.created(new URI("/api/teams/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert("team", result.getId().toString())) .body(result); }
/** PUT /taskPrioritys -> Updates an existing taskPriority. */ @RequestMapping( value = "/taskPrioritys", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<TaskPriority> updateTaskPriority( @Valid @RequestBody TaskPriority taskPriority) throws URISyntaxException { log.debug("REST request to update TaskPriority : {}", taskPriority); if (taskPriority.getId() == null) { return createTaskPriority(taskPriority); } TaskPriority result = taskPriorityRepository.save(taskPriority); return ResponseEntity.ok() .headers( HeaderUtil.createEntityUpdateAlert("taskPriority", taskPriority.getId().toString())) .body(result); }