-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#31] Telegram Bot 기본 연동 및 회원가입 기능 구현 #32
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4be84ed
feat: User domain 요소 추가
austinhong22 c47e987
feat: UserService OTP login 변경
austinhong22 72a06ce
feat: JWTService Login 변경
austinhong22 2c5f272
feat: domain Password 삭제 및 TelegramBot 생성
austinhong22 7dcf968
feat: 순환참조 삭제, 텔레그램 봇 회원가입, 로그인 구현
austinhong22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ public CommandLineRunner run(WebSocketManager webSocketManager) { | |
webSocketManager.startAll(); | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
common/src/main/java/com/whalewatch/config/TelegramBotProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.whalewatch.config; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@ConfigurationProperties(prefix = "telegram.bot") | ||
public class TelegramBotProperties { | ||
private String username; | ||
private String token; | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
public String getToken() { | ||
return token; | ||
} | ||
public void setToken(String token) { | ||
this.token = token; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,31 @@ public class User { | |
|
||
private String email; | ||
private String username; | ||
private String password; | ||
|
||
private Long telegramChatId; | ||
private String otpHash; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 필드는 일회용일테니, 필요하다면, 캐쉬같은 곳에 저장하면 좋을 것 같네요. |
||
|
||
public Long getTelegramChatId() { | ||
return telegramChatId; | ||
} | ||
|
||
public void setTelegramChatId(Long telegramChatId) { | ||
this.telegramChatId = telegramChatId; | ||
} | ||
|
||
public String getOtpHash() { | ||
return otpHash; | ||
} | ||
|
||
public void setOtpHash(String otpHash) { | ||
this.otpHash = otpHash; | ||
} | ||
|
||
protected User() {} | ||
|
||
public User(String email, String username, String password) { | ||
public User(String email, String username) { | ||
this.email = email; | ||
this.username = username; | ||
this.password = password; | ||
} | ||
|
||
public int getId() { | ||
|
@@ -33,10 +50,6 @@ public String getUsername() { | |
return username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
|
@@ -45,7 +58,4 @@ public void setUsername(String username) { | |
this.username = username; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
service/src/main/java/com/whalewatch/telegram/TelegramBotConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.whalewatch.telegram; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.telegram.telegrambots.meta.TelegramBotsApi; | ||
import org.telegram.telegrambots.meta.exceptions.TelegramApiException; | ||
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession; | ||
|
||
@Configuration | ||
public class TelegramBotConfig { | ||
@Bean | ||
public TelegramBotsApi telegramBotsApi(TelegramUserBot telegramUserBot) throws TelegramApiException { | ||
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class); | ||
botsApi.registerBot(telegramUserBot); | ||
return botsApi; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
service/src/main/java/com/whalewatch/telegram/TelegramMessageEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.whalewatch.telegram; | ||
|
||
public class TelegramMessageEvent { | ||
private final Long chatId; | ||
private final String message; | ||
|
||
public TelegramMessageEvent(Long chatId, String message) { | ||
this.chatId = chatId; | ||
this.message = message; | ||
} | ||
|
||
public Long getChatId() { | ||
return chatId; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리턴 타입을 전부 동일하게 맞추는 것이 좋을 것 같습니다. 그래서 이 메소드도 클래스로 감싸서 결과를 내보내면 좋을 것 같네요.