Skip to content

Commit

Permalink
Cascade a Team
Browse files Browse the repository at this point in the history
  • Loading branch information
vicsmr committed Jun 30, 2016
1 parent acfe498 commit e991e15
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Binary file modified security_ejem1/files/image-0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import com.fasterxml.jackson.annotation.JsonView;

import es.urjc.code.daw.library.team.TeamController.TeamListView;
import es.urjc.code.daw.library.user.User;
import es.urjc.code.daw.library.user.UserComponent;
import es.urjc.code.daw.library.maatch.Maatch;
import es.urjc.code.daw.library.player.Player;
import es.urjc.code.daw.library.team.Team;
Expand All @@ -30,9 +32,14 @@ interface TeamListView extends Team.BasicAtt, Team.PlayersAtt, Team.MaatchAtt, P

private static final Logger log = LoggerFactory.getLogger(TeamController.class);

@Autowired
private UserComponent userComponent;

@Autowired
private TeamRepository repository;

User loggedUser = userComponent.getLoggedUser();

@JsonView(TeamListView.class)
@RequestMapping(value = "/", method = RequestMethod.GET)
public List<Team> getTeams() {
Expand Down Expand Up @@ -69,11 +76,10 @@ public ResponseEntity<Team> updateTeam(@PathVariable long id, @RequestBody Team

Team team = repository.findOne(id);
if (team != null) {

updatedTeam.setId(id);
repository.save(updatedTeam);

return new ResponseEntity<>(updatedTeam, HttpStatus.OK);
updatedTeam.setId(id);
repository.save(updatedTeam);

return new ResponseEntity<>(updatedTeam, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
Expand Down
2 changes: 1 addition & 1 deletion security_ejem1/target/classes/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Implementation-Title: Probamos
Implementation-Version: 0.1.0
Built-By: ferna_000
Built-By: Victor
Implementation-Vendor-Id: es.sidelab
Build-Jdk: 1.8.0_91
Created-By: Maven Integration for Eclipse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#Generated by Maven Integration for Eclipse
#Wed Jun 29 19:46:35 CEST 2016
version=0.1.0
groupId=es.sidelab
m2e.projectName=Probamos
Expand Down

0 comments on commit e991e15

Please sign in to comment.