Exemplo n.º 1
0
 /** 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);
 }