Skip to content
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

[REFACTOR] common과 external 모듈 분리 #83

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.apple;
package sopt.org.umbba.external.client.auth.apple;

import io.jsonwebtoken.Claims;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.apple.verify;
package sopt.org.umbba.external.client.auth.apple.verify;

import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.apple.verify;
package sopt.org.umbba.external.client.auth.apple.verify;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.apple.verify;
package sopt.org.umbba.external.client.auth.apple.verify;

import sopt.org.umbba.global.exception.CustomException;
import sopt.org.umbba.global.exception.ErrorType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package sopt.org.umbba.domain.user.social.apple.verify;
package sopt.org.umbba.external.client.auth.apple.verify;

import org.springframework.stereotype.Component;
import org.springframework.util.Base64Utils;
import sopt.org.umbba.domain.user.social.apple.response.ApplePublicKey;
import sopt.org.umbba.domain.user.social.apple.response.ApplePublicKeys;
import sopt.org.umbba.external.client.auth.apple.response.ApplePublicKey;
import sopt.org.umbba.external.client.auth.apple.response.ApplePublicKeys;
import sopt.org.umbba.global.exception.CustomException;
import sopt.org.umbba.global.exception.ErrorType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.kakao;
package sopt.org.umbba.external.client.auth.kakao;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
Expand Down
4 changes: 4 additions & 0 deletions umbba-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
bootJar { enabled = false }
jar { enabled = true }
dependencies {

// for HttpStatus
implementation 'org.springframework.boot:spring-boot-starter-web'

// redis
implementation "org.springframework.boot:spring-boot-starter-data-redis"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.global.exception;
package sopt.org.umbba.common.exception;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.global.exception;
package sopt.org.umbba.common.exception;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package sopt.org.umbba.global.common.dto;
package sopt.org.umbba.common.exception.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import sopt.org.umbba.global.exception.ErrorType;
import sopt.org.umbba.global.exception.SuccessType;
import sopt.org.umbba.common.exception.ErrorType;
import sopt.org.umbba.common.exception.SuccessType;

@Getter
@JsonPropertyOrder({"status", "message", "data"})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sopt.org.umbba.global.exception;
package sopt.org.umbba.common.exception.model;

import lombok.Getter;
import sopt.org.umbba.common.exception.ErrorType;

@Getter
public class CustomException extends RuntimeException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package sopt.org.umbba.common.sqs;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class MessageType {

public static final String MESSAGE_TYPE_HEADER = "TYPE";
public static final String FIREBASE = "FIREBASE";
public static final String SLACK = "SLACK";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package sopt.org.umbba.common.sqs;

public class MessageUtils {

public static <P1> String generate(String message, P1 param1) {
return String.format(message, param1);
}

public static <P1, P2> String generate(String message, P1 param1, P2 param2) {
return String.format(message, param1, param2);
}

public static <P1, P2, P3> String generate(String message, P1 param1, P2 param2, P3 param3) {
return String.format(message, param1, param2, param3);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package sopt.org.umbba.common.sqs.dto;

import lombok.*;
import lombok.experimental.SuperBuilder;
import sopt.org.umbba.common.sqs.MessageType;

@ToString
@Getter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@SuperBuilder
public class FirebaseDto extends MessageDto {

private String fcmToken;
private String title;
private String body;

public static FirebaseDto of(String fcmToken, String title, String body) {
return FirebaseDto.builder()
.type(MessageType.FIREBASE)
.fcmToken(fcmToken)
.title(title)
.body(body)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package sopt.org.umbba.common.sqs.dto;

import lombok.*;
import lombok.experimental.SuperBuilder;

@ToString
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@SuperBuilder
public class MessageDto {

protected String type;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package sopt.org.umbba.common.sqs.dto;

import lombok.*;
import lombok.experimental.SuperBuilder;
import sopt.org.umbba.common.sqs.MessageType;

@ToString
@Getter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@SuperBuilder
public class SlackDto extends MessageDto {

private Exception error;
private String requestMethod;
private String requestURI;

public static SlackDto of(Exception error, String requestMethod, String requestURI) {
return SlackDto.builder()
.type(MessageType.SLACK)
.error(error)
.requestMethod(requestMethod)
.requestURI(requestURI)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package sopt.org.umbba.domain.user.social.apple.feign;
package sopt.org.umbba.external.client.auth.apple;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import sopt.org.umbba.domain.user.social.apple.response.ApplePublicKeys;
import sopt.org.umbba.external.client.auth.apple.response.ApplePublicKeys;

@FeignClient(name = "apple-public-verify-client", url = "https://appleid.apple.com/auth")
public interface AppleApiClient {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.apple.response;
package sopt.org.umbba.external.client.auth.apple.response;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package sopt.org.umbba.domain.user.social.apple.response;
package sopt.org.umbba.external.client.auth.apple.response;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import sopt.org.umbba.global.exception.CustomException;
import sopt.org.umbba.global.exception.ErrorType;
import sopt.org.umbba.common.exception.model.CustomException;
import sopt.org.umbba.common.exception.ErrorType;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package sopt.org.umbba.domain.user.social.kakao.feign;
package sopt.org.umbba.external.client.auth.kakao;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import sopt.org.umbba.domain.user.social.kakao.response.KakaoUserResponse;
import sopt.org.umbba.external.client.auth.kakao.response.KakaoUserResponse;

@FeignClient(name = "kakaoApiClient", url = "https://kapi.kakao.com")
public interface KakaoApiClient {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package sopt.org.umbba.domain.user.social.kakao.feign;
package sopt.org.umbba.external.client.auth.kakao;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import sopt.org.umbba.domain.user.social.kakao.response.KakaoAccessTokenResponse;
import sopt.org.umbba.external.client.auth.kakao.response.KakaoAccessTokenResponse;

@FeignClient(name = "kakaoAuthApiClient", url = "https://kauth.kakao.com")
public interface KakaoAuthApiClient {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.kakao.response;
package sopt.org.umbba.external.client.auth.kakao.response;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.kakao.response;
package sopt.org.umbba.external.client.auth.kakao.response;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.kakao.response;
package sopt.org.umbba.external.client.auth.kakao.response;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sopt.org.umbba.domain.user.social.kakao.response;
package sopt.org.umbba.external.client.auth.kakao.response;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
Expand Down