-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [fix #142] 앨범 내 사진 조회 최신순으로 정렬 (#143) * [fix #140] 앨범 공유 수락 API 로직 수정 (#144) * [feat #128] 포토부스 관련 API 구현 (#146) * [feat #128] 포토부스 관련 API 구현 * [fix #128] Photo 공유 수락 API 로직 수정 * [chore #128] swagger 업데이트 * [chore #128] 공백 제거 * [fix #147] 포포리즘 공유 API 수정 (#148) * [feat #128] 포토부스 관련 API 구현 * [fix #128] Photo 공유 수락 API 로직 수정 * [chore #128] swagger 업데이트 * [chore #128] 공백 제거 * [fix #147] 포포리즘 공유 API 수정 * [chore #147] swagger 수정 * [hotfix #149] 포포리즘 공유 API request body 수정 (#150) * [hotfix #149] 포포리즘 공유 request body 수정 * [chore #149] 사용하지 않는 import 제거 * [setting #149] banner 추가 * [chore #149] CI 스크립트 수정 * [chore #149] CI prod 스크립트 수정 * [chore #149] cd 스크립트 수정 * [fix #151] 배포 전 버그 수정 (access token 만료 시간 변경, 포포리즘 공유 API 수정) (#152) * [fix #151] Access Token 만료시간 변경 * [fix #151] 사진 upload url 변경 * [fix #151] 포포리즘 공유시에 이미지 저장 url 변경 (#153) * [fix #151] Access Token 만료시간 변경 * [fix #151] 사진 upload url 변경 * [hotfix #151] 포포리즘 저장 url 변경 * [refactor #156] slack 회원가입시에 알람 추가 (#157) * [refactor #156] slack 회원가입시에 알람 추가 * [fix #156] IOException 처리 * [fix #158] slack 메세지 알림 수정 (#159) * [fix #158] 어노테이션 변경 (#160) * [fix #158] slack 메세지 알림 수정 * [fix #158] annotation 변경 * [test #163] add domain test code (#167) * [feat #169] 토큰 재발급, 회원 탈퇴 API V2 구현 (#170) * [feat #169] 토큰 재발급, 회원 탈퇴 API V2 구현 * [feat #169] 애플리케이션 실행 스크립트 추가 * [refactor #165] slack 알림 기능 고도화 (#171) --------- Co-authored-by: Yunseo Kang <[email protected]>
- Loading branch information
Showing
18 changed files
with
347 additions
and
26 deletions.
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
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,26 @@ | ||
#!/bin/bash | ||
|
||
# Check if an argument is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <environment>" | ||
exit 1 | ||
fi | ||
|
||
# Set the environment variable | ||
ENV=$1 | ||
|
||
# Run the Gradle command | ||
./gradlew clean build -x test | ||
|
||
# Check if the gradle build command succeeded | ||
if [ $? -ne 0 ]; then | ||
echo "Gradle build failed!" | ||
exit 2 | ||
fi | ||
|
||
# Change directory and run the Java command | ||
cd build/libs | ||
nohup java -Dspring.profiles.active=${ENV} -jar pophoryserver-0.0.1-SNAPSHOT.jar --server.port=8080 & | ||
|
||
echo "Server started with profile: ${ENV}" | ||
|
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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/pophory/pophoryserver/domain/member/MemberQueryRepository.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,22 @@ | ||
package com.pophory.pophoryserver.domain.member; | ||
|
||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import static com.pophory.pophoryserver.domain.member.QMember.*; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class MemberQueryRepository { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
public Member findMemberById(Long id) { | ||
return queryFactory.select(member) | ||
.from(member) | ||
.where(member.id.eq(id)) | ||
.fetchOne(); | ||
} | ||
} |
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
44 changes: 31 additions & 13 deletions
44
src/main/java/com/pophory/pophoryserver/domain/slack/SlackService.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 |
---|---|---|
@@ -1,30 +1,48 @@ | ||
package com.pophory.pophoryserver.domain.slack; | ||
|
||
import com.pophory.pophoryserver.domain.slack.dto.SlackMessageDto; | ||
import com.slack.api.methods.MethodsClient; | ||
import com.slack.api.methods.SlackApiException; | ||
import com.slack.api.methods.request.chat.ChatPostMessageRequest; | ||
import com.slack.api.methods.response.chat.ChatPostMessageResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.http.HttpEntity; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.client.RestTemplate; | ||
import com.slack.api.Slack; | ||
|
||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
|
||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class SlackService { | ||
|
||
@Value("${slack.webhook.url}") | ||
private String SLACK_WEBHOOK_URL; | ||
@Value("${slack.bot.token}") | ||
private String SLACK_TOKEN; | ||
|
||
public void sendSignInAlert(String nickname){ | ||
RestTemplate restTemplate = new RestTemplate(); | ||
restTemplate.postForEntity( | ||
SLACK_WEBHOOK_URL, | ||
createSlackHttpRequest("🎉 " + nickname + "님이 포포리의 회원가입을 완료했습니다. 🎉"), | ||
String.class); | ||
} | ||
private final Environment env; | ||
|
||
private HttpEntity<SlackMessageDto> createSlackHttpRequest(String text) { | ||
HttpHeaders headers = new HttpHeaders(); | ||
headers.add("Accept", "application/json; UTF-8"); | ||
return new HttpEntity<>(SlackMessageDto.of(text), headers); | ||
|
||
public void sendMessage(String channel, String text) { | ||
try { | ||
Slack slack = Slack.getInstance(); | ||
ChatPostMessageResponse response = slack.methods(SLACK_TOKEN).chatPostMessage(req -> req | ||
.channel(channel) | ||
.text("["+getProfiles()+"]"+ text)); | ||
System.out.println(response); | ||
} catch (IOException | SlackApiException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
private String getProfiles() { | ||
return Arrays.stream(env.getActiveProfiles()) | ||
.findFirst() | ||
.orElse(""); | ||
} | ||
} |
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
Oops, something went wrong.