-
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
Refactor#99 멤버 조회 방식 변경 및 추가 #99
Changes from all commits
aae7f5c
b5c5d24
fc328a4
d73d118
7df8bdc
dead581
80edf05
68f4e98
c2f06c2
d2d0dac
b1c45ee
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,7 @@ | ||
package leets.weeth.domain.user.application.exception; | ||
|
||
import leets.weeth.global.common.exception.BusinessLogicException; | ||
|
||
public class InvalidUserOrderException extends BusinessLogicException { | ||
public InvalidUserOrderException() {super(400, "올바른 유저 조회 순서가 아닙니다.");} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package leets.weeth.domain.user.application.exception; | ||
|
||
import leets.weeth.global.common.exception.BusinessLogicException; | ||
|
||
public class StatusNotFoundException extends BusinessLogicException { | ||
public StatusNotFoundException() { | ||
super(400, "존재하지 않는 status 입니다."); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package leets.weeth.domain.user.domain.entity.enums; | ||
|
||
import leets.weeth.domain.user.application.exception.StatusNotFoundException; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum StatusPriority { | ||
ACTIVE(1), | ||
WAITING(2), | ||
LEFT(3), | ||
BANNED(4); | ||
|
||
private final int priority; | ||
|
||
StatusPriority(int priority) { | ||
this.priority = priority; | ||
} | ||
|
||
public static StatusPriority fromStatus(Status status) { | ||
if (status == null) { | ||
throw new StatusNotFoundException(); | ||
} | ||
return StatusPriority.valueOf(status.name()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package leets.weeth.domain.user.domain.entity.enums; | ||
|
||
public enum UsersOrderBy { | ||
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. 음.. enum을 소문자로 관리하기도 좀 그렇긴 한데.. 그냥 대문자로 두는게 나을 수도 잇겟네요 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. orderBy로 받고있습니다! |
||
NAME_ASCENDING, // 이름순 정렬 | ||
CARDINAL_DESCENDING; // 기수 기준으로 내림차순 정렬 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ public interface UserRepository extends JpaRepository<User, Long> { | |
boolean existsByTelAndIdIsNot(String tel, Long id); | ||
|
||
List<User> findAllByStatusOrderByName(Status status); | ||
List<User> findAllByOrderByNameAsc(); | ||
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. 해당 부분이 현재는 단순히 이름으로 정렬된 모든 유저를 반환해주는 로직으로 이해해서 문제는 없을거같은데, |
||
|
||
@Query(value = "SELECT * FROM users u WHERE JSON_CONTAINS(u.cardinals, CAST(:cardinal AS JSON), '$')", nativeQuery = true) | ||
List<User> findByCardinal(@Param("cardinal") int cardinal); | ||
|
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.
개행 한 줄 부탁드릴게요!