Search in sources :

Example 1 with ReportResponse

use of wooteco.prolog.report.application.dto.ReportResponse in project prolog by woowacourse.

the class ReportStepDefinitions method 리포트가조회된다.

@Then("리포트가 조회된다")
public void 리포트가조회된다() {
    ReportResponse reportResponse = context.response.as(ReportResponse.class);
    assertThat(reportResponse.getId()).isNotNull();
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.ReportResponse) Then(io.cucumber.java.en.Then)

Example 2 with ReportResponse

use of wooteco.prolog.report.application.dto.ReportResponse in project prolog by woowacourse.

the class ReportStepDefinitions method 리포트를수정하면.

@When("리포트를 수정하면")
public void 리포트를수정하면() {
    ReportResponse report = (ReportResponse) context.storage.get("report");
    ReportUpdateRequest reportUpdateRequest = new ReportUpdateRequest("변경된 리포트", "변경된 리포트 설명1");
    context.storage.put("reportRequest", reportUpdateRequest);
    context.invokeHttpPutWithToken("/reports/" + report.getId(), reportUpdateRequest);
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.ReportResponse) ReportUpdateRequest(wooteco.prolog.report.application.dto.ReportUpdateRequest) When(io.cucumber.java.en.When)

Example 3 with ReportResponse

use of wooteco.prolog.report.application.dto.ReportResponse in project prolog by woowacourse.

the class ReportStepDefinitions method 리포트목록에서제거된다.

@Then("리포트 목록에서 제거된다")
public void 리포트목록에서제거된다() {
    String username = (String) context.storage.get("username");
    context.invokeHttpGetWithToken("/members/" + username + "/reports");
    assertThat(context.response.statusCode()).isEqualTo(HttpStatus.OK.value());
    ReportResponse report = (ReportResponse) context.storage.get("report");
    List<Long> reportIds = context.response.jsonPath().getList("id");
    assertThat(reportIds).isNull();
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.ReportResponse) Then(io.cucumber.java.en.Then)

Example 4 with ReportResponse

use of wooteco.prolog.report.application.dto.ReportResponse in project prolog by woowacourse.

the class ReportStepDefinitions method 리포트를삭제하면.

@When("리포트를 삭제하면")
public void 리포트를삭제하면() {
    ReportResponse report = (ReportResponse) context.storage.get("report");
    context.invokeHttpDeleteWithToken("/reports/" + report.getId());
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.ReportResponse) When(io.cucumber.java.en.When)

Example 5 with ReportResponse

use of wooteco.prolog.report.application.dto.ReportResponse in project prolog by woowacourse.

the class ReportService method findReportsByUsername.

public PageableResponse<ReportResponse> findReportsByUsername(String username, Pageable pageable) {
    Member member = memberService.findByUsername(username);
    Page<Report> reports = reportRepository.findByMemberId(member.getId(), pageable);
    List<ReportResponse> reportResponses = ReportResponse.listOf(reports);
    return PageableResponse.of(reportResponses, reports);
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.ReportResponse) Report(wooteco.prolog.report.domain.Report) LoginMember(wooteco.prolog.login.ui.LoginMember) Member(wooteco.prolog.member.domain.Member)

Aggregations

ReportResponse (wooteco.prolog.report.application.dto.ReportResponse)5 Then (io.cucumber.java.en.Then)2 When (io.cucumber.java.en.When)2 LoginMember (wooteco.prolog.login.ui.LoginMember)1 Member (wooteco.prolog.member.domain.Member)1 ReportUpdateRequest (wooteco.prolog.report.application.dto.ReportUpdateRequest)1 Report (wooteco.prolog.report.domain.Report)1