userController에 RegisterController 합침
This commit is contained in:
parent
69f3b46a49
commit
aa91b4191c
@ -1,97 +0,0 @@
|
|||||||
/************************************************************
|
|
||||||
*
|
|
||||||
* @packageName : io.company.localhost.controller.api
|
|
||||||
* @fileName : RegisterController.java
|
|
||||||
* @author : 박지윤
|
|
||||||
* @date : 25.01.17
|
|
||||||
* @description : 등록신청
|
|
||||||
*
|
|
||||||
* ===========================================================
|
|
||||||
* DATE AUTHOR NOTE
|
|
||||||
* -----------------------------------------------------------
|
|
||||||
* 24.01.17 박지윤 최초 생성
|
|
||||||
*
|
|
||||||
*************************************************************/
|
|
||||||
|
|
||||||
package io.company.localhost.controller.api;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import io.company.localhost.common.annotation.ParameterCheck;
|
|
||||||
import io.company.localhost.common.annotation.ReqMap;
|
|
||||||
import io.company.localhost.common.dto.ApiResponse;
|
|
||||||
import io.company.localhost.common.dto.MapDto;
|
|
||||||
import io.company.localhost.service.RegisterService;
|
|
||||||
import io.company.localhost.service.commoncodService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequestMapping("/api/register")
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class RegisterController {
|
|
||||||
|
|
||||||
private final commoncodService commoncodservice;
|
|
||||||
private final RegisterService registerService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 사용 가능 색상 조회
|
|
||||||
*
|
|
||||||
* @return ApiResponse<List<MapDto>>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@ParameterCheck
|
|
||||||
@GetMapping("/color")
|
|
||||||
public ApiResponse<List<MapDto>> getColorList() {
|
|
||||||
List<MapDto> ColorList = commoncodservice.getColorList();
|
|
||||||
return ApiResponse.ok(ColorList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MBTI 목록 조회
|
|
||||||
*
|
|
||||||
* @return ApiResponse<List<MapDto>>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@ParameterCheck
|
|
||||||
@GetMapping("/mbti")
|
|
||||||
public ApiResponse<List<MapDto>> getMbtiList() {
|
|
||||||
List<MapDto> MbtiList = commoncodservice.getMbtiList();
|
|
||||||
return ApiResponse.ok(MbtiList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 회원가입
|
|
||||||
*
|
|
||||||
* @param profile
|
|
||||||
* @param map
|
|
||||||
* @return ApiResponse<Integer>
|
|
||||||
* @throws RuntimeException 파일 업로드 실패 시
|
|
||||||
*/
|
|
||||||
@PostMapping("/join")
|
|
||||||
public ApiResponse<Integer> register(@RequestParam("profile") MultipartFile profile, @ReqMap MapDto map) {
|
|
||||||
int member = registerService.register(profile, map);
|
|
||||||
return ApiResponse.ok(member);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 아이디 중복 체크
|
|
||||||
*
|
|
||||||
* @param memberIds
|
|
||||||
* @return ApiResponse<Boolean>
|
|
||||||
* @throws IllegalArgumentException
|
|
||||||
*/
|
|
||||||
@GetMapping("/checkId")
|
|
||||||
public ApiResponse<Boolean> selectCheckId(@RequestParam String memberIds) {
|
|
||||||
boolean isDuplicate = registerService.selectCheckId(memberIds);
|
|
||||||
return ApiResponse.ok(!isDuplicate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -10,6 +10,7 @@
|
|||||||
* DATE AUTHOR NOTE
|
* DATE AUTHOR NOTE
|
||||||
* -----------------------------------------------------------
|
* -----------------------------------------------------------
|
||||||
* 24.12.06 조인제 최초 생성
|
* 24.12.06 조인제 최초 생성
|
||||||
|
* 24.01.17 박지윤 Register 합침
|
||||||
*
|
*
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
package io.company.localhost.controller.common;
|
package io.company.localhost.controller.common;
|
||||||
@ -17,7 +18,12 @@ package io.company.localhost.controller.common;
|
|||||||
import io.company.localhost.common.annotation.Admin;
|
import io.company.localhost.common.annotation.Admin;
|
||||||
import io.company.localhost.common.annotation.Guest;
|
import io.company.localhost.common.annotation.Guest;
|
||||||
import io.company.localhost.common.annotation.Member;
|
import io.company.localhost.common.annotation.Member;
|
||||||
|
import io.company.localhost.common.annotation.ParameterCheck;
|
||||||
|
import io.company.localhost.common.annotation.ReqMap;
|
||||||
import io.company.localhost.common.dto.ApiResponse;
|
import io.company.localhost.common.dto.ApiResponse;
|
||||||
|
import io.company.localhost.common.dto.MapDto;
|
||||||
|
import io.company.localhost.service.RegisterService;
|
||||||
|
import io.company.localhost.service.commoncodService;
|
||||||
import io.company.localhost.utils.AuthUtil;
|
import io.company.localhost.utils.AuthUtil;
|
||||||
import io.company.localhost.utils.SessionListener;
|
import io.company.localhost.utils.SessionListener;
|
||||||
import io.company.localhost.vo.MemberVo;
|
import io.company.localhost.vo.MemberVo;
|
||||||
@ -35,10 +41,14 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
|||||||
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
||||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY;
|
import static org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY;
|
||||||
@ -49,6 +59,62 @@ import static org.springframework.security.web.authentication.rememberme.Abstrac
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
|
private final commoncodService commoncodservice;
|
||||||
|
private final RegisterService registerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 사용 가능 색상 조회
|
||||||
|
*
|
||||||
|
* @return ApiResponse<List<MapDto>>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ParameterCheck
|
||||||
|
@GetMapping("/color")
|
||||||
|
public ApiResponse<List<MapDto>> getColorList() {
|
||||||
|
List<MapDto> ColorList = commoncodservice.getColorList();
|
||||||
|
return ApiResponse.ok(ColorList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MBTI 목록 조회
|
||||||
|
*
|
||||||
|
* @return ApiResponse<List<MapDto>>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ParameterCheck
|
||||||
|
@GetMapping("/mbti")
|
||||||
|
public ApiResponse<List<MapDto>> getMbtiList() {
|
||||||
|
List<MapDto> MbtiList = commoncodservice.getMbtiList();
|
||||||
|
return ApiResponse.ok(MbtiList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 회원가입
|
||||||
|
*
|
||||||
|
* @param profile
|
||||||
|
* @param map
|
||||||
|
* @return ApiResponse<Integer>
|
||||||
|
* @throws RuntimeException 파일 업로드 실패 시
|
||||||
|
*/
|
||||||
|
@PostMapping("/join")
|
||||||
|
public ApiResponse<Integer> register(@RequestParam("profile") MultipartFile profile, @ReqMap MapDto map) {
|
||||||
|
int member = registerService.register(profile, map);
|
||||||
|
return ApiResponse.ok(member);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 아이디 중복 체크
|
||||||
|
*
|
||||||
|
* @param memberIds
|
||||||
|
* @return ApiResponse<Boolean>
|
||||||
|
* @throws IllegalArgumentException
|
||||||
|
*/
|
||||||
|
@GetMapping("/checkId")
|
||||||
|
public ApiResponse<Boolean> selectCheckId(@RequestParam String memberIds) {
|
||||||
|
boolean isDuplicate = registerService.selectCheckId(memberIds);
|
||||||
|
return ApiResponse.ok(!isDuplicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//security 인증 체크
|
//security 인증 체크
|
||||||
@GetMapping("userInfo")
|
@GetMapping("userInfo")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user