Skip to content

Commit 1f7c73a

Browse files
authored
Merge pull request #19 from f-lab-edu/feat/#18
[#18] Feat 도메인 모듈 분리, 팔로우 레포지터리 쿼리 오류 수정
2 parents 7cd8db5 + aae535e commit 1f7c73a

File tree

160 files changed

+1527
-1571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1527
-1571
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ COPY gradle/ gradle/
99
COPY settings.gradle build.gradle ./
1010

1111
COPY closet-api/ closet-api/
12+
COPY closet-domain/ closet-domain/
1213

1314
RUN chmod +x gradlew
1415
RUN ./gradlew :closet-api:bootJar -x test --no-daemon

closet-api/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
project(':closet-api') {
22

33
dependencies {
4+
implementation project(':closet-domain')
45
implementation 'org.springframework.boot:spring-boot-starter-web'
56
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.4'
67
implementation 'org.springframework.boot:spring-boot-starter-validation'

closet-api/src/main/java/project/closet/auth/controller/AuthController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ResponseEntity<CsrfToken> getCsrfToken(CsrfToken csrfToken) {
4141
@Override
4242
@GetMapping("/me")
4343
public ResponseEntity<String> me(
44-
@CookieValue(value = JwtService.REFRESH_TOKEN_COOKIE_NAME, required = false) String refreshToken
44+
@CookieValue(value = JwtService.REFRESH_TOKEN_COOKIE_NAME, required = false) String refreshToken
4545
) {
4646
log.info("내 정보 조회 요청");
4747
if (refreshToken == null || refreshToken.isBlank()) {
@@ -54,14 +54,14 @@ public ResponseEntity<String> me(
5454

5555
@PostMapping("refresh")
5656
public ResponseEntity<String> refresh(
57-
@CookieValue(JwtService.REFRESH_TOKEN_COOKIE_NAME) String refreshToken,
58-
HttpServletResponse response
57+
@CookieValue(JwtService.REFRESH_TOKEN_COOKIE_NAME) String refreshToken,
58+
HttpServletResponse response
5959
) {
6060
log.info("토큰 재발급 요청");
6161
JwtSession jwtSession = jwtService.refreshJwtSession(refreshToken);
6262

6363
Cookie refreshTokenCookie = new Cookie(JwtService.REFRESH_TOKEN_COOKIE_NAME,
64-
jwtSession.getRefreshToken());
64+
jwtSession.getRefreshToken());
6565
refreshTokenCookie.setHttpOnly(true);
6666
response.addCookie(refreshTokenCookie);
6767

@@ -71,7 +71,7 @@ public ResponseEntity<String> refresh(
7171
@PostMapping("reset-password")
7272
@Override
7373
public ResponseEntity<Void> resetPassword(
74-
@RequestBody @Valid ResetPasswordRequest resetPasswordRequest
74+
@RequestBody @Valid ResetPasswordRequest resetPasswordRequest
7575
) {
7676
authService.resetPassword(resetPasswordRequest.email());
7777
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();

closet-api/src/main/java/project/closet/auth/controller/api/AuthApi.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,52 @@ public interface AuthApi {
1818

1919
@Operation(summary = "CSRF 토큰 발급")
2020
@ApiResponses(value = {
21-
@ApiResponse(
22-
responseCode = "200", description = "발급 성공",
23-
content = @Content(schema = @Schema(implementation = CsrfToken.class))
24-
)
21+
@ApiResponse(
22+
responseCode = "200", description = "발급 성공",
23+
content = @Content(schema = @Schema(implementation = CsrfToken.class))
24+
)
2525
})
2626
ResponseEntity<CsrfToken> getCsrfToken(@Parameter(hidden = true) CsrfToken csrfToken);
2727

2828
@Operation(summary = "리프레시 토큰을 활용한 엑세스 토큰 조회")
2929
@ApiResponses(value = {
30-
@ApiResponse(
31-
responseCode = "200", description = "조회 성공",
32-
content = @Content(schema = @Schema(implementation = String.class))
33-
),
34-
@ApiResponse(
35-
responseCode = "401", description = "유효하지 않은 리프레시 토큰",
36-
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
37-
)
30+
@ApiResponse(
31+
responseCode = "200", description = "조회 성공",
32+
content = @Content(schema = @Schema(implementation = String.class))
33+
),
34+
@ApiResponse(
35+
responseCode = "401", description = "유효하지 않은 리프레시 토큰",
36+
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
37+
)
3838
})
3939
ResponseEntity<String> me(@Parameter(hidden = true) String refreshToken);
4040

4141
@Operation(summary = "리프레시 토큰을 활용한 엑세스 토큰 재발급")
4242
@ApiResponses(value = {
43-
@ApiResponse(
44-
responseCode = "200", description = "재발급 성공",
45-
content = @Content(schema = @Schema(implementation = String.class))
46-
),
47-
@ApiResponse(
48-
responseCode = "401", description = "유효하지 않은 리프레시 토큰",
49-
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
50-
)
43+
@ApiResponse(
44+
responseCode = "200", description = "재발급 성공",
45+
content = @Content(schema = @Schema(implementation = String.class))
46+
),
47+
@ApiResponse(
48+
responseCode = "401", description = "유효하지 않은 리프레시 토큰",
49+
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
50+
)
5151
})
5252
ResponseEntity<String> refresh(
53-
@Parameter(hidden = true) String refreshToken,
54-
@Parameter(hidden = true) HttpServletResponse response
53+
@Parameter(hidden = true) String refreshToken,
54+
@Parameter(hidden = true) HttpServletResponse response
5555
);
5656

5757
// 비밀번호 초기화
5858
@Operation(summary = "비밀번호 초기화", description = "임시 비밀번호로 초기화 후 이메일로 전송합니다.")
5959
@ApiResponses(value = {
60-
@ApiResponse(
61-
responseCode = "204", description = "비밀번호 초기화 성공"
62-
),
63-
@ApiResponse(
64-
responseCode = "400", description = "잘못된 요청",
65-
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
66-
)
60+
@ApiResponse(
61+
responseCode = "204", description = "비밀번호 초기화 성공"
62+
),
63+
@ApiResponse(
64+
responseCode = "400", description = "잘못된 요청",
65+
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
66+
)
6767
})
6868
ResponseEntity<Void> resetPassword(ResetPasswordRequest resetPasswordRequest);
6969
}

closet-api/src/main/java/project/closet/auth/service/basic/BasicAuthService.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import org.springframework.transaction.annotation.Transactional;
99
import project.closet.auth.service.AuthService;
1010
import project.closet.dto.response.UserDto;
11+
import project.closet.entity.user.Profile;
12+
import project.closet.entity.user.Role;
13+
import project.closet.entity.user.User;
1114
import project.closet.exception.user.UserNotFoundException;
1215
import project.closet.mail.MailService;
1316
import project.closet.security.jwt.JwtService;
14-
import project.closet.user.entity.Profile;
15-
import project.closet.user.entity.Role;
16-
import project.closet.user.entity.User;
1717
import project.closet.user.repository.UserRepository;
1818

1919
@Slf4j
@@ -22,10 +22,10 @@
2222
public class BasicAuthService implements AuthService {
2323

2424
private static final char[] PASSWORD_CHARS = (
25-
"1234567890" +
26-
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
27-
"abcdefghijklmnopqrstuvwxyz" +
28-
"!@#$%^&*()"
25+
"1234567890" +
26+
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
27+
"abcdefghijklmnopqrstuvwxyz" +
28+
"!@#$%^&*()"
2929
).toCharArray();
3030
private static final int TEMP_PASSWORD_LENGTH = 10;
3131

@@ -63,7 +63,7 @@ public void initAdmin() {
6363
public void resetPassword(String email) {
6464
// 1. User 엔티티 조회
6565
User user = userRepository.findByEmail(email)
66-
.orElseThrow(() -> UserNotFoundException.withEmail(email));
66+
.orElseThrow(() -> UserNotFoundException.withEmail(email));
6767

6868
// 2-1. 임시 비밀번호 생성
6969
String tempPassword = generateTempPassword();
@@ -75,9 +75,9 @@ public void resetPassword(String email) {
7575

7676
// 초기화된 임시 비밀번호를 User email 로 발송해주기
7777
mailService.sendMimeMail(
78-
email,
79-
"[Closet] 임시 비밀번호 발급",
80-
tempPassword
78+
email,
79+
"[Closet] 임시 비밀번호 발급",
80+
tempPassword
8181
);
8282
}
8383

closet-api/src/main/java/project/closet/config/MDCLoggingInterceptor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public class MDCLoggingInterceptor implements HandlerInterceptor {
1313
public static final String REQUEST_URI = "requestUri";
1414

1515
@Override
16-
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
16+
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
17+
throws Exception {
1718
String requestId = UUID.randomUUID().toString().replaceAll("-", "");
1819

1920
MDC.put(REQUEST_ID, requestId);
@@ -23,7 +24,8 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
2324
}
2425

2526
@Override
26-
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
27+
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
28+
throws Exception {
2729
MDC.clear();
2830
}
2931
}

closet-api/src/main/java/project/closet/config/RedisConfig.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,28 @@
1212
@Configuration
1313
public class RedisConfig {
1414

15-
@Value("${spring.data.redis.host}")
16-
private String host;
17-
18-
@Value("${spring.data.redis.port}")
19-
private int port;
20-
21-
@Bean
22-
public LettuceConnectionFactory redisConnectionFactory() {
23-
return new LettuceConnectionFactory(new RedisStandaloneConfiguration(host, port));
24-
}
25-
26-
@Bean @Primary
27-
public RedisTemplate<String, Object> redisTemplate() {
28-
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
29-
30-
redisTemplate.setConnectionFactory(redisConnectionFactory());
31-
redisTemplate.setKeySerializer(new StringRedisSerializer());
32-
//redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
33-
redisTemplate.setValueSerializer(new StringRedisSerializer());
34-
redisTemplate.setEnableTransactionSupport(true);
35-
36-
return redisTemplate;
37-
}
15+
@Value("${spring.data.redis.host}")
16+
private String host;
17+
18+
@Value("${spring.data.redis.port}")
19+
private int port;
20+
21+
@Bean
22+
public LettuceConnectionFactory redisConnectionFactory() {
23+
return new LettuceConnectionFactory(new RedisStandaloneConfiguration(host, port));
24+
}
25+
26+
@Bean
27+
@Primary
28+
public RedisTemplate<String, Object> redisTemplate() {
29+
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
30+
31+
redisTemplate.setConnectionFactory(redisConnectionFactory());
32+
redisTemplate.setKeySerializer(new StringRedisSerializer());
33+
//redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
34+
redisTemplate.setValueSerializer(new StringRedisSerializer());
35+
redisTemplate.setEnableTransactionSupport(true);
36+
37+
return redisTemplate;
38+
}
3839
}

closet-api/src/main/java/project/closet/config/S3Config.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public class S3Config {
1717
private final String region;
1818

1919
public S3Config(
20-
@Value("${closet.storage.s3.access-key}") String accessKey,
21-
@Value("${closet.storage.s3.secret-key}") String secretKey,
22-
@Value("${closet.storage.s3.region}") String region
20+
@Value("${closet.storage.s3.access-key}") String accessKey,
21+
@Value("${closet.storage.s3.secret-key}") String secretKey,
22+
@Value("${closet.storage.s3.region}") String region
2323
) {
2424
this.accessKey = accessKey;
2525
this.secretKey = secretKey;
@@ -29,25 +29,25 @@ public S3Config(
2929
@Bean
3030
public S3Client s3Client() {
3131
return S3Client.builder()
32-
.region(Region.of(region))
33-
.credentialsProvider(
34-
StaticCredentialsProvider.create(
35-
AwsBasicCredentials.create(accessKey, secretKey)
36-
)
32+
.region(Region.of(region))
33+
.credentialsProvider(
34+
StaticCredentialsProvider.create(
35+
AwsBasicCredentials.create(accessKey, secretKey)
3736
)
38-
.build();
37+
)
38+
.build();
3939
}
4040

4141
@Bean
4242
public S3Presigner s3Presigner() {
4343
return S3Presigner.builder()
44-
.region(Region.of(region))
45-
.credentialsProvider(
46-
StaticCredentialsProvider.create(
47-
AwsBasicCredentials.create(accessKey, secretKey)
48-
)
44+
.region(Region.of(region))
45+
.credentialsProvider(
46+
StaticCredentialsProvider.create(
47+
AwsBasicCredentials.create(accessKey, secretKey)
4948
)
50-
.build();
49+
)
50+
.build();
5151
}
5252

5353
}

0 commit comments

Comments
 (0)