유저 닉네임 변경 처리
This commit is contained in:
@@ -56,7 +56,6 @@ public class UsersService {
|
||||
private final DynamodbUserService dynamodbUserService;
|
||||
private final DynamodbItemService dynamodbItemService;
|
||||
|
||||
//metadataHandler 어떻게 가져와야 되는가
|
||||
@Autowired
|
||||
private MetaDataHandler metaDataHandler;
|
||||
|
||||
@@ -69,17 +68,11 @@ public class UsersService {
|
||||
//신규 닉네임 유효성 체크
|
||||
ErrorCode check = CommonUtils.isValidNickname(newNickname);
|
||||
if(!check.equals(ErrorCode.SUCCESS)){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), check.getMessage() );
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), check.toString() );
|
||||
}
|
||||
|
||||
String isGuid = dynamodbUserService.getNameByGuid(newNickname);
|
||||
|
||||
if(!isGuid.isEmpty()){
|
||||
//변경 닉네임이 존재합니다. 다시 시도해주세요.
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_EXIT_ERROR.getMessage() );
|
||||
}else{
|
||||
dynamoDBService.updateNickname(guid,nickname,newNickname);
|
||||
}
|
||||
userGameSessionService.kickUserSession(guid, String.format("%s User Nickname Changes", nickname));
|
||||
dynamodbUserService.changesNickname(guid, nickname, newNickname);
|
||||
|
||||
return UsersResponse.builder()
|
||||
.resultData(UsersResponse.ResultData.builder()
|
||||
@@ -133,14 +126,23 @@ public class UsersService {
|
||||
// Map<String,String> res = dynamoDBService.findUsersBykey(searchType, searchKey);
|
||||
Map<String,String> resultMap = new HashMap<>();
|
||||
if(searchType.equals(SEARCHTYPE.NAME.name())){
|
||||
resultMap.put("guid", dynamodbUserService.getNameByGuid(searchKey.toLowerCase())); //nickname은 무조건 소문자
|
||||
resultMap.put("nickname", searchKey);
|
||||
String name_guid = dynamodbUserService.getNameByGuid(searchKey.toLowerCase());
|
||||
if(!name_guid.isEmpty()){
|
||||
resultMap.put("guid", name_guid); //nickname은 무조건 소문자
|
||||
resultMap.put("nickname", searchKey);
|
||||
}
|
||||
}else if(searchType.equals(SEARCHTYPE.GUID.name())){
|
||||
resultMap.put("guid", searchKey);
|
||||
resultMap.put("nickname", dynamodbUserService.getGuidByName(searchKey));
|
||||
String guid_name = dynamodbUserService.getGuidByName(searchKey);
|
||||
if(!guid_name.isEmpty()){
|
||||
resultMap.put("guid", searchKey);
|
||||
resultMap.put("nickname", guid_name);
|
||||
}
|
||||
}else if(searchType.equals(SEARCHTYPE.ACCOUNT.name())){
|
||||
resultMap.put("guid", dynamodbUserService.getAccountIdByGuid(searchKey));
|
||||
resultMap.put("nickname", dynamodbUserService.getAccountIdByName(searchKey));
|
||||
String account_guid = dynamodbUserService.getAccountIdByGuid(searchKey);
|
||||
if(!account_guid.isEmpty()){
|
||||
resultMap.put("guid", account_guid);
|
||||
resultMap.put("nickname", dynamodbUserService.getAccountIdByName(searchKey));
|
||||
}
|
||||
}
|
||||
|
||||
return UsersResponse.builder()
|
||||
|
||||
Reference in New Issue
Block a user