-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: 액션으로 이름 변경 * feat: 아이디로 조회 위한 조회 기능 구현 * feat: 사용자의 알림 조회 기능 구현 * feat: 기능 경로 매핑 및 명세 * fix: createAt 검사에서 제외 * refactor: 피드백 반영 * [BE] 검색 기능 구현(#728) (#732) * feat: Room Specification 작성 * feat: 검색 로직 구현 * feat: 컨트롤러 및 명세 작성 * docs: 명세 수정 --------- Co-authored-by: ashsty <[email protected]> * fix: 변수명 수정 & 빈 값으로 검색 시 default 값 추가 (#737) Co-authored-by: ashsty <[email protected]> * feat: 알람 확인 기능 구현 * feat: 기능 경로 매핑 및 명세 * fix: 충돌 해결 --------- Co-authored-by: youngsu5582 <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: ashsty <[email protected]>
- Loading branch information
1 parent
2379a2f
commit fb8e540
Showing
12 changed files
with
186 additions
and
9 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
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
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/corea/alarm/dto/AlarmCheckRequest.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,12 @@ | ||
package corea.alarm.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "알림 체크 요청") | ||
public record AlarmCheckRequest( | ||
@Schema(description = "액션 아이디", example = "4") | ||
long actionId, | ||
|
||
@Schema(description = "알림 타입", example = "USER") | ||
String alarmType) { | ||
} |
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
66 changes: 66 additions & 0 deletions
66
backend/src/test/java/corea/alarm/controller/AlarmControllerTest.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,66 @@ | ||
package corea.alarm.controller; | ||
|
||
import config.ControllerTest; | ||
import corea.alarm.domain.UserToUserAlarm; | ||
import corea.alarm.domain.UserToUserAlarmRepository; | ||
import corea.alarm.dto.AlarmCheckRequest; | ||
import corea.auth.service.TokenService; | ||
import corea.fixture.AlarmFixture; | ||
import corea.fixture.MemberFixture; | ||
import corea.fixture.RoomFixture; | ||
import corea.member.domain.Member; | ||
import corea.member.repository.MemberRepository; | ||
import corea.room.domain.Room; | ||
import corea.room.repository.RoomRepository; | ||
import io.restassured.RestAssured; | ||
import io.restassured.http.ContentType; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@ControllerTest | ||
class AlarmControllerTest { | ||
@Autowired | ||
private UserToUserAlarmRepository userToUserAlarmRepository; | ||
|
||
@Autowired | ||
private MemberRepository memberRepository; | ||
|
||
@Autowired | ||
private TokenService tokenService; | ||
|
||
private Member actor; | ||
private Member receiver; | ||
private Room interaction; | ||
private long interactionId; | ||
|
||
@Autowired | ||
private RoomRepository roomRepository; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
this.actor = memberRepository.save(MemberFixture.MEMBER_MOVIN()); | ||
this.receiver = memberRepository.save(MemberFixture.MEMBER_PORORO()); | ||
this.interaction = roomRepository.save(RoomFixture.ROOM_DOMAIN(memberRepository.save(MemberFixture.MEMBER_ROOM_MANAGER_JOYSON()))); | ||
interactionId = interaction.getId(); | ||
} | ||
|
||
@Test | ||
@DisplayName("알림을 체크하면 읽은 상태가 된다.") | ||
void alarm_check() { | ||
UserToUserAlarm alarm = userToUserAlarmRepository.save(AlarmFixture.REVIEW_COMPLETE(actor.getId(), receiver.getId(), interactionId)); | ||
//@formatter:off | ||
RestAssured.given().auth().oauth2(tokenService.createAccessToken(receiver)) | ||
.body(new AlarmCheckRequest(alarm.getId(),"USER")).contentType(ContentType.JSON) | ||
.when().post("/alarm/check") | ||
.then().assertThat().statusCode(200); | ||
//@formatter:on | ||
|
||
alarm = userToUserAlarmRepository.findById(alarm.getId()) | ||
.get(); | ||
assertThat(alarm.isRead()).isTrue(); | ||
} | ||
} |
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