From 77e2bb6616ffe5995f99f81b40c37e1d01a35f3f Mon Sep 17 00:00:00 2001 From: Young Hun Park Date: Sun, 21 Jan 2024 21:38:52 +0900 Subject: [PATCH 1/4] feat: Carpool list API --- .../carpool/application/CarpoolMapper.java | 4 +++ .../carpool/application/CarpoolService.java | 12 +++++++++ .../carpool/domain/CarpoolRepository.java | 4 ++- .../carpool/presentation/dto/CarpoolDto.java | 25 +++++++++++++++---- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java b/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java index 6b94d2c..4ed8f80 100644 --- a/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java +++ b/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java @@ -26,6 +26,10 @@ public CarpoolDto toDto(Carpool carpool) { .build(); } + public CarpoolDto.CarpoolResponseDto toResponseDto(Carpool carpool) { + + } + public Carpool toEntity(MemberId memberId, CarpoolDto carpoolDto) { return Carpool.builder() .carpoolId(carpoolIdService.nextId()) diff --git a/src/main/java/com/fullcar/carpool/application/CarpoolService.java b/src/main/java/com/fullcar/carpool/application/CarpoolService.java index 2908a8a..1cc1be6 100644 --- a/src/main/java/com/fullcar/carpool/application/CarpoolService.java +++ b/src/main/java/com/fullcar/carpool/application/CarpoolService.java @@ -10,6 +10,9 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import java.util.List; +import java.util.stream.Collectors; + @Validated @Service @RequiredArgsConstructor(access = AccessLevel.PROTECTED) @@ -25,4 +28,13 @@ public CarpoolDto registerCarpool(MemberId memberId, CarpoolDto carpoolDto) { carpoolRepository.saveAndFlush(carpool) ); } + + @Transactional(readOnly = true) + public List getCarpoolList(MemberId memberId) { + List carpools = carpoolRepository.findAllByDeletedIsFalse(); + + return carpoolRepository.findAllByDeletedIsFalse().stream() + .map(carpoolMapper::toDto) + .collect(Collectors.toList()); + } } diff --git a/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java b/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java index da789ce..6f83499 100644 --- a/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java +++ b/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java @@ -3,9 +3,11 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.util.List; import java.util.Optional; @Repository public interface CarpoolRepository extends JpaRepository { - Optional findByCarpoolIdAndIsDeleted(CarpoolId carpoolId, boolean isDeleted); + Optional findByCarpoolIdAndDeletedFalse(CarpoolId carpoolId, boolean isDeleted); + List findAllByDeletedIsFalse(); } diff --git a/src/main/java/com/fullcar/carpool/presentation/dto/CarpoolDto.java b/src/main/java/com/fullcar/carpool/presentation/dto/CarpoolDto.java index 575ee99..e0b115b 100644 --- a/src/main/java/com/fullcar/carpool/presentation/dto/CarpoolDto.java +++ b/src/main/java/com/fullcar/carpool/presentation/dto/CarpoolDto.java @@ -1,17 +1,16 @@ package com.fullcar.carpool.presentation.dto; -import com.fullcar.carpool.domain.Carpool; -import com.fullcar.carpool.domain.CarpoolId; import com.fullcar.carpool.domain.MoodType; import com.fullcar.carpool.domain.PeriodType; -import com.fullcar.carpool.domain.service.CarpoolIdService; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import org.springframework.stereotype.Component; +import lombok.experimental.SuperBuilder; + +import java.time.LocalDateTime; @Getter -@Builder +@SuperBuilder @AllArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED) @Schema(description = "카풀 모델") @@ -34,4 +33,20 @@ public class CarpoolDto { @Schema(description = "운행 분위기") private MoodType moodType; + + @Getter + @SuperBuilder + @AllArgsConstructor + @NoArgsConstructor + @Schema(description = "카풀 응답모델") + public static class CarpoolResponseDto extends CarpoolDto { + @Schema(description = "회사명") + private String companyName; + + @Schema(description = "성별") + private String gender; + + @Schema(description = "생성 Timestamp") + private LocalDateTime createdAt; + } } From 56fdf7c4c3e3aad56a55c7a299de393c34a45c85 Mon Sep 17 00:00:00 2001 From: Young Hun Park Date: Fri, 26 Jan 2024 11:35:21 +0900 Subject: [PATCH 2/4] feat: Carpool list API --- .../com/fullcar/carpool/domain/Carpool.java | 23 +++++++++++++++++++ .../domain/event/MemberRequestEvent.java | 11 +++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java diff --git a/src/main/java/com/fullcar/carpool/domain/Carpool.java b/src/main/java/com/fullcar/carpool/domain/Carpool.java index d0fc364..b32c441 100644 --- a/src/main/java/com/fullcar/carpool/domain/Carpool.java +++ b/src/main/java/com/fullcar/carpool/domain/Carpool.java @@ -1,12 +1,18 @@ package com.fullcar.carpool.domain; +import com.fullcar.carpool.domain.event.MemberRequestEvent; import jakarta.persistence.*; import lombok.*; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.domain.AfterDomainEventPublication; +import org.springframework.data.domain.DomainEvents; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import static lombok.AccessLevel.PROTECTED; @@ -53,4 +59,21 @@ public class Carpool { @Column(name = "updated_at") @LastModifiedDate private LocalDateTime updatedAt; + + @Transient + private final Collection domainEvents; + + @DomainEvents + Collection domainEvents() { + List domainEvents = new ArrayList<>(); + domainEvents.add( + new MemberRequestEvent(this.driver.getMemberId()) + ); + return domainEvents; + } + + @AfterDomainEventPublication + public void clearEvents() { + domainEvents.clear(); + } } diff --git a/src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java b/src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java new file mode 100644 index 0000000..f2bde55 --- /dev/null +++ b/src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java @@ -0,0 +1,11 @@ +package com.fullcar.carpool.domain.event; + +import com.fullcar.member.domain.member.MemberId; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class MemberRequestEvent { + private MemberId memberId; +} From 73a887af3c4f19ab8f3bdb77c94bf17ab21ef720 Mon Sep 17 00:00:00 2001 From: Young Hun Park Date: Sat, 27 Jan 2024 23:36:33 +0900 Subject: [PATCH 3/4] feat: Carpool list API --- .../carpool/application/CarpoolMapper.java | 31 ++++++++------- .../carpool/application/CarpoolService.java | 30 +++++++++----- .../com/fullcar/carpool/domain/Carpool.java | 23 ----------- .../carpool/domain/CarpoolRepository.java | 6 ++- .../presentation/CarpoolController.java | 39 ++++++++++++++----- .../dto/request/CarpoolRequestDto.java | 33 ++++++++++++++++ .../CarpoolResponseDto.java} | 34 +++++++--------- .../fullcar/core/response/SuccessCode.java | 3 +- 8 files changed, 119 insertions(+), 80 deletions(-) create mode 100644 src/main/java/com/fullcar/carpool/presentation/dto/request/CarpoolRequestDto.java rename src/main/java/com/fullcar/carpool/presentation/dto/{CarpoolDto.java => response/CarpoolResponseDto.java} (58%) diff --git a/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java b/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java index f3b2dbe..9f76a44 100644 --- a/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java +++ b/src/main/java/com/fullcar/carpool/application/CarpoolMapper.java @@ -4,8 +4,10 @@ import com.fullcar.carpool.domain.Cost; import com.fullcar.carpool.domain.Driver; import com.fullcar.carpool.domain.service.CarpoolIdService; -import com.fullcar.carpool.presentation.dto.CarpoolDto; -import com.fullcar.member.domain.member.MemberId; +import com.fullcar.carpool.presentation.dto.request.CarpoolRequestDto; +import com.fullcar.carpool.presentation.dto.response.CarpoolResponseDto; +import com.fullcar.member.domain.member.Member; + import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -15,36 +17,35 @@ public class CarpoolMapper { private final CarpoolIdService carpoolIdService; - public CarpoolDto toDto(Carpool carpool) { - return CarpoolDto.builder() + public CarpoolResponseDto toDto(Carpool carpool, Member member) { + return CarpoolResponseDto.builder() .id(carpool.getCarpoolId().getId()) .pickupLocation(carpool.getPickupLocation()) .periodType(carpool.getCost().getPeriodType()) .money(carpool.getCost().getMoney()) .content(carpool.getContent()) .moodType(carpool.getMoodType()) + .companyName(member.getCompany()) + .gender(member.getGender()) + .createdAt(carpool.getCreatedAt()) .build(); } - public CarpoolDto.CarpoolResponseDto toResponseDto(Carpool carpool) { - - } - - public Carpool toEntity(MemberId memberId, CarpoolDto carpoolDto) { + public Carpool toEntity(Member member, CarpoolRequestDto carpoolRequestDto) { return Carpool.builder() .carpoolId(carpoolIdService.nextId()) - .pickupLocation(carpoolDto.getPickupLocation()) + .pickupLocation(carpoolRequestDto.getPickupLocation()) .cost( Cost.builder() - .periodType(carpoolDto.getPeriodType()) - .money(carpoolDto.getMoney()) + .periodType(carpoolRequestDto.getPeriodType()) + .money(carpoolRequestDto.getMoney()) .build() ) - .content(carpoolDto.getContent()) - .moodType(carpoolDto.getMoodType()) + .content(carpoolRequestDto.getContent()) + .moodType(carpoolRequestDto.getMoodType()) .driver( Driver.builder() - .memberId(memberId) + .memberId(member.getId()) .build() ) .build(); diff --git a/src/main/java/com/fullcar/carpool/application/CarpoolService.java b/src/main/java/com/fullcar/carpool/application/CarpoolService.java index a96252c..2742d7f 100644 --- a/src/main/java/com/fullcar/carpool/application/CarpoolService.java +++ b/src/main/java/com/fullcar/carpool/application/CarpoolService.java @@ -2,10 +2,13 @@ import com.fullcar.carpool.domain.Carpool; import com.fullcar.carpool.domain.CarpoolRepository; -import com.fullcar.carpool.presentation.dto.CarpoolDto; -import com.fullcar.member.domain.member.MemberId; +import com.fullcar.carpool.presentation.dto.request.CarpoolRequestDto; +import com.fullcar.carpool.presentation.dto.response.CarpoolResponseDto; +import com.fullcar.member.domain.member.Member; + import lombok.AccessLevel; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.*; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; @@ -13,6 +16,7 @@ import java.util.List; import java.util.stream.Collectors; + @Validated @Service @RequiredArgsConstructor(access = AccessLevel.PROTECTED) @@ -21,20 +25,26 @@ public class CarpoolService { private final CarpoolMapper carpoolMapper; @Transactional - public CarpoolDto registerCarpool(MemberId memberId, CarpoolDto carpoolDto) { - Carpool carpool = carpoolMapper.toEntity(memberId, carpoolDto); + public CarpoolResponseDto registerCarpool(Member member, CarpoolRequestDto carpoolRequestDto) { + Carpool carpool = carpoolMapper.toEntity(member, carpoolRequestDto); return carpoolMapper.toDto( - carpoolRepository.saveAndFlush(carpool) + carpoolRepository.saveAndFlush(carpool), + member ); } @Transactional(readOnly = true) - public List getCarpoolList(MemberId memberId) { - List carpools = carpoolRepository.findAllByDeletedIsFalse(); + public Slice getCarpoolList(Member member, int page, int size) { + Sort sort = Sort.by(Sort.Direction.DESC, "createdAt"); + PageRequest pageRequest = PageRequest.of(page, size, sort); + + Slice carpools = carpoolRepository.findAllByIsDeletedOrderByCreatedAtDesc(false, pageRequest); + + List carpoolResponseDtos = carpools.getContent().stream() + .map(carpool -> carpoolMapper.toDto(carpool, member)) + .toList(); - return carpoolRepository.findAllByDeletedIsFalse().stream() - .map(carpoolMapper::toDto) - .collect(Collectors.toList()); + return new SliceImpl<>(carpoolResponseDtos, carpools.getPageable(), carpools.hasNext()); } } diff --git a/src/main/java/com/fullcar/carpool/domain/Carpool.java b/src/main/java/com/fullcar/carpool/domain/Carpool.java index b32c441..d0fc364 100644 --- a/src/main/java/com/fullcar/carpool/domain/Carpool.java +++ b/src/main/java/com/fullcar/carpool/domain/Carpool.java @@ -1,18 +1,12 @@ package com.fullcar.carpool.domain; -import com.fullcar.carpool.domain.event.MemberRequestEvent; import jakarta.persistence.*; import lombok.*; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.domain.AfterDomainEventPublication; -import org.springframework.data.domain.DomainEvents; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; import static lombok.AccessLevel.PROTECTED; @@ -59,21 +53,4 @@ public class Carpool { @Column(name = "updated_at") @LastModifiedDate private LocalDateTime updatedAt; - - @Transient - private final Collection domainEvents; - - @DomainEvents - Collection domainEvents() { - List domainEvents = new ArrayList<>(); - domainEvents.add( - new MemberRequestEvent(this.driver.getMemberId()) - ); - return domainEvents; - } - - @AfterDomainEventPublication - public void clearEvents() { - domainEvents.clear(); - } } diff --git a/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java b/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java index 6f83499..4cd733e 100644 --- a/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java +++ b/src/main/java/com/fullcar/carpool/domain/CarpoolRepository.java @@ -1,5 +1,7 @@ package com.fullcar.carpool.domain; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Slice; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @@ -8,6 +10,6 @@ @Repository public interface CarpoolRepository extends JpaRepository { - Optional findByCarpoolIdAndDeletedFalse(CarpoolId carpoolId, boolean isDeleted); - List findAllByDeletedIsFalse(); + Optional findByCarpoolIdAndIsDeleted(CarpoolId carpoolId, boolean isDeleted); + Slice findAllByIsDeletedOrderByCreatedAtDesc(boolean isDeleted, Pageable pageable); } diff --git a/src/main/java/com/fullcar/carpool/presentation/CarpoolController.java b/src/main/java/com/fullcar/carpool/presentation/CarpoolController.java index 36abd4a..27c66dd 100644 --- a/src/main/java/com/fullcar/carpool/presentation/CarpoolController.java +++ b/src/main/java/com/fullcar/carpool/presentation/CarpoolController.java @@ -1,7 +1,8 @@ package com.fullcar.carpool.presentation; import com.fullcar.carpool.application.CarpoolService; -import com.fullcar.carpool.presentation.dto.CarpoolDto; +import com.fullcar.carpool.presentation.dto.request.CarpoolRequestDto; +import com.fullcar.carpool.presentation.dto.response.CarpoolResponseDto; import com.fullcar.core.annotation.CurrentMember; import com.fullcar.core.response.ApiResponse; import com.fullcar.core.response.SuccessCode; @@ -12,33 +13,51 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Slice; +import org.springframework.web.bind.annotation.*; +import java.util.List; -@Tag(description = "카풀 관련 Endpoint", name = "카풀") + +@Tag(name = "[Carpool] 카풀 관련 API") @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/carpools") public class CarpoolController { private final CarpoolService carpoolService; - @Operation(description = "카풀 등록") + @Operation(summary = "카풀 등록 API") @ApiResponses({ @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "201", description = "등록 성공") }) @PostMapping("") - public ApiResponse postCarpool( + public ApiResponse postCarpool( @Parameter(hidden = true) @CurrentMember Member member, @Parameter(description = "카풀 모델", required = true) - @RequestBody @Valid CarpoolDto carpoolDto + @RequestBody @Valid CarpoolRequestDto carpoolRequestDto ) { return ApiResponse.success( SuccessCode.REGISTER_SUCCESS, - carpoolService.registerCarpool(member.getId(), carpoolDto) + carpoolService.registerCarpool(member, carpoolRequestDto) + ); + } + + @Operation(summary = "카풀 목록 조회 API") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "조회 성공") + }) + @GetMapping("") + public ApiResponse> getCarpools( + @Parameter(hidden = true) + @CurrentMember Member member, + @RequestParam int page, + @RequestParam int size + ) { + return ApiResponse.success( + SuccessCode.READ_SUCCESS, + carpoolService.getCarpoolList(member, page, size) ); } } diff --git a/src/main/java/com/fullcar/carpool/presentation/dto/request/CarpoolRequestDto.java b/src/main/java/com/fullcar/carpool/presentation/dto/request/CarpoolRequestDto.java new file mode 100644 index 0000000..9a29a40 --- /dev/null +++ b/src/main/java/com/fullcar/carpool/presentation/dto/request/CarpoolRequestDto.java @@ -0,0 +1,33 @@ +package com.fullcar.carpool.presentation.dto.request; + +import com.fullcar.carpool.domain.MoodType; +import com.fullcar.carpool.domain.PeriodType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.time.LocalDateTime; + + +@Getter +@SuperBuilder +@AllArgsConstructor(access = AccessLevel.PROTECTED) +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Schema(description = "카풀 요청모델") +public class CarpoolRequestDto { + + @Schema(description = "픽업장소") + private String pickupLocation; + + @Schema(description = "희망비용(기간)") + private PeriodType periodType; + + @Schema(description = "희망비용(가격)") + private Long money; + + @Schema(description = "탑승자에게 전할 말") + private String content; + + @Schema(description = "운행 분위기") + private MoodType moodType; +} diff --git a/src/main/java/com/fullcar/carpool/presentation/dto/CarpoolDto.java b/src/main/java/com/fullcar/carpool/presentation/dto/response/CarpoolResponseDto.java similarity index 58% rename from src/main/java/com/fullcar/carpool/presentation/dto/CarpoolDto.java rename to src/main/java/com/fullcar/carpool/presentation/dto/response/CarpoolResponseDto.java index e0b115b..813bfab 100644 --- a/src/main/java/com/fullcar/carpool/presentation/dto/CarpoolDto.java +++ b/src/main/java/com/fullcar/carpool/presentation/dto/response/CarpoolResponseDto.java @@ -1,9 +1,12 @@ -package com.fullcar.carpool.presentation.dto; +package com.fullcar.carpool.presentation.dto.response; import com.fullcar.carpool.domain.MoodType; import com.fullcar.carpool.domain.PeriodType; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import java.time.LocalDateTime; @@ -13,8 +16,8 @@ @SuperBuilder @AllArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED) -@Schema(description = "카풀 모델") -public class CarpoolDto { +@Schema(description = "카풀 응답 모델") +public class CarpoolResponseDto { @Schema(description = "카풀 id") private Long id; @@ -34,19 +37,12 @@ public class CarpoolDto { @Schema(description = "운행 분위기") private MoodType moodType; - @Getter - @SuperBuilder - @AllArgsConstructor - @NoArgsConstructor - @Schema(description = "카풀 응답모델") - public static class CarpoolResponseDto extends CarpoolDto { - @Schema(description = "회사명") - private String companyName; - - @Schema(description = "성별") - private String gender; - - @Schema(description = "생성 Timestamp") - private LocalDateTime createdAt; - } + @Schema(description = "회사명") + private String companyName; + + @Schema(description = "성별") + private String gender; + + @Schema(description = "생성 Timestamp") + private LocalDateTime createdAt; } diff --git a/src/main/java/com/fullcar/core/response/SuccessCode.java b/src/main/java/com/fullcar/core/response/SuccessCode.java index 99f488b..e45edea 100644 --- a/src/main/java/com/fullcar/core/response/SuccessCode.java +++ b/src/main/java/com/fullcar/core/response/SuccessCode.java @@ -13,7 +13,8 @@ public enum SuccessCode { /* 200 OK */ SIGNIN_SUCCESS(OK, "소셜로그인 성공"), - GET_NEW_TOKEN_SUCCESS(OK, "토큰 재발급 성공"); + GET_NEW_TOKEN_SUCCESS(OK, "토큰 재발급 성공"), + READ_SUCCESS(OK, "조회 성공"); private final HttpStatus status; private final String message; From 3d586f139074364ba3d67ee889c31df9ed9ad130 Mon Sep 17 00:00:00 2001 From: Young Hun Park Date: Sat, 27 Jan 2024 23:43:26 +0900 Subject: [PATCH 4/4] fix: Delete MemberRequestEvent --- .../carpool/domain/event/MemberRequestEvent.java | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java diff --git a/src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java b/src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java deleted file mode 100644 index f2bde55..0000000 --- a/src/main/java/com/fullcar/carpool/domain/event/MemberRequestEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fullcar.carpool.domain.event; - -import com.fullcar.member.domain.member.MemberId; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class MemberRequestEvent { - private MemberId memberId; -}