Skip to content

Commit

Permalink
Merge pull request wcaquinocursos#1 from wcaquino/deleteTask
Browse files Browse the repository at this point in the history
Remoção de tarefa
  • Loading branch information
wcaquino authored Mar 19, 2020
2 parents c7e7d0b + d0db5cc commit 41ad20c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import br.ce.wcaquino.taskbackend.model.Task;
Expand Down Expand Up @@ -42,4 +45,10 @@ public ResponseEntity<Task> save(@RequestBody Task todo) throws ValidationExcept
Task saved = todoRepo.save(todo);
return new ResponseEntity<Task>(saved, HttpStatus.CREATED);
}

@DeleteMapping(value = "/{id}")
@ResponseStatus(code = HttpStatus.NO_CONTENT)
public void delete(@PathVariable Long id) {
todoRepo.deleteById(id);
}
}

0 comments on commit 41ad20c

Please sign in to comment.