Skip to content

Commit

Permalink
[FEAT] 슬랙 메세지 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yujindonut committed Dec 18, 2023
1 parent 2140221 commit 9a09082
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,36 @@ private User issueAccessToken(AuthSignInRequestDTO request) {
private User signup(AuthSignInRequestDTO request) {
return userRepository.save(new User(request));
}

private JsonNode createSlackRequest(String nickname, String email, LocalDateTime createdAt, String socialType) {
val rootNode = jsonMapper.createObjectNode();
rootNode.put("text", "새로운 유저가 가입했어요!");
val blocks = jsonMapper.createArrayNode();

val textField = jsonMapper.createObjectNode();
textField.put("type", "section");
textField.set("text", createTextFieldNode("새로운 유저가 가입했어요!"));

val contentNode = jsonMapper.createObjectNode();
contentNode.put("type", "section");
val fields = jsonMapper.createArrayNode();
fields.add(createTextFieldNode("*이름:*\n" + nickname));
fields.add(createTextFieldNode("*이메알:*\n"+ email));
fields.add(createTextFieldNode("*가입 시간:*\n" + createdAt));
fields.add(createTextFieldNode("*소셜:*\n" + socialType));
contentNode.set("fields", fields);

blocks.add(textField);
blocks.add(contentNode);
rootNode.set("blocks", blocks);
return rootNode;
}

private JsonNode createTextFieldNode (String text) {
val textField = jsonMapper.createObjectNode();
textField.put("type", "mrkdwn");
textField.put("text", text);
return textField;
}

}

0 comments on commit 9a09082

Please sign in to comment.