Skip to content

Commit

Permalink
Merge pull request #122 from Team-Going/develop
Browse files Browse the repository at this point in the history
[release] v1.1.0 릴리즈
  • Loading branch information
SunwoongH authored Feb 17, 2024
2 parents 7ec87b3 + af7b217 commit 8e6f923
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 9 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Doorip ✈️
> ## 서로를 이해하며 완성해가는 우리의 여행 To-do, Doorip
>
> 여행자 10명 중 6명은 여행을 같이 간 사람과 갈등을 겪고, 다음 여행에서는 누군가와 함께 하는 여행 자체를 망설이게 됩니다.
> 고잉고잉은 이 문제를 해결할, 쉽고 재밌는 솔루션을 만드는 팀입니다.
>
> Doorip에서 여행에서 공동 할일 관리에 대한 불편과 부담을 내려놓고 좋아하는 사람들과 여행을 오롯이 즐기세요.
> 여행 중에 생기는 모든 할 일을 함께 관리하세요. 두립의 여행 취향 테스트와 프로필 기능으로 서로를 이해할 수 있어요.
# doorip ✈️

![0](https://github.com/Team-Going/Going-Server/assets/81796317/6267da22-73c2-4f76-b05d-d2641663dcf0)

![1](https://github.com/Team-Going/Going-Server/assets/81796317/bcd86483-16f6-43ae-85a6-996cf3c12991)

![2](https://github.com/Team-Going/Going-Server/assets/81796317/c120c80c-ecd1-4c3b-b339-6c8b73bbb011)

![3](https://github.com/Team-Going/Going-Server/assets/81796317/31e28d6c-d46f-4b94-a932-ff1190d8d57a)

![4](https://github.com/Team-Going/Going-Server/assets/81796317/286bcf64-e821-48a2-bb58-ed791b060278)

![5](https://github.com/Team-Going/Going-Server/assets/81796317/3e34400a-02b9-43ed-9582-3a84f438e9e7)

<br>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import org.doorip.exception.InvalidValueException;
import org.doorip.exception.UnauthorizedException;
import org.doorip.message.ErrorMessage;
import org.doorip.message.EventMessage;
import org.doorip.openfeign.apple.AppleOAuthProvider;
import org.doorip.openfeign.discord.DiscordMessageProvider;
import org.doorip.openfeign.kakao.KakaoOAuthProvider;
import org.doorip.user.domain.*;
import org.doorip.user.dto.request.ResultUpdateRequest;
Expand Down Expand Up @@ -43,6 +45,7 @@ public class UserService {
private final JwtValidator jwtValidator;
private final AppleOAuthProvider appleOAuthProvider;
private final KakaoOAuthProvider kakaoOAuthProvider;
private final DiscordMessageProvider discordMessageProvider;

@Transactional(readOnly = true)
public void splash(Long userId) {
Expand All @@ -67,6 +70,7 @@ public UserSignUpResponse signUp(String token, UserSignUpRequest request) {
User savedUser = saveUser(request, platformId, enumPlatform);
Token issueToken = jwtProvider.issueToken(savedUser.getId());
updateRefreshToken(issueToken.refreshToken(), savedUser);
discordMessageProvider.sendMessage(EventMessage.SIGN_UP_EVENT);
return UserSignUpResponse.of(issueToken, savedUser.getId());
}

Expand Down Expand Up @@ -102,7 +106,6 @@ public void updateResult(Long userId, ResultUpdateRequest request) {
String stringResult = oneTypeResult(mappedIndex.subList(0, 3), "S", "A")
+ oneTypeResult(mappedIndex.subList(3, 6), "R", "E")
+ oneTypeResult(mappedIndex.subList(6, 9), "P", "I");

Result result = getEnumResultFromStringResult(stringResult);
findUser.updateResult(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum ErrorMessage {
INVALID_DATE_TYPE(HttpStatus.BAD_REQUEST, "e4004", "유효하지 않은 날짜 타입입니다."),
INVALID_RESULT_TYPE(HttpStatus.BAD_REQUEST, "e4005", "유효하지 않은 성향 입력 값입니다."),
INVALID_PARTICIPANT_COUNT(HttpStatus.BAD_REQUEST, "e4006", "여행에 입장할 수 있는 최대 인원은 6명입니다."),
INVALID_DISCORD_MESSAGE(HttpStatus.BAD_REQUEST, "e4007", "디스코드 메시지 전달에 실패했습니다."),

/**
* 401 Unauthorized
Expand Down
13 changes: 13 additions & 0 deletions doorip-common/src/main/java/org/doorip/message/EventMessage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.doorip.message;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum EventMessage {
SIGN_UP_EVENT("doorip 서비스에 회원가입 이벤트가 발생했습니다. 🎉");

private final String message;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.doorip.openfeign.discord;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "${discord.name}", url = "${discord.webhook-url}")
public interface DiscordFeignClient {
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
void sendMessage(@RequestBody DiscordMessage discordMessage);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.doorip.openfeign.discord;

public record DiscordMessage(
String content
) {
public static DiscordMessage createDiscordMessage(String message) {
return new DiscordMessage(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.doorip.openfeign.discord;

import feign.FeignException;
import lombok.RequiredArgsConstructor;
import org.doorip.exception.InvalidValueException;
import org.doorip.message.ErrorMessage;
import org.doorip.message.EventMessage;
import org.springframework.stereotype.Component;

import static org.doorip.openfeign.discord.DiscordMessage.createDiscordMessage;

@RequiredArgsConstructor
@Component
public class DiscordMessageProvider {
private final DiscordFeignClient discordFeignClient;

public void sendMessage(EventMessage eventMessage) {
DiscordMessage discordMessage = createDiscordMessage(eventMessage.getMessage());
sendMessageToDiscord(discordMessage);
}

private void sendMessageToDiscord(DiscordMessage discordMessage) {
try {
discordFeignClient.sendMessage(discordMessage);
} catch (FeignException e) {
throw new InvalidValueException(ErrorMessage.INVALID_DISCORD_MESSAGE);
}
}
}

0 comments on commit 8e6f923

Please sign in to comment.