-
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 #45 from Domitory-CheckMate/feature/42-member
[feat] 회원탈퇴 기능
- Loading branch information
Showing
11 changed files
with
111 additions
and
22 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
11 changes: 11 additions & 0 deletions
11
src/main/java/org/gachon/checkmate/domain/chat/repository/ChatRoomCustomRepository.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,11 @@ | ||
package org.gachon.checkmate.domain.chat.repository; | ||
|
||
import org.gachon.checkmate.domain.chat.entity.ChatRoom; | ||
import org.gachon.checkmate.domain.member.entity.User; | ||
|
||
import java.util.List; | ||
|
||
public interface ChatRoomCustomRepository { | ||
|
||
List<ChatRoom> findUserAllChatRoom(Long userId); | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/org/gachon/checkmate/domain/chat/repository/ChatRoomCustomRepositoryImpl.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,40 @@ | ||
package org.gachon.checkmate.domain.chat.repository; | ||
|
||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import lombok.RequiredArgsConstructor; | ||
import org.gachon.checkmate.domain.chat.entity.ChatRoom; | ||
import org.gachon.checkmate.domain.member.entity.User; | ||
import org.gachon.checkmate.domain.member.entity.UserState; | ||
|
||
import java.util.List; | ||
|
||
import static org.gachon.checkmate.domain.chat.entity.QChatRoom.chatRoom; | ||
|
||
@RequiredArgsConstructor | ||
public class ChatRoomCustomRepositoryImpl implements ChatRoomCustomRepository { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<ChatRoom> findUserAllChatRoom(Long userId) { | ||
return queryFactory | ||
.selectFrom(chatRoom) | ||
.where( | ||
userEnterChatRoom(userId), | ||
validateUsersState() | ||
) | ||
.fetch(); | ||
} | ||
|
||
private BooleanExpression userEnterChatRoom(Long userId) { | ||
return chatRoom.firstUser.id.eq(userId) | ||
.or(chatRoom.secondUser.id.eq(userId)); | ||
} | ||
|
||
private BooleanExpression validateUsersState() { | ||
return chatRoom.firstUser.userState.eq(UserState.JOIN) | ||
.and(chatRoom.secondUser.userState.eq(UserState.JOIN)); | ||
} | ||
|
||
} |
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
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