Skip to content

Commit

Permalink
HOTFIX: 정기모임을 캘린더에 표시할 때 event와 동일한 형식으로 반환
Browse files Browse the repository at this point in the history
  • Loading branch information
hyxklee committed Aug 8, 2024
1 parent 8f12d80 commit aca3eef
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class MeetingDTO {

public record Response(
public record ResponseAll(
Long id,
String title,
String content,
Expand All @@ -24,6 +24,20 @@ public record Response(
LocalDateTime modifiedAt
) {}

public record Response(
Long id,
String title,
String content,
String location,
LocalDateTime start,
LocalDateTime end,
String name,
Integer memberCount,
String requiredItem,
LocalDateTime createdAt,
LocalDateTime modifiedAt
) {}

public record Save(
@NotBlank String title,
@NotBlank String content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
public interface MeetingMapper {

@Mapping(target = "memberCount", expression = "java( getMemberCount(meeting) )")
@Mapping(target = "requiredItem", expression = "java(\"노트북\")")
@Mapping(target = "name", source = "user.name")
Response to(Meeting meeting);

@Mapping(target = "memberCount", expression = "java( getMemberCount(meeting) )")
@Mapping(target = "name", source = "user.name")
ResponseAll toAll(Meeting meeting);

@Mappings({
@Mapping(target = "id", ignore = true),
@Mapping(target = "code", expression = "java( generateCode() )"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface MeetingUseCase {

void delete(Long meetingId);

List<Response> findAll(Integer cardinal);
List<ResponseAll> findAll(Integer cardinal);

List<Response> findAll();
List<ResponseAll> findAll();
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public void delete(Long meetingId) {
}

@Override
public List<Response> findAll(Integer cardinal) {
public List<ResponseAll> findAll(Integer cardinal) {
return meetingGetService.find(cardinal).stream()
.map(mapper::to)
.map(mapper::toAll)
.toList();
}

@Override
public List<Response> findAll() {
public List<ResponseAll> findAll() {
return meetingGetService.findAll().stream()
.map(mapper::to)
.map(mapper::toAll)
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public CommonResponse<Void> save(@RequestBody @Valid Save dto, @CurrentUser Long
}

@PostMapping("/{cardinal}")
public CommonResponse<List<MeetingDTO.Response>> findAll(@PathVariable Integer cardinal) {
public CommonResponse<List<MeetingDTO.ResponseAll>> findAll(@PathVariable Integer cardinal) {
return CommonResponse.createSuccess(meetingUseCase.findAll(cardinal));

}

@GetMapping
public CommonResponse<List<MeetingDTO.Response>> findAll() {
public CommonResponse<List<MeetingDTO.ResponseAll>> findAll() {
return CommonResponse.createSuccess(meetingUseCase.findAll());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package leets.weeth.domain.schedule.presentation;

import leets.weeth.domain.schedule.application.dto.MeetingDTO;
import leets.weeth.domain.schedule.application.usecase.MeetingUseCase;
import leets.weeth.global.common.response.CommonResponse;
import lombok.RequiredArgsConstructor;
Expand All @@ -8,8 +9,6 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static leets.weeth.domain.schedule.application.dto.MeetingDTO.Response;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/meetings")
Expand All @@ -18,7 +17,7 @@ public class MeetingController {
private final MeetingUseCase meetingUseCase;

@GetMapping("/{meetingId}")
public CommonResponse<Response> find(@PathVariable Long meetingId) {
public CommonResponse<MeetingDTO.Response> find(@PathVariable Long meetingId) {
return CommonResponse.createSuccess(meetingUseCase.find(meetingId));
}
}

0 comments on commit aca3eef

Please sign in to comment.