-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: DB에 인덱스를 적용한다 (#449) * feat: 엔티티에 index 적용 * build: flyway 세팅 적용 * fix: flyway sql문 오타 수정 * chore: flyway 버전 및 파일명 변경 * feat: 불필요한 이메일 인덱싱 제거 * fix: 작성한 메시지 개수를 해당페이지 개수로만 가져오는 버그 수정 (#474) * fix: 작성한 메시지 개수를 해당페이지 개수로만 가져오는 버그 수정 - 리팩터링 필요 (#477) * fix: 작성한 메시지 개수를 해당페이지 개수로만 가져오는 버그 수정 - 리팩터링 필요 (#478) * fix: 작성한 메시지 개수를 해당페이지 개수로만 가져오는 버그 수정 - 리팩터링 필요 * fix: 잘못된 querydsl JPQL로 임시로 변환 (#479) * refactor: requestApi 함수 수정 * feat: error page 수정 (#481) * fix: 멤버에게 롤링페이퍼 생성 페이지의 받는 사람 자동 완성 버그 수정 * fix: 오타 수정 Co-authored-by: TaeHyeon Kim <[email protected]> Co-authored-by: SunHo Park <[email protected]> Co-authored-by: seungpang <[email protected]> Co-authored-by: yxxnghwan <[email protected]> Co-authored-by: asebn1 <[email protected]>
- Loading branch information
1 parent
0fbb6cd
commit cba53c6
Showing
23 changed files
with
291 additions
and
303 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
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
21 changes: 21 additions & 0 deletions
21
backend/src/main/java/com/woowacourse/naepyeon/repository/message/MessageRepository.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 |
---|---|---|
@@ -1,8 +1,29 @@ | ||
package com.woowacourse.naepyeon.repository.message; | ||
|
||
import com.woowacourse.naepyeon.domain.Message; | ||
import com.woowacourse.naepyeon.service.dto.WrittenMessageResponseDto; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface MessageRepository extends JpaRepository<Message, Long>, MessageRepositoryCustom { | ||
|
||
@Query(value = "select distinct new com.woowacourse.naepyeon.service.dto.WrittenMessageResponseDto" | ||
+ "(m.id, r.id, r.title, t.id, t.name, m.content, m.color, " | ||
+ "case when r.recipient = com.woowacourse.naepyeon.domain.rollingpaper.Recipient.MEMBER then p.nickname " | ||
+ "when r.recipient = com.woowacourse.naepyeon.domain.rollingpaper.Recipient.TEAM then t.name " | ||
+ "else '' end) " | ||
+ "from Message m" | ||
+ ", Rollingpaper r" | ||
+ ", Team t" | ||
+ ", TeamParticipation p " | ||
+ "where m.rollingpaper.id = r.id " | ||
+ "and r.team.id = t.id " | ||
+ "and p.team.id = t.id " | ||
+ "and m.author.id = :authorId " | ||
+ "and (p.member.id = r.member.id or r.member.id is null)") | ||
Page<WrittenMessageResponseDto> findAllByAuthorId(@Param("authorId") final Long authorId, | ||
final Pageable pageRequest); | ||
} |
5 changes: 0 additions & 5 deletions
5
...nd/src/main/java/com/woowacourse/naepyeon/repository/message/MessageRepositoryCustom.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 |
---|---|---|
@@ -1,14 +1,9 @@ | ||
package com.woowacourse.naepyeon.repository.message; | ||
|
||
import com.woowacourse.naepyeon.domain.Message; | ||
import com.woowacourse.naepyeon.service.dto.WrittenMessageResponseDto; | ||
import java.util.List; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
public interface MessageRepositoryCustom { | ||
|
||
List<Message> findAllByRollingpaperId(final Long rollingpaperId); | ||
|
||
Page<WrittenMessageResponseDto> findAllByAuthorId(final Long authorId, final Pageable pageRequest); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE INDEX member_oauth_index ON member (platform, platform_id); | ||
|
||
CREATE INDEX message_rollingpaper_index ON message (rollingpaper_id); | ||
|
||
CREATE INDEX rollingpaper_team_index ON rollingpaper (team_id); | ||
|
||
CREATE INDEX team_participation_team_index ON team_participation (team_id); | ||
|
||
CREATE INDEX team_participation_member_index ON team_participation (member_id); |
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 |
---|---|---|
|
@@ -25,4 +25,4 @@ Configutation: | |
additivity: false | ||
level: info | ||
AppenderRef: | ||
- ref: Console_Appender | ||
- ref: Console_Appender |
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 |
---|---|---|
|
@@ -61,13 +61,21 @@ class MessageRepositoryTest { | |
"#123456", | ||
false | ||
); | ||
private final Team team2 = new Team( | ||
"nae-pyeon2", | ||
"테스트 모임입니다.", | ||
"testEmoji", | ||
"#123456", | ||
false | ||
); | ||
private final Member member = new Member("member", "[email protected]", Platform.KAKAO, "1"); | ||
private final Member author = new Member("author", "[email protected]", Platform.KAKAO, "2"); | ||
private final Rollingpaper rollingpaper = new Rollingpaper("AlexAndKei", Recipient.MEMBER, team, member); | ||
|
||
@BeforeEach | ||
void setUp() { | ||
teamRepository.save(team); | ||
teamRepository.save(team2); | ||
memberRepository.save(member); | ||
memberRepository.save(author); | ||
rollingpaperRepository.save(rollingpaper); | ||
|
@@ -114,6 +122,10 @@ void findAllByMemberIdAndPageRequest() { | |
teamParticipationRepository.save(teamParticipation1); | ||
final TeamParticipation teamParticipation2 = new TeamParticipation(team, author, "작성자"); | ||
teamParticipationRepository.save(teamParticipation2); | ||
final TeamParticipation teamParticipation3 = new TeamParticipation(team2, member, "멤버"); | ||
teamParticipationRepository.save(teamParticipation3); | ||
final TeamParticipation teamParticipation4 = new TeamParticipation(team2, author, "작성자"); | ||
teamParticipationRepository.save(teamParticipation4); | ||
|
||
final Message message1 = createMessage(); | ||
messageRepository.save(message1); | ||
|
@@ -125,18 +137,37 @@ void findAllByMemberIdAndPageRequest() { | |
messageRepository.save(message4); | ||
final Message message5 = createMessage(); | ||
messageRepository.save(message5); | ||
final Message message6 = createMessage(); | ||
messageRepository.save(message6); | ||
final Message message7 = createMessage(); | ||
messageRepository.save(message7); | ||
final Message message8 = createMessage(); | ||
messageRepository.save(message8); | ||
final Message message9 = createMessage(); | ||
messageRepository.save(message9); | ||
final Message message10 = createMessage(); | ||
messageRepository.save(message10); | ||
final Message message11 = createMessage(); | ||
messageRepository.save(message11); | ||
final Message message12 = createMessage(); | ||
messageRepository.save(message12); | ||
final List<WrittenMessageResponseDto> expected = List.of( | ||
WrittenMessageResponseDto.of(rollingpaper, team, "멤버", message3), | ||
WrittenMessageResponseDto.of(rollingpaper, team, "멤버", message4) | ||
WrittenMessageResponseDto.of(rollingpaper, team, "멤버", message6), | ||
WrittenMessageResponseDto.of(rollingpaper, team, "멤버", message7), | ||
WrittenMessageResponseDto.of(rollingpaper, team, "멤버", message8), | ||
WrittenMessageResponseDto.of(rollingpaper, team, "멤버", message9), | ||
WrittenMessageResponseDto.of(rollingpaper, team, "멤버", message10) | ||
); | ||
|
||
final Page<WrittenMessageResponseDto> writtenMessageResponseDtos = | ||
messageRepository.findAllByAuthorId(author.getId(), PageRequest.of(1, 2)); | ||
messageRepository.findAllByAuthorId(author.getId(), PageRequest.of(1, 5)); | ||
final List<WrittenMessageResponseDto> actual = writtenMessageResponseDtos.getContent(); | ||
|
||
assertThat(actual) | ||
.usingRecursiveComparison() | ||
.isEqualTo(expected); | ||
assertAll( | ||
() -> assertThat(writtenMessageResponseDtos.getTotalElements()).isEqualTo(12), | ||
() -> assertThat(actual) | ||
.usingRecursiveComparison() | ||
.isEqualTo(expected) | ||
); | ||
} | ||
|
||
@Test | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import { appClient, requestApi } from "@/api"; | ||
|
||
import { ApiOptions } from "@/types/api"; | ||
import { postGoogleOauthRequest } from "@/types/apiRequest"; | ||
|
||
const postGoogleOauth = async ( | ||
{ authorizationCode, redirectUri }: postGoogleOauthRequest, | ||
options?: ApiOptions | ||
) => | ||
requestApi( | ||
() => | ||
appClient.post("/oauth/google", { | ||
authorizationCode, | ||
redirectUri, | ||
}), | ||
options | ||
const postGoogleOauth = async ({ | ||
authorizationCode, | ||
redirectUri, | ||
}: postGoogleOauthRequest) => | ||
requestApi(() => | ||
appClient.post("/oauth/google", { | ||
authorizationCode, | ||
redirectUri, | ||
}) | ||
); | ||
|
||
export { postGoogleOauth }; |
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
Oops, something went wrong.