Skip to content

Commit

Permalink
Merge pull request #35 from umc-5th-hackathon-team-I/feature/#27
Browse files Browse the repository at this point in the history
Feature/#27
  • Loading branch information
2hy2on authored Jan 2, 2024
2 parents 48b08ad + aa42baf commit ca57428
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import com.teami.domain.member.service.MemberService;
import com.teami.global.apiPayload.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down Expand Up @@ -40,22 +45,36 @@ public ApiResponse<MemberIdResponse> login(@RequestBody LoginRequest loginReques
}


@Operation(summary = "방명록 생성 API")
@Operation(summary = "방명록 생성 API",description = "사용자가 작성한 리뷰의 목록을 조회하는 API이며, 페이징을 포함합니다. query String 으로 page 번호를 주세요")
@PostMapping("/visitorComment")
@Parameters({
@Parameter(name = "ownerId", description = "방문 당하는 사용자의 id입니다"),
@Parameter(name = "writerId", description = "편지 작성자 아이디 입니다. String(login_id아님)"),
})

public ApiResponse<Boolean> addVisitorComment(@RequestBody VisitorCommentReq visitorCommentReq){
memberService.addVisitorComment(visitorCommentReq);
return ApiResponse.onSuccess(null);
}

@Operation(summary = "방명록 리스트 조회 API")

@Operation(summary = "방명록 리스트 조회 API",description = "사용자가 받은 편지의 목록을 조회하는 API이다")
@GetMapping("/visitorComment")
@Parameters({
@Parameter(name = "memberId", description = "사용자 아이디 입니다."),
})
public ApiResponse<List<VisitorCommentRes>> getVisitCommentList(@RequestParam Long memberId){
List<VisitorCommentRes> commentList = memberService.getVisitCommentList(memberId);
return ApiResponse.onSuccess(commentList);
}

@Operation(summary = "방명록 상세 조회 API")
@Operation(summary = "방명록 상세 조회 API",description = "사용자가 받은 편지 상세 조회하는 API이다")
@GetMapping("/visitorCommentDetail")
@Parameters({
@Parameter(name = "memberId", description = "사용자 아이디 입니다."),
@Parameter(name = "calendarVisitorId", description = "편지 id입니다. 리스트로 보여줄 때 편지 id를 같이 전달 되게 했으니 클릭시 아이디를 넘겨주면 됩니다.")

})
public ApiResponse<VisitorCommentRes> getVisitComment(@RequestParam Long memberId, @RequestParam Long calendarVisitorId){
VisitorCommentRes comment = memberService.getVisitComment(memberId,calendarVisitorId);
return ApiResponse.onSuccess(comment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ public VisitorCommentRes(CalendarVisitor c){
this.isChecked = c.isChecked();

}
public VisitorCommentRes(CalendarVisitor c, boolean isChecked){
this.id = c.getId();
this.ownerId = c.getOwner().getId();
this.writerId = c.getWriter().getId();
this.content = c.getContent();
this.writerNickname = c.getWriter().getNickname();
this.isChecked = isChecked;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public VisitorCommentRes getVisitComment(Long memberId, Long calendarVisitorId)
if(v.isEmpty()){
throw new ExceptionHandler(ErrorStatus.VISITOR_NOT_FOUND);
}
VisitorCommentRes res = new VisitorCommentRes(v.get());

VisitorCommentRes res = new VisitorCommentRes(v.get(), true);

return res;
}
Expand Down

0 comments on commit ca57428

Please sign in to comment.