refactor structure

This commit is contained in:
jinho jeong
2022-04-25 15:13:36 +09:00
parent 62402c66a6
commit 683b8b53db
5 changed files with 7 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
package com.example.oneul.domain.user.controller;
package com.example.oneul.domain.user.api;
import javax.servlet.http.HttpSession;
@@ -17,17 +17,18 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/user")
public class UserController {
public class UserApi {
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;
}
@RequestMapping(value="/", method=RequestMethod.POST)
public UserEntity signUp(@RequestBody SignUpDTO signUpDTO, HttpSession httpSession) {
// TODO: password1, password2 같은지 검사
UserEntity user = userCommandService.signUp(signUpDTO.toEntity(), httpSession);
return user;
}

View File

@@ -10,5 +10,5 @@ import org.springframework.stereotype.Service;
public interface UserService {
UserEntity signUp(UserEntity userEntity, HttpSession httpSession);
UserEntity login(UserEntity userEntity , HttpSession httpSession);
void logout(UserEntity userEntity, HttpSession httpSession);
void logout(HttpSession httpSession);
}

View File

@@ -51,7 +51,7 @@ public class UserServiceImpl implements UserService {
}
@Override
public void logout(UserEntity userEntity, HttpSession httpSession){
public void logout(HttpSession httpSession){
UserEntity user = (UserEntity) httpSession.getAttribute("user");
if(user == null) return ;
log.info("session id: " + httpSession.getId());