-
Notifications
You must be signed in to change notification settings - Fork 0
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
회원가입 약관 동의 api 수정 및 온보딩 관심 아티스트 등록 api 추가 #25
Changes from 14 commits
a7c7bf4
dd13a04
3d88589
969bf72
85308ba
83133cb
59273f1
4f27f4a
ed7e8a2
bbea6ea
725a6a5
7768581
1b4e3ff
e30e937
b7a823e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
package com.projectlyrics.server.domain.artist.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.Pattern; | ||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record ArtistAddRequest( | ||
@Schema(name = "아티스트의 한글 이름") | ||
@Pattern(regexp = "^(?!\\s*$).+", message = "빈 문자열 또는 공백 문자열은 허용하지 않습니다.") | ||
@NotBlank | ||
@Schema(name = "아티스트의 이름") | ||
String name, | ||
@Schema(name = "아티스트의 영어 이름") | ||
@Pattern(regexp = "^(?!\\s*$).+", message = "빈 문자열 또는 공백 문자열은 허용하지 않습니다.") | ||
String englishName, | ||
|
||
@Schema(name = "아티스트의 cdn 이미지 경로") | ||
@Pattern(regexp = "^https://.*", message = "이미지 경로는 https://로 시작해야 합니다.") | ||
String profileImageCdnLink | ||
String imageUrl | ||
) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,12 @@ | |
import jakarta.servlet.http.HttpServletResponse; | ||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.Optional; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; | ||
import org.springframework.stereotype.Component; | ||
|
@@ -31,21 +33,26 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { | |
|
||
private static final String TOKEN_PREFIX = "Bearer "; | ||
|
||
@Value("#{'${auth.free-apis}'.split(',')}") | ||
private String[] excludePath; | ||
|
||
private final JwtTokenProvider jwtTokenProvider; | ||
|
||
@Override | ||
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException { | ||
String path = request.getRequestURI(); | ||
return Arrays.asList(excludePath).contains(path); | ||
} | ||
|
||
Comment on lines
+41
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 결국 이 부분을 넣으셨군요 ㅎㅎㅎ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@Override | ||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) | ||
throws ServletException, IOException { | ||
try { | ||
String token = getAccessTokenFromRequest(request); | ||
|
||
validateToken(token); | ||
setUserIntoContext(token, request); | ||
} catch (RuntimeException e) { | ||
log.debug(e.getMessage()); | ||
} finally { | ||
filterChain.doFilter(request, response); | ||
} | ||
String token = getAccessTokenFromRequest(request); | ||
|
||
validateToken(token); | ||
|
||
setUserIntoContext(token, request); | ||
filterChain.doFilter(request, response); | ||
} | ||
|
||
private String getAccessTokenFromRequest(HttpServletRequest request) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,14 @@ | |
import org.springframework.data.domain.Slice; | ||
|
||
public record CursorBasePaginatedResponse<T>( | ||
@Schema(description = "다음 페이지를 요청하기 위한 커서 값") boolean hasNext, | ||
@Schema(description = "다음 페이지를 요청하기 위한 커서 값") Long nextCursor, | ||
@Schema(description = "다음 페이지 존재 여부") boolean hasNext, | ||
@Schema(description = "요청한 데이터") List<T> data | ||
) { | ||
|
||
public static <T> CursorBasePaginatedResponse<T> of(Slice<T> slice) { | ||
public static <T extends CursorResponse> CursorBasePaginatedResponse<T> of(Slice<T> slice) { | ||
return new CursorBasePaginatedResponse<>( | ||
slice.getContent().isEmpty() ? null : slice.getContent().getLast().getId(), | ||
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
slice.hasNext(), | ||
slice.getContent() | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package com.projectlyrics.server.domain.common.util; | ||
|
||
import com.projectlyrics.server.domain.artist.entity.QArtist; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
|
||
import java.util.List; | ||
|
||
import com.querydsl.core.types.dsl.NumberPath; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
public class QueryDslUtils { | ||
|
||
public static BooleanExpression goeCursorId(Long cursor) { | ||
return cursor == null ? null : QArtist.artist.id.goe(cursor); | ||
public static BooleanExpression gtCursorId(Long cursor, NumberPath<Long> id) { | ||
return cursor == null ? null : id.gt(cursor); | ||
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 혹시 goe에서 gt로 가게 되면서 버그가 날 수 있는 부분은 없을까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cursor값이 어떻게 들어오냐에 따라 달라질 수 있을 것 같네요 |
||
} | ||
|
||
public static <T> boolean checkIfHasNext(Pageable pageable, List<T> content) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분과 DTO 쪽 읽고 알게 된 건데, 아티스트 이미지가 없는 경우도 허용되는 걸까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미지같은 경우는 데이터를 어떤 식으로 저장하게 될지 모르기도 하고 추후에 애플리케이션이 좀 성숙해졌을 때 결정할 일인 것 같아서 우선 null 값이 들어가도 되도록 구현해놨습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 이해했습니다 감사합니다!!