dynamodb nickname 추가
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package com.caliverse.admin.dynamodb.service;
|
||||
|
||||
import com.caliverse.admin.domain.entity.BlackList;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.UserBaseAttrib;
|
||||
import com.caliverse.admin.dynamodb.repository.*;
|
||||
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -17,27 +21,20 @@ import org.springframework.stereotype.Service;
|
||||
public class DynamodbUserService {
|
||||
private final AccountBaseRepository accountBaseRepository;
|
||||
private final UserBaseRepository userBaseRepository;
|
||||
private final UserNicknameRegistryRepository registryRepository;
|
||||
private final NicknameRepository nicknameRepository;
|
||||
|
||||
private final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public boolean isBlockUser(String account_id){
|
||||
public boolean isBlockUser(String guid){
|
||||
String account_id = getGuidByAccountId(guid);
|
||||
return accountBaseRepository.isBlockUser(account_id);
|
||||
}
|
||||
|
||||
@DynamoDBTransaction
|
||||
public void updateBlockUser(BlackList.STATUSTYPE status, BlackList blackList){
|
||||
String guid = blackList.getGuid();
|
||||
UserBaseAttrib userBaseAttrib = userBaseRepository.findUser(guid);
|
||||
if(userBaseAttrib == null){
|
||||
try {
|
||||
log.error("updateBlockUser UserBase Null blackList: {}", mapper.writeValueAsString(blackList));
|
||||
}catch (JsonProcessingException e){
|
||||
log.error("updateBlockUser BlackList JsonProcessingException");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
String account_id = userBaseAttrib.getAccountId();
|
||||
String account_id = getGuidByAccountId(guid);
|
||||
|
||||
if(status.equals(BlackList.STATUSTYPE.INPROGRESS)){
|
||||
accountBaseRepository.updateBlockUserStart(account_id, blackList);
|
||||
@@ -47,4 +44,24 @@ public class DynamodbUserService {
|
||||
}
|
||||
}
|
||||
|
||||
public String getGuidByName(String guid){
|
||||
NicknameAttrib nicknameAttrib = nicknameRepository.findUser(guid);
|
||||
if(nicknameAttrib == null){
|
||||
log.error("getGuidByName Nickname Null guid: {}", guid);
|
||||
return "";
|
||||
}
|
||||
|
||||
return nicknameAttrib.getNickname();
|
||||
}
|
||||
|
||||
public String getGuidByAccountId(String guid){
|
||||
UserBaseAttrib userBaseAttrib = userBaseRepository.findUser(guid);
|
||||
if(userBaseAttrib == null){
|
||||
log.error("getGuidByAccountId UserBase Null guid: {}", guid);
|
||||
return "";
|
||||
}
|
||||
|
||||
return userBaseAttrib.getAccountId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user