package edu.umich.umms.worldofworkcraft.controller;

import edu.umich.umms.worldofworkcraft.domain.Achievement;
import edu.umich.umms.worldofworkcraft.domain.Learner;
import edu.umich.umms.worldofworkcraft.repository.AchievementRepository;
import edu.umich.umms.worldofworkcraft.repository.LearnerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
@RequestMapping("/achievement")

public class AchievementController {
    @Autowired
    AchievementRepository achievementRepository;


   // @RequestMapping(value = "/find/{achievement}", method = RequestMethod.GET)
//    public String findById(@PathVariable Long id) {
//        List<Achievement> achievements = achievementRepository.findAll();
//        return achievement.getName();
//    }
}

@@ -57,318 +57,154 @@
 ort 
-edu.umich.umms.worldofworkcraft.domain.Achievement;%0Aimport edu.umich.umms.worldofworkcraft.domain.Learner;%0Aimport edu.umich.umms.worldofworkcraft.repository.AchievementRepository;%0Aimport edu.umich.umms.worldofworkcraft.repository.LearnerRepository;%0Aimport org.springframework.beans.factory.annotation.Autowired
+org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.http.HttpStatus;%0Aimport org.springframework.http.ResponseEntity
 ;%0Aim
@@ -298,28 +298,27 @@
 otation.
-PathVariable
+RequestBody
 ;%0Aimport
@@ -448,22 +448,131 @@
 ort 
-java.util.List
+edu.umich.umms.worldofworkcraft.domain.Achievement;%0Aimport edu.umich.umms.worldofworkcraft.repository.AchievementRepository
 ;%0A%0A@
@@ -716,16 +716,277 @@
 sitory;%0A
+    %0A    @RequestMapping(method = RequestMethod.POST)%0A    public ResponseEntity%3CAchievement%3E createAchievement(@RequestBody Achievement achievement) %7B%0A        return new ResponseEntity%3CAchievement%3E(achievementRepository.save(achievement), HttpStatus.OK);%0A    %7D%0A
 %0A%0A   // 

add ability to create achievement