[api] 관리자 휴면/탈퇴/삭제 추가
This commit is contained in:
@@ -39,12 +39,15 @@ public class OpenApiConfig {
|
||||
@Bean
|
||||
public GroupedOpenApi frontApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("front")
|
||||
.group("100. front")
|
||||
.pathsToMatch("/**")
|
||||
.pathsToExclude(
|
||||
"/admin/**",
|
||||
"/error",
|
||||
"/actuator/**"
|
||||
"/admin/**"
|
||||
, "/cors/**"
|
||||
, "/files/**"
|
||||
, "/tusFiles/**"
|
||||
, "/error"
|
||||
, "/actuator/**"
|
||||
)
|
||||
.build();
|
||||
}
|
||||
@@ -52,8 +55,20 @@ public class OpenApiConfig {
|
||||
@Bean
|
||||
public GroupedOpenApi adminApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("admin")
|
||||
.group("500. admin")
|
||||
.pathsToMatch("/admin/**")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi commonApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("900. common")
|
||||
.pathsToMatch(
|
||||
"/cors/**"
|
||||
, "/files/**"
|
||||
, "/tusFiles/**"
|
||||
)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.alist.api.config.cache;
|
||||
|
||||
import com.alist.api.modules.auth.vo.CorsOriginVo;
|
||||
import com.alist.api.modules.auth.mapper.CorsMapper;
|
||||
import com.alist.api.modules.cors.vo.CorsOriginVo;
|
||||
import com.alist.api.modules.cors.mapper.CorsMapper;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
try {
|
||||
String requestUri = request.getRequestURI();
|
||||
boolean adminRequest = requestUri.startsWith("/admin/");
|
||||
boolean sharedRequest = requestUri.startsWith("/tusFiles/") || requestUri.startsWith("/files/");
|
||||
boolean sharedRequest = requestUri.startsWith("/tusFiles/") || requestUri.startsWith("/files/") || requestUri.startsWith("/cors/");
|
||||
String token = resolveToken(request, adminRequest, sharedRequest);
|
||||
|
||||
if (token != null && jwtTokenProvider.validateToken(token)) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(
|
||||
name = "50. Admin 로그인"
|
||||
name = "501. Admin 로그인"
|
||||
, description = "ADMIN 사이트 로그인입니다. 로그인시 토큰 발급이 함께됩니다."
|
||||
)
|
||||
@RestController
|
||||
|
||||
@@ -2,12 +2,9 @@ package com.alist.api.modules.admin.member;
|
||||
|
||||
import com.alist.api.common.response.ApiResponse;
|
||||
import com.alist.api.common.response.ApiResponseCode;
|
||||
import com.alist.api.modules.admin.member.form.AdminMemberSearchForm;
|
||||
import com.alist.api.modules.admin.member.form.AdminMemberUpdateForm;
|
||||
import com.alist.api.modules.admin.member.form.*;
|
||||
import com.alist.api.modules.admin.member.service.AdminMemberService;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberDetailVo;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberListVo;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberUpdateVo;
|
||||
import com.alist.api.modules.admin.member.vo.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -15,7 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Tag(name = "51. 회원 관리", description = "관리자 회원 관리 API")
|
||||
@Tag(name = "502. 회원 관리", description = "관리자 회원 관리 API")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/member")
|
||||
@@ -76,4 +73,55 @@ public class AdminMemberController {
|
||||
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 수정");
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "회원 휴면 상태 변경",
|
||||
description = "관리자가 회원 PK 기준으로 휴면 상태를 변경합니다. Y: 휴면, N: 정상"
|
||||
)
|
||||
@PatchMapping("/dormant")
|
||||
public ResponseEntity<ApiResponse<AdminMemberDormantStatusVo>> updateAdminMemberDormantStatus(
|
||||
@Valid @RequestBody AdminMemberDormantStatusForm adminMemberDormantStatusForm
|
||||
) {
|
||||
AdminMemberDormantStatusVo result = adminMemberService.updateAdminMemberDormantStatus(adminMemberDormantStatusForm.toAdminMemberDormantStatusUpdateDto());
|
||||
|
||||
if (!result.isDormantStatusUpdated()) {
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
|
||||
}
|
||||
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 휴면 상태 변경");
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "회원 탈퇴 상태 변경",
|
||||
description = "관리자가 회원 PK 기준으로 탈퇴 상태를 변경합니다. N: 정상, P: 탈퇴대기, Y: 탈퇴완료"
|
||||
)
|
||||
@PatchMapping("/withdraw")
|
||||
public ResponseEntity<ApiResponse<AdminMemberWithdrawStatusVo>> updateAdminMemberWithdrawStatus(
|
||||
@Valid @RequestBody AdminMemberWithdrawStatusForm adminMemberWithdrawStatusForm
|
||||
) {
|
||||
AdminMemberWithdrawStatusVo result = adminMemberService.updateAdminMemberWithdrawStatus(adminMemberWithdrawStatusForm.toAdminMemberWithdrawStatusUpdateDto());
|
||||
|
||||
if (!result.isWithdrawStatusUpdated()) {
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
|
||||
}
|
||||
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 탈퇴 상태 변경");
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "회원 계정 삭제",
|
||||
description = "관리자가 회원 PK 기준으로 계정을 삭제 처리합니다. 실제 삭제가 아닌 del_yn 변경 방식입니다."
|
||||
)
|
||||
@PatchMapping("/delete")
|
||||
public ResponseEntity<ApiResponse<AdminMemberDeleteVo>> deleteAdminMember(
|
||||
@Valid @RequestBody AdminMemberDeleteForm adminMemberDeleteForm
|
||||
) {
|
||||
AdminMemberDeleteVo result = adminMemberService.deleteAdminMember(adminMemberDeleteForm.toAdminMemberDeleteDto());
|
||||
|
||||
if (!result.isMemberDeleted()) {
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
|
||||
}
|
||||
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "회원 계정 삭제");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.modules.admin.member.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberDeleteDto {
|
||||
private Integer userIdx;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.modules.admin.member.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberDormantStatusDto {
|
||||
private Integer userIdx;
|
||||
private String dormantYn;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.modules.admin.member.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberWithdrawStatusDto {
|
||||
private Integer userIdx;
|
||||
private String withdrawStatus;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.alist.api.modules.admin.member.form;
|
||||
|
||||
import com.alist.api.modules.admin.member.dto.AdminMemberDeleteDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "관리자 회원 계정 삭제 요청 폼")
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberDeleteForm {
|
||||
@Schema(description = "회원 PK", example = "15", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "회원 PK는 필수입니다.")
|
||||
private Integer userIdx;
|
||||
|
||||
public AdminMemberDeleteDto toAdminMemberDeleteDto() {
|
||||
AdminMemberDeleteDto adminMemberDeleteDto = new AdminMemberDeleteDto();
|
||||
adminMemberDeleteDto.setUserIdx(userIdx);
|
||||
return adminMemberDeleteDto;
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.alist.api.modules.admin.member.form;
|
||||
|
||||
import com.alist.api.modules.admin.member.dto.AdminMemberDormantStatusDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "관리자 회원 휴면 상태 변경 요청 폼")
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberDormantStatusForm {
|
||||
@Schema(description = "회원 PK", example = "15", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "회원 PK는 필수입니다.")
|
||||
private Integer userIdx;
|
||||
|
||||
@Schema(description = "휴면 여부. Y: 휴면, N: 정상", example = "Y", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "휴면 여부는 필수입니다.")
|
||||
@Pattern(regexp = "^[YN]$", message = "휴면 여부는 Y 또는 N만 가능합니다.")
|
||||
private String dormantYn;
|
||||
|
||||
public AdminMemberDormantStatusDto toAdminMemberDormantStatusUpdateDto() {
|
||||
AdminMemberDormantStatusDto adminMemberDormantStatusDto = new AdminMemberDormantStatusDto();
|
||||
adminMemberDormantStatusDto.setUserIdx(userIdx);
|
||||
adminMemberDormantStatusDto.setDormantYn(dormantYn);
|
||||
return adminMemberDormantStatusDto;
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.alist.api.modules.admin.member.form;
|
||||
|
||||
import com.alist.api.modules.admin.member.dto.AdminMemberWithdrawStatusDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "관리자 회원 탈퇴 상태 변경 요청 폼")
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberWithdrawStatusForm {
|
||||
@Schema(description = "회원 PK", example = "15", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "회원 PK는 필수입니다.")
|
||||
private Integer userIdx;
|
||||
|
||||
@Schema(description = "탈퇴 상태. N: 정상, P: 탈퇴대기, Y: 탈퇴완료", example = "P", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "탈퇴 상태는 필수입니다.")
|
||||
@Pattern(regexp = "^[NPY]$", message = "탈퇴 상태는 N, P, Y만 가능합니다.")
|
||||
private String withdrawStatus;
|
||||
|
||||
public AdminMemberWithdrawStatusDto toAdminMemberWithdrawStatusUpdateDto() {
|
||||
AdminMemberWithdrawStatusDto adminMemberWithdrawStatusDto = new AdminMemberWithdrawStatusDto();
|
||||
adminMemberWithdrawStatusDto.setUserIdx(userIdx);
|
||||
adminMemberWithdrawStatusDto.setWithdrawStatus(withdrawStatus);
|
||||
return adminMemberWithdrawStatusDto;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.alist.api.modules.admin.member.mapper;
|
||||
|
||||
import com.alist.api.modules.admin.member.dto.AdminMemberSearchDto;
|
||||
import com.alist.api.modules.admin.member.dto.AdminMemberUpdateDto;
|
||||
import com.alist.api.modules.admin.member.dto.*;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberDetailVo;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -17,4 +16,10 @@ public interface AdminMemberMapper {
|
||||
AdminMemberDetailVo selectAdminMemberDetail(Integer userIdx);
|
||||
|
||||
int updateAdminMember(AdminMemberUpdateDto adminMemberUpdateDto);
|
||||
|
||||
int updateAdminMemberDormantStatus(AdminMemberDormantStatusDto adminMemberDormantStatusDto);
|
||||
|
||||
int updateAdminMemberWithdrawStatus(AdminMemberWithdrawStatusDto adminMemberWithdrawStatusDto);
|
||||
|
||||
int deleteAdminMember(AdminMemberDeleteDto adminMemberDeleteDto);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package com.alist.api.modules.admin.member.service;
|
||||
|
||||
import com.alist.api.modules.admin.member.dto.AdminMemberSearchDto;
|
||||
import com.alist.api.modules.admin.member.dto.AdminMemberUpdateDto;
|
||||
import com.alist.api.modules.admin.member.dto.*;
|
||||
import com.alist.api.modules.admin.member.mapper.AdminMemberMapper;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberDetailVo;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberListVo;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberUpdateVo;
|
||||
import com.alist.api.modules.admin.member.vo.AdminMemberVo;
|
||||
import com.alist.api.modules.admin.member.vo.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -45,4 +41,31 @@ public class AdminMemberService {
|
||||
result.setMemberUpdated(updateCount > 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AdminMemberDormantStatusVo updateAdminMemberDormantStatus(AdminMemberDormantStatusDto adminMemberDormantStatusDto) {
|
||||
int updateCount = adminMemberMapper.updateAdminMemberDormantStatus(adminMemberDormantStatusDto);
|
||||
|
||||
AdminMemberDormantStatusVo result = new AdminMemberDormantStatusVo();
|
||||
result.setDormantStatusUpdated(updateCount > 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AdminMemberWithdrawStatusVo updateAdminMemberWithdrawStatus(AdminMemberWithdrawStatusDto adminMemberWithdrawStatusDto) {
|
||||
int updateCount = adminMemberMapper.updateAdminMemberWithdrawStatus(adminMemberWithdrawStatusDto);
|
||||
|
||||
AdminMemberWithdrawStatusVo result = new AdminMemberWithdrawStatusVo();
|
||||
result.setWithdrawStatusUpdated(updateCount > 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AdminMemberDeleteVo deleteAdminMember(AdminMemberDeleteDto adminMemberDeleteDto) {
|
||||
int updateCount = adminMemberMapper.deleteAdminMember(adminMemberDeleteDto);
|
||||
|
||||
AdminMemberDeleteVo result = new AdminMemberDeleteVo();
|
||||
result.setMemberDeleted(updateCount > 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.alist.api.modules.admin.member.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "관리자 회원 계정 삭제 응답")
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberDeleteVo {
|
||||
@Schema(description = "회원 계정 삭제 여부", example = "true")
|
||||
private boolean memberDeleted;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.alist.api.modules.admin.member.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "관리자 회원 휴면 상태 변경 응답")
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberDormantStatusVo {
|
||||
@Schema(description = "휴면 상태 변경 여부", example = "true")
|
||||
private boolean dormantStatusUpdated;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.alist.api.modules.admin.member.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "관리자 회원 탈퇴 상태 변경 응답")
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberWithdrawStatusVo {
|
||||
@Schema(description = "탈퇴 상태 변경 여부", example = "true")
|
||||
private boolean withdrawStatusUpdated;
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "51. ADMIN 사용자 관리", description = "ADMIN 사용자 회원가입 및 관리 API")
|
||||
@Tag(name = "503. ADMIN 사용자 관리", description = "ADMIN 사용자 회원가입 및 관리 API")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/admin/user")
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.alist.api.modules.auth.form.ApikeyLoginForm;
|
||||
import com.alist.api.modules.auth.form.TokenForm;
|
||||
import com.alist.api.modules.auth.service.SsoService;
|
||||
import com.alist.api.modules.auth.service.AuthService;
|
||||
import com.alist.api.modules.auth.vo.TokenVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -23,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "02. 엑세스 토큰 발급", description = "엑세스 토큰 발급")
|
||||
@Tag(name = "102. 엑세스 토큰 발급", description = "엑세스 토큰 발급")
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
@@ -62,11 +63,11 @@ public class AuthController {
|
||||
description = "엑세스 토큰이 발급됩니다. (테스트용 실사용X)"
|
||||
)
|
||||
@PostMapping("/token")
|
||||
public ResponseEntity<ApiResponse<TokenDto>> token(@Valid @RequestBody TokenForm tokenForm) {
|
||||
TokenDto tokenDto = new TokenDto();
|
||||
tokenDto.setAccessToken(jwtTokenProvider.createToken(tokenForm.toTokenDto().getId()));
|
||||
public ResponseEntity<ApiResponse<TokenVo>> token(@Valid @RequestBody TokenForm tokenForm) {
|
||||
TokenVo tokenVo = new TokenVo();
|
||||
tokenVo.setAccessToken(jwtTokenProvider.createToken(tokenForm.toTokenDto().getId()));
|
||||
|
||||
return ApiResponse.entity(tokenDto, ApiResponseCode.CODE_2001, "엑세스 토큰");
|
||||
return ApiResponse.entity(tokenVo, ApiResponseCode.CODE_2001, "엑세스 토큰");
|
||||
}
|
||||
|
||||
@Operation(
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "01. SSO 인증", description = "공통 로그인, 인가 코드 발급, 코드 교환, 로그아웃 관련 API")
|
||||
@Tag(name = "101. SSO 인증", description = "공통 로그인, 인가 코드 발급, 코드 교환, 로그아웃 관련 API")
|
||||
@RestController
|
||||
@RequestMapping("/sso")
|
||||
public class SsoController {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.alist.api.modules.auth.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "테스트용 토큰 발급 응답")
|
||||
@Getter
|
||||
@Setter
|
||||
public class TokenVo {
|
||||
@Schema(description = "아이디")
|
||||
private String id;
|
||||
@Schema(description = "엑세스 토큰")
|
||||
private String accessToken;
|
||||
@Schema(description = "리플레시 토큰")
|
||||
private String refreshToken;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(hidden = true)
|
||||
private int resultCode;
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.modules.auth;
|
||||
package com.alist.api.modules.cors;
|
||||
|
||||
import com.alist.api.common.response.ApiResponse;
|
||||
import com.alist.api.common.response.ApiResponseCode;
|
||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "97. CRS 갱신", description = "테스트 CORS 설정 관리 API")
|
||||
@Tag(name = "901. CRS 갱신", description = "테스트 CORS 설정 관리 API")
|
||||
@RestController
|
||||
@RequestMapping("/cors")
|
||||
@RequiredArgsConstructor
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.alist.api.modules.auth.mapper;
|
||||
package com.alist.api.modules.cors.mapper;
|
||||
|
||||
import com.alist.api.modules.auth.vo.CorsOriginVo;
|
||||
import com.alist.api.modules.cors.vo.CorsOriginVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.modules.auth.vo;
|
||||
package com.alist.api.modules.cors.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -17,7 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(
|
||||
name = "98. 파일 업로드",
|
||||
name = "902. 파일 업로드",
|
||||
description = "DB 기록 없이 파일을 저장하고 uploadPath를 반환하는 단순 업로드 API입니다. SunEditor 이미지는 file-domain URL을 반환합니다."
|
||||
)
|
||||
@RestController
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.nio.file.Path;
|
||||
|
||||
@Slf4j
|
||||
@Tag(
|
||||
name = "99. TUS 업로드"
|
||||
name = "903. TUS 업로드"
|
||||
, description = "TUS 기반 파일 업로드 초기화, 권한 검증, 상태 조회, 훅 처리, 취소 API"
|
||||
)
|
||||
@RestController
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Tag(name = "05. 사용자 관리", description = "사용자 회원가입 및 관리 API")
|
||||
@Tag(name = "103. 사용자 관리", description = "사용자 회원가입 및 관리 API")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
@@ -126,10 +126,10 @@ public class UserController {
|
||||
description = "로그인한 사용자의 탈퇴 요청 또는 탈퇴 요청 철회를 처리합니다. P: 탈퇴대기, N: 탈퇴요청 철회"
|
||||
)
|
||||
@PatchMapping("/withdraw")
|
||||
public ResponseEntity<ApiResponse<UserWithdrawStatusUpdateVo>> updateWithdrawStatus(
|
||||
@Valid @RequestBody UserWithdrawStatusUpdateForm userWithdrawStatusUpdateForm
|
||||
public ResponseEntity<ApiResponse<UserWithdrawStatusVo>> updateWithdrawStatus(
|
||||
@Valid @RequestBody UserWithdrawStatusForm userWithdrawStatusForm
|
||||
) {
|
||||
UserWithdrawStatusUpdateVo result = userService.updateWithdrawStatus(userWithdrawStatusUpdateForm.toUserWithdrawStatusUpdateDto());
|
||||
UserWithdrawStatusVo result = userService.updateWithdrawStatus(userWithdrawStatusForm.toUserWithdrawStatusUpdateDto());
|
||||
|
||||
if (!result.isWithdrawStatusUpdated()) {
|
||||
if (result.getResultCode() == 4003 || result.getResultCode() == 4001) {
|
||||
@@ -141,4 +141,25 @@ public class UserController {
|
||||
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "탈퇴 상태 변경");
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "사용자 휴면 상태 변경",
|
||||
description = "로그인한 사용자의 휴면 처리 또는 휴면 해지를 처리합니다. Y: 휴면 회원, N: 휴면 해지"
|
||||
)
|
||||
@PatchMapping("/dormant")
|
||||
public ResponseEntity<ApiResponse<UserDormantStatusVo>> updateDormantStatus(
|
||||
@Valid @RequestBody UserDormantStatusForm userDormantStatusForm
|
||||
) {
|
||||
UserDormantStatusVo result = userService.updateDormantStatus(userDormantStatusForm.toUserDormantStatusUpdateDto());
|
||||
|
||||
if (!result.isDormantStatusUpdated()) {
|
||||
if (result.getResultCode() == 4003 || result.getResultCode() == 4001) {
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_4001);
|
||||
}
|
||||
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2003);
|
||||
}
|
||||
|
||||
return ApiResponse.entity(result, ApiResponseCode.CODE_2005, "휴면 상태 변경");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.modules.user.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserDormantStatusDto {
|
||||
private Integer userTokenIdx;
|
||||
private String dormantYn;
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserWithdrawStatusUpdateDto {
|
||||
public class UserWithdrawStatusDto {
|
||||
private Integer userTokenIdx;
|
||||
private String withdrawStatus;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.alist.api.modules.user.form;
|
||||
|
||||
import com.alist.api.modules.user.dto.UserDormantStatusDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "사용자 휴면 상태 변경 요청 폼")
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserDormantStatusForm {
|
||||
@Schema(
|
||||
description = "휴면 여부. Y: 휴면 회원, N: 휴면 해지",
|
||||
example = "Y",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED
|
||||
)
|
||||
@NotBlank(message = "휴면 여부는 필수입니다.")
|
||||
@Pattern(regexp = "^[YN]$", message = "휴면 여부는 Y 또는 N만 가능합니다.")
|
||||
private String dormantYn;
|
||||
|
||||
public UserDormantStatusDto toUserDormantStatusUpdateDto() {
|
||||
UserDormantStatusDto userDormantStatusDto = new UserDormantStatusDto();
|
||||
userDormantStatusDto.setDormantYn(dormantYn);
|
||||
return userDormantStatusDto;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
package com.alist.api.modules.user.form;
|
||||
|
||||
import com.alist.api.modules.user.dto.UserWithdrawStatusUpdateDto;
|
||||
import com.alist.api.modules.user.dto.UserWithdrawStatusDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
@@ -10,7 +10,7 @@ import lombok.Setter;
|
||||
@Schema(description = "사용자 탈퇴 상태 변경 요청 폼")
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserWithdrawStatusUpdateForm {
|
||||
public class UserWithdrawStatusForm {
|
||||
@Schema(
|
||||
description = "탈퇴 상태. P: 탈퇴대기, N: 탈퇴요청 철회",
|
||||
example = "P",
|
||||
@@ -20,9 +20,9 @@ public class UserWithdrawStatusUpdateForm {
|
||||
@Pattern(regexp = "^[PN]$", message = "탈퇴 상태는 P 또는 N만 가능합니다.")
|
||||
private String withdrawStatus;
|
||||
|
||||
public UserWithdrawStatusUpdateDto toUserWithdrawStatusUpdateDto() {
|
||||
UserWithdrawStatusUpdateDto userWithdrawStatusUpdateDto = new UserWithdrawStatusUpdateDto();
|
||||
userWithdrawStatusUpdateDto.setWithdrawStatus(withdrawStatus);
|
||||
return userWithdrawStatusUpdateDto;
|
||||
public UserWithdrawStatusDto toUserWithdrawStatusUpdateDto() {
|
||||
UserWithdrawStatusDto userWithdrawStatusDto = new UserWithdrawStatusDto();
|
||||
userWithdrawStatusDto.setWithdrawStatus(withdrawStatus);
|
||||
return userWithdrawStatusDto;
|
||||
}
|
||||
}
|
||||
@@ -18,5 +18,7 @@ public interface UserMapper {
|
||||
|
||||
int updateUserProfile(UserProfileUpdateDto userProfileUpdateDto);
|
||||
|
||||
int updateWithdrawStatus(UserWithdrawStatusUpdateDto userWithdrawStatusUpdateDto);
|
||||
int updateWithdrawStatus(UserWithdrawStatusDto userWithdrawStatusDto);
|
||||
|
||||
int updateDormantStatus(UserDormantStatusDto userDormantStatusDto);
|
||||
}
|
||||
|
||||
@@ -229,19 +229,19 @@ public class UserService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public UserWithdrawStatusUpdateVo updateWithdrawStatus(UserWithdrawStatusUpdateDto userWithdrawStatusUpdateDto) {
|
||||
UserWithdrawStatusUpdateVo result = new UserWithdrawStatusUpdateVo();
|
||||
public UserWithdrawStatusVo updateWithdrawStatus(UserWithdrawStatusDto userWithdrawStatusDto) {
|
||||
UserWithdrawStatusVo result = new UserWithdrawStatusVo();
|
||||
|
||||
Integer userTokenIdx = SecurityUtil.getLoginUserTokenIdx();
|
||||
userWithdrawStatusUpdateDto.setUserTokenIdx(userTokenIdx);
|
||||
userWithdrawStatusDto.setUserTokenIdx(userTokenIdx);
|
||||
|
||||
if (userTokenIdx == null || userWithdrawStatusUpdateDto.getWithdrawStatus() == null) {
|
||||
if (userTokenIdx == null || userWithdrawStatusDto.getWithdrawStatus() == null) {
|
||||
result.setWithdrawStatusUpdated(false);
|
||||
result.setResultCode(4003);
|
||||
return result;
|
||||
}
|
||||
|
||||
String withdrawStatus = userWithdrawStatusUpdateDto.getWithdrawStatus();
|
||||
String withdrawStatus = userWithdrawStatusDto.getWithdrawStatus();
|
||||
|
||||
if (!"P".equals(withdrawStatus) && !"N".equals(withdrawStatus)) {
|
||||
result.setWithdrawStatusUpdated(false);
|
||||
@@ -249,11 +249,40 @@ public class UserService {
|
||||
return result;
|
||||
}
|
||||
|
||||
int updateCount = userMapper.updateWithdrawStatus(userWithdrawStatusUpdateDto);
|
||||
int updateCount = userMapper.updateWithdrawStatus(userWithdrawStatusDto);
|
||||
|
||||
result.setWithdrawStatusUpdated(updateCount > 0);
|
||||
result.setResultCode(updateCount > 0 ? 2005 : 2003);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public UserDormantStatusVo updateDormantStatus(UserDormantStatusDto userDormantStatusDto) {
|
||||
UserDormantStatusVo result = new UserDormantStatusVo();
|
||||
|
||||
Integer userTokenIdx = SecurityUtil.getLoginUserTokenIdx();
|
||||
userDormantStatusDto.setUserTokenIdx(userTokenIdx);
|
||||
|
||||
if (userTokenIdx == null || userDormantStatusDto.getDormantYn() == null) {
|
||||
result.setDormantStatusUpdated(false);
|
||||
result.setResultCode(4003);
|
||||
return result;
|
||||
}
|
||||
|
||||
String dormantYn = userDormantStatusDto.getDormantYn();
|
||||
|
||||
if (!"Y".equals(dormantYn) && !"N".equals(dormantYn)) {
|
||||
result.setDormantStatusUpdated(false);
|
||||
result.setResultCode(4001);
|
||||
return result;
|
||||
}
|
||||
|
||||
int updateCount = userMapper.updateDormantStatus(userDormantStatusDto);
|
||||
|
||||
result.setDormantStatusUpdated(updateCount > 0);
|
||||
result.setResultCode(updateCount > 0 ? 2005 : 2003);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alist.api.modules.user.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Schema(description = "사용자 휴면 상태 변경 응답")
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserDormantStatusVo {
|
||||
@Schema(description = "휴면 상태 변경 여부", example = "true")
|
||||
private boolean dormantStatusUpdated;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(hidden = true)
|
||||
private Integer resultCode;
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import lombok.Setter;
|
||||
@Schema(description = "사용자 탈퇴 상태 변경 응답")
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserWithdrawStatusUpdateVo {
|
||||
public class UserWithdrawStatusVo {
|
||||
@Schema(description = "탈퇴 상태 변경 여부", example = "true")
|
||||
private boolean withdrawStatusUpdated;
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
INNER JOIN ALISTLMS.test_user_token ATUT ON ATUT.user_idx = ATU.user_idx
|
||||
SET ATU.withdraw_status = #{withdrawStatus}
|
||||
, ATU.withdraw_at =
|
||||
CASE
|
||||
WHEN #{withdrawStatus} = 'P' THEN now()
|
||||
WHEN #{withdrawStatus} = 'N' THEN NULL
|
||||
ELSE ATU.withdraw_at
|
||||
END
|
||||
CASE
|
||||
WHEN #{withdrawStatus} = 'P' THEN now()
|
||||
WHEN #{withdrawStatus} = 'N' THEN NULL
|
||||
ELSE ATU.withdraw_at
|
||||
END
|
||||
, ATU.update_at = now()
|
||||
WHERE ATUT.user_token_idx = #{userTokenIdx}
|
||||
AND ATU.del_yn = 1
|
||||
@@ -69,4 +69,21 @@
|
||||
AND ATU.del_yn = 1
|
||||
</select>
|
||||
|
||||
<update id="updateDormantStatus">
|
||||
/*UserMapper.updateDormantStatus*/
|
||||
UPDATE ALISTLMS.test_user ATU
|
||||
INNER JOIN ALISTLMS.test_user_token ATUT ON ATUT.user_idx = ATU.user_idx
|
||||
SET ATU.dormant_yn = #{dormantYn}
|
||||
, ATU.dormant_at =
|
||||
CASE
|
||||
WHEN #{dormantYn} = 'Y' THEN now()
|
||||
WHEN #{dormantYn} = 'N' THEN NULL
|
||||
ELSE ATU.dormant_at
|
||||
END
|
||||
, ATU.update_at = now()
|
||||
WHERE ATUT.user_token_idx = #{userTokenIdx}
|
||||
AND ATU.del_yn = 1
|
||||
AND ATU.withdraw_status != 'Y'
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -48,6 +48,44 @@
|
||||
AND ATU.del_yn = 1
|
||||
</update>
|
||||
|
||||
<update id="updateAdminMemberDormantStatus">
|
||||
/*AdminMemberMapper.updateAdminMemberDormantStatus*/
|
||||
UPDATE ALISTLMS.test_user
|
||||
SET dormant_yn = #{dormantYn}
|
||||
, dormant_at =
|
||||
CASE
|
||||
WHEN #{dormantYn} = 'Y' THEN now()
|
||||
WHEN #{dormantYn} = 'N' THEN NULL
|
||||
ELSE dormant_at
|
||||
END
|
||||
, update_at = now()
|
||||
WHERE user_idx = #{userIdx}
|
||||
AND del_yn = 1
|
||||
</update>
|
||||
|
||||
<update id="updateAdminMemberWithdrawStatus">
|
||||
/*AdminMemberMapper.updateAdminMemberWithdrawStatus*/
|
||||
UPDATE ALISTLMS.test_user
|
||||
SET withdraw_status = #{withdrawStatus}
|
||||
, withdraw_at =
|
||||
CASE
|
||||
WHEN #{withdrawStatus} IN ('P', 'Y') THEN now()
|
||||
WHEN #{withdrawStatus} = 'N' THEN NULL
|
||||
ELSE withdraw_at
|
||||
END
|
||||
, update_at = now()
|
||||
WHERE user_idx = #{userIdx}
|
||||
AND del_yn = 1
|
||||
</update>
|
||||
<update id="deleteAdminMember">
|
||||
/*AdminMemberMapper.deleteAdminMember*/
|
||||
UPDATE ALISTLMS.test_user
|
||||
SET del_yn = 0
|
||||
, update_at = now()
|
||||
WHERE user_idx = #{userIdx}
|
||||
AND del_yn = 1
|
||||
</update>
|
||||
|
||||
<select id="selectAdminMemberCount" resultType="int">
|
||||
/*AdminMemberMapper.selectAdminMemberCount*/
|
||||
SELECT COUNT(*)
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.alist.api.modules.auth.mapper.CorsMapper">
|
||||
<select id="selectCorsAllowedList" resultType="com.alist.api.modules.auth.vo.CorsOriginVo">
|
||||
<mapper namespace="com.alist.api.modules.cors.mapper.CorsMapper">
|
||||
<select id="selectCorsAllowedList" resultType="com.alist.api.modules.cors.vo.CorsOriginVo">
|
||||
/* CorsMapper.selectCorsAllowedList */
|
||||
SELECT allowed_origin
|
||||
FROM ALISTLMS.test_cors_allowed_list
|
||||
Reference in New Issue
Block a user