Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 약속 생성 API에서 바디를 통해 uuid를 제공 #87

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ public MomoApiResponse<MeetingResponse> find(@PathVariable String uuid) {
}

@PostMapping("/api/v1/meeting")
public ResponseEntity<Void> create(@RequestBody @Valid MeetingCreateRequest request) {
String uuid = meetingService.create(request);
return ResponseEntity.created(URI.create("/meeting/" + uuid))
.build();
public ResponseEntity<MomoApiResponse<MeetingSharingResponse>> create(
@RequestBody @Valid MeetingCreateRequest request
) {
MeetingSharingResponse response = meetingService.create(request);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 임시 구현일수도 있지만, 지금과 같은 맥락에서 body에 UUID를 담아 응답하는 구현이 계속 유지된다면 나중에 MeetingSharingResponse라는 레코드명은 수정이 필요할 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그렇네요! 이후 분리하도록 하겠습니다~

return ResponseEntity.created(URI.create("/meeting/" + response.uuid()))
.body(new MomoApiResponse<>(response));
}

@GetMapping("/api/v1/meeting/{uuid}/sharing")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public class MeetingService {
private final AttendeeRepository attendeeRepository;

@Transactional
public String create(MeetingCreateRequest request) {
public MeetingSharingResponse create(MeetingCreateRequest request) {
Meeting meeting = saveMeeting(request.meetingName(), request.meetingStartTime(), request.meetingEndTime());
saveAvailableDates(request.meetingAvailableDates(), meeting);
saveHostAttendee(meeting, request.hostName(), request.hostPassword());
return meeting.getUuid();
return MeetingSharingResponse.from(meeting);
}

private Meeting saveMeeting(String meetingName, LocalTime startTime, LocalTime endTime) {
Expand Down