Skip to content

Commit

Permalink
feat: 댓글방 내 공모 일정 조회 기능 구현 (#58)
Browse files Browse the repository at this point in the history
* feat: 댓글방 내 공모 일정 조회 기능 구현

Co-authored-by: Dora Choo <choo000407@naver.com>

* refactor: 공모 일정 조회 api 명세 변경

Co-authored-by: Dora Choo <choo000407@naver.com>

---------

Co-authored-by: Dora Choo <choo000407@naver.com>
  • Loading branch information
fromitive and ChooSeoyeon authored Jul 24, 2024
1 parent 05b167c commit 9a49064
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.zzang.chongdae.offering.service.OfferingService;
import com.zzang.chongdae.offering.service.dto.OfferingAllResponse;
import com.zzang.chongdae.offering.service.dto.OfferingDetailResponse;
import com.zzang.chongdae.offering.service.dto.OfferingMeetingResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -35,4 +36,12 @@ public ResponseEntity<OfferingAllResponse> getAllOffering(
OfferingAllResponse response = offeringService.getAllOffering(lastId, pageSize);
return ResponseEntity.ok(response);
}

@Operation(summary = "공모 일정 조회", description = "공모 id를 통해 공모의 일정 정보를 조회합니다.")
@GetMapping("/offerings/{offering-id}/meetings")
public ResponseEntity<OfferingMeetingResponse> getOfferingMeeting(
@PathVariable(value = "offering-id") Long offeringId) {
OfferingMeetingResponse response = offeringService.getOfferingMeeting(offeringId);
return ResponseEntity.ok(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.zzang.chongdae.offering.domain;

import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class OfferingMeeting {

private final LocalDateTime deadline;
private final String meetingAddress;
private final String meetingAddressDetail;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.zzang.chongdae.common.repository.entity.BaseTimeEntity;
import com.zzang.chongdae.member.repository.entity.MemberEntity;
import com.zzang.chongdae.offering.domain.OfferingMeeting;
import com.zzang.chongdae.offering.domain.OfferingPrice;
import com.zzang.chongdae.offering.domain.OfferingStatus;
import jakarta.persistence.Column;
Expand Down Expand Up @@ -79,4 +80,8 @@ public OfferingPrice toOfferingPrice() {
public OfferingStatus toOfferingStatus() {
return new OfferingStatus(deadline, totalCount, isManualConfirmed, currentCount);
}

public OfferingMeeting toOfferingMeeting() {
return new OfferingMeeting(deadline, meetingAddress, meetingAddressDetail);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.zzang.chongdae.offering.service.dto.OfferingAllResponse;
import com.zzang.chongdae.offering.service.dto.OfferingAllResponseItem;
import com.zzang.chongdae.offering.service.dto.OfferingDetailResponse;
import com.zzang.chongdae.offering.service.dto.OfferingMeetingResponse;
import com.zzang.chongdae.offeringmember.repository.OfferingMemberRepository;
import java.util.List;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -50,4 +51,10 @@ public OfferingAllResponse getAllOffering(Long lastId, Integer pageSize) {
.toList()
);
}

public OfferingMeetingResponse getOfferingMeeting(Long offeringId) {
OfferingEntity offering = offeringRepository.findById(offeringId)
.orElseThrow(); // TODO: 예외 처리하기
return new OfferingMeetingResponse(offering.toOfferingMeeting());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.zzang.chongdae.offering.service.dto;

import com.zzang.chongdae.offering.domain.OfferingMeeting;
import java.time.LocalDateTime;

public record OfferingMeetingResponse(LocalDateTime deadline,
String meetingAddress,
String meetingAddressDetail) {

public OfferingMeetingResponse(OfferingMeeting offeringMeeting) {
this(offeringMeeting.getDeadline(),
offeringMeeting.getMeetingAddress(),
offeringMeeting.getMeetingAddressDetail()
);
}
}

0 comments on commit 9a49064

Please sign in to comment.