-
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.
Browse files
Browse the repository at this point in the history
[FEAT/#71] 내 프로필 조회 API 구현
- Loading branch information
Showing
15 changed files
with
315 additions
and
30 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
38 changes: 38 additions & 0 deletions
38
src/main/java/com/acon/server/global/auth/CacheConfig.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,38 @@ | ||
package com.acon.server.global.auth; | ||
|
||
import com.github.benmanes.caffeine.cache.Caffeine; | ||
import java.util.Collections; | ||
import java.util.concurrent.TimeUnit; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.cache.CacheManager; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.cache.caffeine.CaffeineCache; | ||
import org.springframework.cache.support.SimpleCacheManager; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
// TODO: 어노테이션을 활용하여 리팩 | ||
@Configuration | ||
@EnableCaching | ||
public class CacheConfig { | ||
|
||
@Value("${jwt.refresh-token-expire-time}") | ||
private long REFRESH_TOKEN_EXPIRATION_TIME; | ||
|
||
@Bean | ||
public CacheManager cacheManager() { | ||
// TODO: initialCapacity, maximumSize 설정 | ||
// 최대 용량 설정을 따로 진행하지 않음. 메모리 부족 문제 주의 필요 | ||
Caffeine<Object, Object> caffeineBuilder = Caffeine.newBuilder() | ||
.expireAfterWrite(REFRESH_TOKEN_EXPIRATION_TIME, TimeUnit.MILLISECONDS); | ||
|
||
CaffeineCache refreshTokenCache = new CaffeineCache( | ||
"refreshTokenCache", | ||
caffeineBuilder.build() | ||
); | ||
|
||
SimpleCacheManager cacheManager = new SimpleCacheManager(); | ||
cacheManager.setCaches(Collections.singletonList(refreshTokenCache)); | ||
return cacheManager; | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
src/main/java/com/acon/server/member/api/request/LogoutRequest.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,10 @@ | ||
package com.acon.server.member.api.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record LogoutRequest( | ||
@NotBlank(message = "refreshToken은 공백일 수 없습니다.") | ||
String refreshToken | ||
) { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/acon/server/member/api/request/ReissueTokenRequest.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,10 @@ | ||
package com.acon.server.member.api.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record ReissueTokenRequest( | ||
@NotBlank(message = "refreshToken은 공백일 수 없습니다.") | ||
String refreshToken | ||
) { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/acon/server/member/api/request/WithdrawalReasonRequest.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,12 @@ | ||
package com.acon.server.member.api.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record WithdrawalReasonRequest( | ||
@NotBlank(message = "탈퇴 이유는 공백일 수 없습니다.") | ||
String reason, | ||
@NotBlank(message = "refreshToken은 공백일 수 없습니다.") | ||
String refreshToken | ||
) { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/acon/server/member/api/response/ProfileResponse.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.acon.server.member.api.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
import java.util.List; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
@JsonInclude(Include.NON_NULL) | ||
public record ProfileResponse( | ||
String image, | ||
String nickname, | ||
int leftAcornCount, | ||
String birthDate, | ||
List<VerifiedArea> verifiedArea | ||
) { | ||
|
||
public record VerifiedArea( | ||
Long id, | ||
String name | ||
) { | ||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/acon/server/member/api/response/ReissueTokenResponse.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,14 @@ | ||
package com.acon.server.member.api.response; | ||
|
||
public record ReissueTokenResponse( | ||
String accessToken, | ||
String refreshToken | ||
) { | ||
|
||
public static ReissueTokenResponse of( | ||
final String accessToken, | ||
final String refreshToken | ||
) { | ||
return new ReissueTokenResponse(accessToken, refreshToken); | ||
} | ||
} |
Oops, something went wrong.