-
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.
Merge pull request #29 from Nexters/yihyun/add/apis
Chore change of APIs
- Loading branch information
Showing
11 changed files
with
159 additions
and
12 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
api/src/main/java/com/nexters/gaetteok/common/filter/RequestLoggingFilter.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.nexters.gaetteok.common.filter; | ||
|
||
import jakarta.servlet.FilterChain; | ||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.filter.OncePerRequestFilter; | ||
|
||
import java.io.IOException; | ||
|
||
@Slf4j | ||
@Component | ||
public class RequestLoggingFilter extends OncePerRequestFilter { | ||
|
||
@Override | ||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { | ||
log.info("[{}] {}, token: {}, parameterCount: {}", request.getMethod(), request.getRequestURI(), request.getHeader("Authorization"), request.getParameterMap().values().size()); | ||
request.getParameterMap().forEach((key, value) -> log.info("Request Parameter: {}={}", key, value)); | ||
filterChain.doFilter(request, response); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
api/src/main/java/com/nexters/gaetteok/user/constant/MainScreenImage.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.nexters.gaetteok.user.constant; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum MainScreenImage { | ||
|
||
BEFORE_WALKING("https://kr.object.ncloudstorage.com/gaetteok-image/home/home_beforewalking.png"), | ||
AFTER_WALKING("https://kr.object.ncloudstorage.com/gaetteok-image/home/home_afterwalking.png"), | ||
; | ||
|
||
private final String imageUrl; | ||
|
||
MainScreenImage(String imageUrl) { | ||
this.imageUrl = imageUrl; | ||
} | ||
|
||
public static String getImageUrl(boolean walkDone) { | ||
return walkDone ? AFTER_WALKING.imageUrl : BEFORE_WALKING.imageUrl; | ||
} | ||
|
||
} |
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
57 changes: 57 additions & 0 deletions
57
api/src/main/java/com/nexters/gaetteok/user/presentation/response/GetUserStatusResponse.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,57 @@ | ||
package com.nexters.gaetteok.user.presentation.response; | ||
|
||
import com.nexters.gaetteok.domain.User; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
public class GetUserStatusResponse { | ||
|
||
@Schema(description = "유저 ID", example = "1") | ||
private final long id; | ||
|
||
@Schema(description = "유저 닉네임", example = "뽀삐") | ||
private final String nickname; | ||
|
||
@Schema(description = "유저 프로필 이미지 URL", example = "https://profile.com/1") | ||
private final String profileImageUrl; | ||
|
||
@Schema(description = "유저 코드", example = "1a2b3c") | ||
private final String code; | ||
|
||
@Schema(description = "산책 완료 여부", example = "true") | ||
private final boolean walkDone; | ||
|
||
@Schema(description = "메인 화면 이미지 URL", example = "https://main.com/wait.jpg") | ||
private final String mainScreenImageUrl; | ||
|
||
@Schema(description = "유저 생성일", example = "2021-08-01T00:00:00") | ||
private final LocalDateTime createdAt; | ||
|
||
@Builder | ||
public GetUserStatusResponse(long id, String nickname, String profileImageUrl, String code, boolean walkDone, String mainScreenImageUrl, LocalDateTime createdAt) { | ||
this.id = id; | ||
this.nickname = nickname; | ||
this.profileImageUrl = profileImageUrl; | ||
this.code = code; | ||
this.walkDone = walkDone; | ||
this.mainScreenImageUrl = mainScreenImageUrl; | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public static GetUserStatusResponse of(User user, boolean walkDone, String mainScreenImageUrl) { | ||
return GetUserStatusResponse.builder() | ||
.id(user.getId()) | ||
.nickname(user.getNickname()) | ||
.profileImageUrl(user.getProfileUrl()) | ||
.code(user.getCode()) | ||
.walkDone(walkDone) | ||
.mainScreenImageUrl(mainScreenImageUrl) | ||
.createdAt(user.getCreatedAt()) | ||
.build(); | ||
} | ||
|
||
} |
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
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