-
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 #125 from jisung-in/feature/124-get-talk-rooms-ret…
…urn-slice [Refactor] 토크룸 목록 조회 API Slice로 리턴하도록 수정
- Loading branch information
Showing
16 changed files
with
290 additions
and
283 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
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/jisungin/application/talkroom/request/TalkRoomSearchCondition.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,28 @@ | ||
package com.jisungin.application.talkroom.request; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class TalkRoomSearchCondition { | ||
|
||
private String search; | ||
private String day; | ||
|
||
@Builder | ||
private TalkRoomSearchCondition(String search, String day) { | ||
this.search = search; | ||
this.day = day; | ||
} | ||
|
||
public static TalkRoomSearchCondition of(String search, String day) { | ||
return TalkRoomSearchCondition.builder() | ||
.search(search) | ||
.day(day) | ||
.build(); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/jisungin/application/talkroom/request/UserTalkRoomSearchCondition.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,31 @@ | ||
package com.jisungin.application.talkroom.request; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class UserTalkRoomSearchCondition { | ||
|
||
private boolean userTalkRoomFilter; | ||
private boolean commentedFilter; | ||
private boolean likedFilter; | ||
|
||
@Builder | ||
private UserTalkRoomSearchCondition(boolean userTalkRoomFilter, boolean commentedFilter, boolean likedFilter) { | ||
this.userTalkRoomFilter = userTalkRoomFilter; | ||
this.commentedFilter = commentedFilter; | ||
this.likedFilter = likedFilter; | ||
} | ||
|
||
public static UserTalkRoomSearchCondition of(boolean userTalkRoomFilter, boolean commentedFilter, boolean likedFilter) { | ||
return UserTalkRoomSearchCondition.builder() | ||
.userTalkRoomFilter(userTalkRoomFilter) | ||
.commentedFilter(commentedFilter) | ||
.likedFilter(likedFilter) | ||
.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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/jisungin/domain/talkroom/repository/TalkRoomOrderType.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,33 @@ | ||
package com.jisungin.domain.talkroom.repository; | ||
|
||
import static com.jisungin.domain.talkroom.QTalkRoom.talkRoom; | ||
import static com.jisungin.domain.talkroomlike.QTalkRoomLike.talkRoomLike; | ||
|
||
import com.querydsl.core.types.OrderSpecifier; | ||
import java.util.function.Supplier; | ||
|
||
public enum TalkRoomOrderType { | ||
|
||
DEFAULT(() -> OrderByNull.DEFAULT), | ||
RECENT(talkRoom.createDateTime::desc), | ||
RECOMMEND(() -> talkRoomLike.count().desc()); | ||
|
||
private final Supplier<OrderSpecifier<?>> orderSpecifierSupplier; | ||
|
||
TalkRoomOrderType(Supplier<OrderSpecifier<?>> orderSpecifierSupplier) { | ||
this.orderSpecifierSupplier = orderSpecifierSupplier; | ||
} | ||
|
||
public static OrderSpecifier<?> getOrderSpecifierByName(String name) { | ||
try { | ||
return TalkRoomOrderType.valueOf(name.toUpperCase()).getOrderSpecifier(); | ||
} catch (IllegalArgumentException | NullPointerException e) { | ||
return TalkRoomOrderType.DEFAULT.getOrderSpecifier(); | ||
} | ||
} | ||
|
||
private OrderSpecifier<?> getOrderSpecifier() { | ||
return orderSpecifierSupplier.get(); | ||
} | ||
|
||
} |
Oops, something went wrong.