-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 리뷰 등록시 회원 매너 온도 반영 기능 추가 및 리뷰 등록 리팩토링 (#158) * refactor: 회원 리뷰 등록 API 리팩토링 (#157) * feat: 회원 리뷰 등록시, 온도 반영 및 리뷰 피드백 반영 (#157) * feat: User 엔티티 메소드 추가 (#157) * feat: Review enum 필드 추가 (#157) * test: 리뷰 등록시 온도 업데이트에 대한 단위 테스트 (#157) * test: 리뷰 등록 기능 통합 테스트 (#157) * refactor: 회원 리뷰 등록 메소드 수정 (#157) * test: 불필요한 테스트 제거 및 CI 오류 수정 (#157) * test: MeetingRepository 테스트에서 시간과 id비교 비활서화 * refactor: 회원 탈퇴 URI 변경 (#162) * refactor: 회원 탈퇴 URI 수정 (#161) * test: 회원 탈퇴 URI 수정에 대한 테스트 수정 (#161) * fix: CI 에러 수정 (#161) * fix: 필드 값 비교를 위해 deprecated 된 메소드을 대체 (#161) * fix: 필드 값 비교를 위해 deprecated 된 메소드을 대체 (#161) * feat: fcm token 업데이트 api 추가 (#166) * fix: user_alert ddl의 pk에 auto_increment를 추가한다 * feat: token 업데이트 api를 추가한다 --------- Co-authored-by: ChoiDongKuen <[email protected]>
- Loading branch information
1 parent
bbb5e73
commit c334ced
Showing
8 changed files
with
107 additions
and
4 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
10 changes: 10 additions & 0 deletions
10
src/main/java/net/teumteum/alert/domain/AlertRepository.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,12 +1,22 @@ | ||
package net.teumteum.alert.domain; | ||
|
||
import jakarta.persistence.LockModeType; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Lock; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface AlertRepository extends JpaRepository<UserAlert, Long> { | ||
|
||
@Query("select u from user_alert as u where u.userId in :userIds") | ||
List<UserAlert> findAllByUserId(@Param("userIds") Iterable<Long> userIds); | ||
|
||
@Lock(LockModeType.PESSIMISTIC_WRITE) | ||
@Query("select u from user_alert as u where u.userId = :userId") | ||
Optional<UserAlert> findByUserIdWithLock(@Param("userId") Long userId); | ||
|
||
Optional<UserAlert> findByUserId(@Param("userId") Long userId); | ||
|
||
} |
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
10 changes: 10 additions & 0 deletions
10
src/main/java/net/teumteum/alert/domain/request/UpdateAlertTokenRequest.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,10 @@ | ||
package net.teumteum.alert.domain.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record UpdateAlertTokenRequest( | ||
@NotNull | ||
String token | ||
) { | ||
|
||
} |
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
46 changes: 46 additions & 0 deletions
46
src/test/java/net/teumteum/alert/domain/AlertRepositoryTest.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,46 @@ | ||
package net.teumteum.alert.domain; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@DataJpaTest | ||
@ExtendWith(SpringExtension.class) | ||
@DisplayName("AlertRepository 클래스의") | ||
class AlertRepositoryTest { | ||
|
||
@Autowired | ||
private AlertRepository alertRepository; | ||
|
||
@Autowired | ||
private EntityManager entityManager; | ||
|
||
@Nested | ||
@DisplayName("findByUserIdWithLock 메소드는") | ||
class findByUserIdWithLock_method { | ||
|
||
@Test | ||
@DisplayName("userId로 userAlert를 조회한다.") | ||
void find_userAlert_by_userId() { | ||
// given | ||
var userId = 1L; | ||
var userAlert = new UserAlert(1L, userId, "token"); | ||
|
||
alertRepository.saveAndFlush(userAlert); | ||
entityManager.clear(); | ||
|
||
// when | ||
var result = alertRepository.findByUserIdWithLock(userId); | ||
|
||
// then | ||
Assertions.assertThat(result).isPresent(); | ||
} | ||
} | ||
|
||
} |
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