package ie.gmit.sw.Controller;

import ie.gmit.sw.Service.UserService;
import ie.gmit.sw.domain.ProfileRequest;
import ie.gmit.sw.domain.ProfileResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MainController {
    @Autowired
    private UserService userService;

    @RequestMapping( path = "/userdetail/new", method = RequestMethod.POST)
    public ProfileResponse newUserDetail(@RequestBody ProfileRequest request) throws Throwable {
        return userService.createUserDetail(request);
    }

    @RequestMapping( path = "/userdetail/update", method = RequestMethod.POST)
    public ProfileResponse updateUserDetail(@RequestBody ProfileRequest request) throws Throwable {
        return userService.updateUserDetail(request);
    }

    @RequestMapping( path = "/userdetail/delete", method = RequestMethod.POST)
    public ProfileResponse deleteUserDetail(@RequestBody ProfileRequest request) throws Throwable {
        return userService.deleteUserDetail(request);
    }
}
@@ -25,16 +25,52 @@
 oller;%0A%0A
+import ie.gmit.sw.Model.UserDetail;%0A
 import i
@@ -1108,10 +1108,234 @@
 );%0A    %7D
+%0A%0A    @RequestMapping( path = %22/userdetail/get%22, method = RequestMethod.GET)%0A    public UserDetail getUserDetail(@RequestParam(%22email%22) String email) throws Throwable %7B%0A        return userService.getUserByEmail(email);%0A    %7D
 %0A%7D

add get userdetail api for profile server