Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping("/station")
- @PostMapping
- public BikeStation createStation(@RequestBody NewBikeStation newBikeStation){
- BikeStation bikeStation = new BikeStation();
- bikeStation.setName(newBikeStation.getName());
- for (int i = 0; i < newBikeStation.getPositions(); i++){
- bikeStation.getPositions().add(new Position(Position.isAvailable.YES));
- }
- bikeStationRepository.save(bikeStation);
- return bikeStation;
- }
- @Getter
- @Setter
- public class NewBikeStation {
- private String name;
- private int positions;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement