-
Notifications
You must be signed in to change notification settings - Fork 1
[release] 진행 상황을 main으로 머지 #168
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
Changes from 17 commits
ac36f55
d022f97
e6ce328
1073d2f
06d3484
6759d72
a2a98e2
0d51d0a
d897d30
d8dc03c
bf997fc
ce61e36
b44069f
47b3255
3faefa3
67a5faa
cba4d8e
8503d61
3e37fa9
6bcd32b
a9b7c9a
aec33b8
c288b5b
2fbb794
9700c53
823d51b
4798b27
e11cbca
fc63e8f
697aaa5
15b9363
f725de5
b1df4ea
76198c7
89b5995
fa9f0f8
3fe1ea9
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.wayble.server.auth.exception; | ||
|
|
||
| import com.wayble.server.common.exception.ErrorCase; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum AuthErrorCase implements ErrorCase { | ||
| UNAUTHORIZED(401, 1001, "인증 정보가 없거나 userId를 추출할 수 없습니다."); | ||
|
|
||
| private final Integer httpStatusCode; | ||
| private final Integer errorCode; | ||
| private final String message; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,65 @@ | ||
| package com.wayble.server.auth.resolver; | ||
|
|
||
| import com.wayble.server.auth.exception.AuthErrorCase; | ||
| import com.wayble.server.common.config.security.jwt.JwtTokenProvider; | ||
| import com.wayble.server.common.exception.ApplicationException; | ||
| import jakarta.servlet.http.HttpServletRequest; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.core.MethodParameter; | ||
| import org.springframework.security.core.Authentication; | ||
| import org.springframework.security.core.context.SecurityContextHolder; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.util.StringUtils; | ||
| import org.springframework.web.bind.support.WebDataBinderFactory; | ||
| import org.springframework.web.context.request.NativeWebRequest; | ||
| import org.springframework.web.method.support.HandlerMethodArgumentResolver; | ||
| import org.springframework.web.method.support.ModelAndViewContainer; | ||
|
|
||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class CurrentUserArgumentResolver implements HandlerMethodArgumentResolver { | ||
|
|
||
| private final JwtTokenProvider jwtTokenProvider; | ||
|
|
||
| @Override | ||
| public boolean supportsParameter(MethodParameter parameter) { | ||
| return parameter.hasParameterAnnotation(CurrentUser.class) | ||
| && Long.class.equals(parameter.getParameterType()); | ||
| } | ||
|
|
||
| @Override | ||
| public Object resolveArgument(MethodParameter parameter, | ||
| ModelAndViewContainer mav, | ||
| NativeWebRequest webRequest, | ||
| WebDataBinderFactory binderFactory) { | ||
| public Object resolveArgument( | ||
| MethodParameter parameter, | ||
| ModelAndViewContainer mav, | ||
| NativeWebRequest webRequest, | ||
| WebDataBinderFactory binderFactory | ||
| ) { | ||
| Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | ||
| if (auth == null) { | ||
| throw new IllegalStateException("인증 정보가 없습니다."); | ||
| if (auth != null) { | ||
| Object principal = auth.getPrincipal(); | ||
| if (principal instanceof Long l) { return l; } | ||
| if (principal instanceof Integer i) { return i.longValue(); } | ||
| if (principal instanceof String s && s.chars().allMatch(Character::isDigit)) { | ||
| return Long.parseLong(s); | ||
| } | ||
| String name = auth.getName(); | ||
| if (name != null && name.chars().allMatch(Character::isDigit)) { | ||
| return Long.parseLong(name); | ||
| } | ||
| } | ||
|
|
||
| Object principal = auth.getPrincipal(); | ||
| if (principal instanceof Long l) return l; | ||
| if (principal instanceof Integer i) return i.longValue(); | ||
| if (principal instanceof String s) { | ||
| HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class); | ||
| String authz = request != null ? request.getHeader("Authorization") : null; | ||
| if (StringUtils.hasText(authz) && authz.startsWith("Bearer ")) { | ||
| String token = authz.substring(7); | ||
| try { | ||
| return Long.parseLong(s); | ||
| } catch (NumberFormatException ignored) {} | ||
| } | ||
| try { | ||
| return Long.parseLong(auth.getName()); | ||
| } catch (Exception e) { | ||
| throw new IllegalStateException("userId를 추출할 수 없습니다.", e); | ||
| Long userId = jwtTokenProvider.getUserId(token); | ||
| if (userId != null) { return userId; } | ||
| } catch (IllegalArgumentException e) { | ||
| throw new ApplicationException(AuthErrorCase.UNAUTHORIZED); | ||
| } | ||
| } | ||
|
|
||
| throw new ApplicationException(AuthErrorCase.UNAUTHORIZED); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,8 @@ public class Elevator { | |
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(name = "latitude", columnDefinition = "DECIMAL(10,7)", nullable = false) | ||
| private Double latitude; | ||
|
|
||
| @Column(name = "longitude", columnDefinition = "DECIMAL(10,7)", nullable = false) | ||
| private Double longitude; | ||
| @Column(name = "location", nullable = false) | ||
| private String location; | ||
|
Comment on lines
+17
to
+18
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. 💡 Verification agent 🧩 Analysis chain위치 스키마 변경(DB 마이그레이션/레거시 사용처 점검 필요) latitude/longitude → location 문자열 변경에 따라:
확인을 위해 아래 스크립트로 레거시 사용처와 마이그레이션 흔적을 점검해 주세요. 결과 공유해 주시면 후속 지원하겠습니다. 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Searching for legacy Elevator latitude/longitude usages in Java code..."
rg -nP --type=java -C2 '\.getLatitude\s*\(|\.getLongitude\s*\(' || true
rg -nP --type=java -C2 '\bElevator\b.*(latitude|longitude)' || true
rg -nP --type=java -C2 '(latitude|longitude).*Elevator' || true
echo
echo "Searching for DB migration files mentioning elevator latitude/longitude..."
fd -a -t f -i '.*(migration|migrations|flyway|liquibase|changelog).*' || true
rg -nP -C2 '(?i)elevator.*(latitude|longitude|location)' || trueLength of output: 22107 DB 스키마 변경(엘리베이터 location 전환) 마이그레이션 및 레거시 호출 점검 필요 아래 사항을 반드시 반영/확인해주세요:
위 작업 완료 후 결과(스크립트·검증 로그)를 공유해주시면 최종 승인 및 후속 지원을 진행하겠습니다. 🤖 Prompt for AI Agents |
||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "facility_id", nullable = false) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.wayble.server.direction.repository; | ||
|
|
||
| import com.wayble.server.direction.entity.transportation.Elevator; | ||
| import com.wayble.server.direction.entity.transportation.Facility; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Query; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface ElevatorRepository extends JpaRepository<Elevator, Long> { | ||
| @Query("SELECT e FROM Elevator e WHERE e.facility = :facility") | ||
| List<Elevator> findByFacility(@Param("facility") Facility facility); | ||
| } | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.