refactor structure
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package com.example.oneul.domain.user.controller;
|
package com.example.oneul.domain.user.api;
|
||||||
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
@@ -17,17 +17,18 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/user")
|
@RequestMapping(value = "/user")
|
||||||
public class UserController {
|
public class UserApi {
|
||||||
private final UserService userCommandService;
|
private final UserService userCommandService;
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(UserController.class);
|
private final Logger log = LoggerFactory.getLogger(UserApi.class);
|
||||||
|
|
||||||
public UserController(UserService userCommandService){
|
public UserApi(UserService userCommandService){
|
||||||
this.userCommandService = userCommandService;
|
this.userCommandService = userCommandService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value="/", method=RequestMethod.POST)
|
@RequestMapping(value="/", method=RequestMethod.POST)
|
||||||
public UserEntity signUp(@RequestBody SignUpDTO signUpDTO, HttpSession httpSession) {
|
public UserEntity signUp(@RequestBody SignUpDTO signUpDTO, HttpSession httpSession) {
|
||||||
|
// TODO: password1, password2 같은지 검사
|
||||||
UserEntity user = userCommandService.signUp(signUpDTO.toEntity(), httpSession);
|
UserEntity user = userCommandService.signUp(signUpDTO.toEntity(), httpSession);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
@@ -10,5 +10,5 @@ import org.springframework.stereotype.Service;
|
|||||||
public interface UserService {
|
public interface UserService {
|
||||||
UserEntity signUp(UserEntity userEntity, HttpSession httpSession);
|
UserEntity signUp(UserEntity userEntity, HttpSession httpSession);
|
||||||
UserEntity login(UserEntity userEntity , HttpSession httpSession);
|
UserEntity login(UserEntity userEntity , HttpSession httpSession);
|
||||||
void logout(UserEntity userEntity, HttpSession httpSession);
|
void logout(HttpSession httpSession);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logout(UserEntity userEntity, HttpSession httpSession){
|
public void logout(HttpSession httpSession){
|
||||||
UserEntity user = (UserEntity) httpSession.getAttribute("user");
|
UserEntity user = (UserEntity) httpSession.getAttribute("user");
|
||||||
if(user == null) return ;
|
if(user == null) return ;
|
||||||
log.info("session id: " + httpSession.getId());
|
log.info("session id: " + httpSession.getId());
|
||||||
|
|||||||
Reference in New Issue
Block a user