Newer
Older
Connor Brock
committed
package Team5.SmartTowns.dragonstale;
import Team5.SmartTowns.landmarks.Landmarks;
import org.springframework.stereotype.Controller;
Connor Brock
committed
import org.springframework.web.bind.annotation.GetMapping;
Connor Brock
committed
import org.springframework.web.bind.annotation.RequestMapping;
Connor Brock
committed
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
import static Team5.SmartTowns.dragonstale.DragonsTale.landmarksDragonstrail;
Connor Brock
committed
public class DragonsTaleController {
Connor Brock
committed
ModelAndView modelAndView;
Connor Brock
committed
@GetMapping("/dragonstale")
public ModelAndView getDragonsTale(){
List<Landmarks> landmarksList = landmarksDragonstrail;
Connor Brock
committed
int landmarksListSize = landmarksDragonstrail.size();
Connor Brock
committed
modelAndView = new ModelAndView("/dragonstale/index");
Connor Brock
committed
modelAndView.addObject("landmarksList", landmarksList);
Connor Brock
committed
modelAndView.addObject("getListSize", landmarksListSize);
Connor Brock
committed
return modelAndView;
}
Connor Brock
committed
@RequestMapping ("/QRScan") //In here, we could use trailID as a string variable and use it to track what trail the user clicked from.
public ModelAndView getQRScanner(){
Connor Brock
committed
modelAndView = new ModelAndView("fragments/qr-scanner");
Connor Brock
committed
//Can we extract the pathvariable in a JS function?
return modelAndView;
}
Connor Brock
committed
//Create another controller that directs to the given DragonsTale..Trail.. and updates the users account accordingly.
Connor Brock
committed
Connor Brock
committed
// This code is to be used
Connor Brock
committed
// @GetMapping("dragonstale/{qrCode}/{id}")
// public String qrCodeCheck(@PathVariable Optional<String> qrCode, @PathVariable Optional<Integer> id){
// if (qrCode.isPresent()){
//
// //Check if ID is present, if do this, if not dfo that.
//
// }
// }