-
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.
러너가 서포터 목록에서 서포터를 선택하는 API 구현 (#346)
* feat: 지원한 서포터를 선택하는 API 구현 * test: RunnerPostService 테스트 추가 * refactor: 파라미터 명 수정 * test: SupporterRunnerPostRepositoryReadTest 추가 * refactor: 잘못된 redirect uri 변경 * test: Restdocs 테스트 추가 * test: isNotOwner 테스트 추가 * style: startReview 메서드 줄 변경 * refactor: Objects.equals 대신 도메인 로직을 사용하도록 변경 * refactor: 메서드 이름 변경 * refactor: 병합 출돌 해결 * refactor: 필요없는 메서드 삭제 * docs: index.adoc에 서포터 선택 API 추가 및 depth 조절 * refactor: 사용하지 않는 메서드 제거 * test: 컨벤션 맞게 반영 * test: DeadlineFixture 로 변경 * refactor: 예외 메세지 이름 변경 * refactor: private 메서드 병합 * test: notSavedId given 절로 변경 * refactor: hasMessage 제거 및 DTO 이름 변경
- Loading branch information
Showing
17 changed files
with
464 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ifndef::snippets[] | ||
:snippets: ../../../build/generated-snippets | ||
endif::[] | ||
:doctype: book | ||
:icons: font | ||
:source-highlighter: highlight.js | ||
:toc: left | ||
:toclevels: 3 | ||
:sectlinks: | ||
:operation-http-request-title: Example Request | ||
:operation-http-response-title: Example Response | ||
|
||
=== *러너 게시글 수정* | ||
|
||
==== *리뷰할 서포터 선택 API* | ||
|
||
===== *Http Request* | ||
include::{snippets}/../../build/generated-snippets/runner-post-update-api-test/update-runner-post-supporter/http-request.adoc[] | ||
|
||
===== *Http Request Header* | ||
include::{snippets}/../../build/generated-snippets/runner-post-update-api-test/update-runner-post-supporter/request-headers.adoc[] | ||
|
||
===== *Http Response* | ||
include::{snippets}/../../build/generated-snippets/runner-post-update-api-test/update-runner-post-supporter/http-response.adoc[] |
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
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
55 changes: 55 additions & 0 deletions
55
backend/baton/src/test/java/touch/baton/assure/runnerpost/RunnerPostAssuredUpdateTest.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,55 @@ | ||
package touch.baton.assure.runnerpost; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.http.HttpStatus; | ||
import touch.baton.assure.common.HttpStatusAndLocationHeader; | ||
import touch.baton.config.AssuredTestConfig; | ||
import touch.baton.domain.member.Member; | ||
import touch.baton.domain.runner.Runner; | ||
import touch.baton.domain.runnerpost.RunnerPost; | ||
import touch.baton.domain.runnerpost.service.dto.RunnerPostUpdateRequest; | ||
import touch.baton.domain.supporter.Supporter; | ||
import touch.baton.fixture.domain.MemberFixture; | ||
import touch.baton.fixture.domain.RunnerFixture; | ||
import touch.baton.fixture.domain.RunnerPostFixture; | ||
import touch.baton.fixture.domain.SupporterFixture; | ||
import touch.baton.fixture.domain.SupporterRunnerPostFixture; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import static touch.baton.fixture.vo.DeadlineFixture.deadline; | ||
|
||
@SuppressWarnings("NonAsciiCharacters") | ||
public class RunnerPostAssuredUpdateTest extends AssuredTestConfig { | ||
|
||
@Test | ||
void 러너가_서포터_목록에서_서포터를_선택할_수_있다() { | ||
// given | ||
final String 디투_소셜_아이디 = "hongSile"; | ||
final Member 사용자_디투 = memberRepository.save(MemberFixture.createWithSocialId(디투_소셜_아이디)); | ||
final Runner 러너_디투 = runnerRepository.save(RunnerFixture.createRunner(사용자_디투)); | ||
final String 디투_토큰 = login(디투_소셜_아이디); | ||
|
||
final RunnerPost 디투_게시글 = runnerPostRepository.save(RunnerPostFixture.create(러너_디투, deadline(LocalDateTime.now().plusDays(10)))); | ||
|
||
final Member 사용자_에단 = memberRepository.save(MemberFixture.createEthan()); | ||
final Supporter 서포터_에단 = supporterRepository.save(SupporterFixture.create(사용자_에단)); | ||
|
||
서포터가_리뷰_게시글에_리뷰_제안을_한다(디투_게시글, 서포터_에단); | ||
|
||
final RunnerPostUpdateRequest.SelectSupporter 서포터_선택_요청_정보 = new RunnerPostUpdateRequest.SelectSupporter(서포터_에단.getId()); | ||
|
||
// when, then | ||
RunnerPostAssuredSupport | ||
.클라이언트_요청() | ||
.토큰으로_로그인한다(디투_토큰) | ||
.러너가_서포터를_선택한다(디투_게시글.getId(), 서포터_선택_요청_정보) | ||
|
||
.서버_응답() | ||
.러너_게시글에_서포터가_성공적으로_선택되었는지_확인한다(new HttpStatusAndLocationHeader(HttpStatus.NO_CONTENT, "/api/v1/posts/runner")); | ||
} | ||
|
||
private void 서포터가_리뷰_게시글에_리뷰_제안을_한다(final RunnerPost 지원할_게시글, final Supporter 지원한_서포터) { | ||
supporterRunnerPostRepository.save(SupporterRunnerPostFixture.create(지원할_게시글, 지원한_서포터)); | ||
} | ||
} |
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
Oops, something went wrong.