Skip to content

Commit

Permalink
Added reset feature
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Sep 25, 2014
1 parent cb1e5c8 commit 525616b
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,32 @@

import flyinghigh.services.flights.domain.Airport;
import flyinghigh.services.flights.repositories.AirportRepository;
import flyinghigh.services.flights.services.DatabaseSetup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AirportsController {

private @Autowired AirportRepository airportRepository;
@Autowired private AirportRepository airportRepository;

@Autowired
private DatabaseSetup databaseSetup;

@RequestMapping("/rest/api/airports")
public List<Airport> listAirports() {
return airportRepository.findAll(new Sort("name"));
}

@RequestMapping(method = RequestMethod.GET, value = "/rest/api/airports/reset")
public void initializeAccounts() {
databaseSetup.initializeAirports();;
}


}

0 comments on commit 525616b

Please sign in to comment.