-
Notifications
You must be signed in to change notification settings - Fork 0
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
[YS-124] feat: 참여자 회원 정보 조회 API 구현 #31
Changes from 10 commits
3539106
f26f546
9302602
5949a3c
94d50f6
f6ad4fa
0ea29e4
1061421
e4b08e1
a094933
7c3f7a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.dobby.backend.application.usecase.member | ||
|
||
import com.dobby.backend.application.usecase.UseCase | ||
import com.dobby.backend.domain.exception.ParticipantNotFoundException | ||
import com.dobby.backend.domain.gateway.member.MemberGateway | ||
import com.dobby.backend.domain.gateway.member.ParticipantGateway | ||
import com.dobby.backend.domain.model.member.Member | ||
import com.dobby.backend.domain.model.member.Participant | ||
import com.dobby.backend.infrastructure.database.entity.enum.GenderType | ||
import com.dobby.backend.infrastructure.database.entity.enum.MatchType | ||
import java.time.LocalDate | ||
|
||
class GetParticipantInfoUseCase( | ||
private val memberGateway: MemberGateway, | ||
private val participantGateway: ParticipantGateway | ||
) : UseCase<GetParticipantInfoUseCase.Input, GetParticipantInfoUseCase.Output>{ | ||
data class Input( | ||
val memberId: Long, | ||
) | ||
|
||
data class Output( | ||
val member: Member, | ||
val gender: GenderType, | ||
val birthDate: LocalDate, | ||
val basicAddressInfo: Participant.AddressInfo, | ||
val additionalAddressInfo: Participant.AddressInfo?, | ||
val matchType: MatchType? | ||
) | ||
|
||
override fun execute(input: Input): Output { | ||
val memberId = input.memberId | ||
val member = memberGateway.getById(memberId) | ||
val participant = participantGateway.findByMemberId(memberId) | ||
?: throw ParticipantNotFoundException() | ||
|
||
return Output( | ||
member = member, | ||
gender = participant.gender, | ||
birthDate = participant.birthDate, | ||
basicAddressInfo = participant.basicAddressInfo, | ||
additionalAddressInfo = participant.additionalAddressInfo, | ||
matchType = participant.matchType | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.dobby.backend.domain.exception | ||
|
||
open class ParticipantException ( | ||
errorCode: ErrorCode, | ||
) : DomainException(errorCode) | ||
class ParticipantNotFoundException : ParticipantException(ErrorCode.PARTICIPANT_NOT_FOUND) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.dobby.backend.presentation.api.dto.response.member | ||
|
||
import com.dobby.backend.domain.model.member.Participant | ||
import com.dobby.backend.infrastructure.database.entity.enum.areaInfo.Area | ||
import com.dobby.backend.infrastructure.database.entity.enum.areaInfo.Region | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(description = "주소 정보 반환 DTO") | ||
data class AddressInfoResponse( | ||
@Schema(description = "지역") | ||
val region: Region, | ||
|
||
@Schema(description = "지역 상세") | ||
val area: Area | ||
) { | ||
companion object { | ||
fun fromDomain(basicAddressInfo: Participant.AddressInfo): AddressInfoResponse { | ||
return AddressInfoResponse( | ||
region = basicAddressInfo.region, | ||
area = basicAddressInfo.area | ||
) | ||
} | ||
} | ||
} | ||
Comment on lines
+8
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 자주 사용하게 될 거 같아 별도의 DTO로 추출했습니다. 수정님도 이 방식이 낫다면 해당 PR에서 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 좋습니다! 재사용성을 개선한 선택 같아보여요! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.dobby.backend.presentation.api.dto.response.member | ||
|
||
import com.dobby.backend.infrastructure.database.entity.enum.GenderType | ||
import com.dobby.backend.infrastructure.database.entity.enum.MatchType | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
import java.time.LocalDate | ||
|
||
@Schema(description = "공고 등록 시, 자동 입력에 필요한 연구자 정보 반환 DTO") | ||
data class ParticipantInfoResponse( | ||
@Schema(description = "사용자 기본 정보") | ||
val memberInfo: MemberResponse, | ||
|
||
@Schema(description = "성별") | ||
val gender: GenderType, | ||
|
||
@Schema(description = "생년월일") | ||
val birthDate: LocalDate, | ||
|
||
@Schema(description = "기본 주소 정보") | ||
val basicAddressInfo: AddressInfoResponse, | ||
|
||
@Schema(description = "추가 주소 정보") | ||
val additionalAddressInfo: AddressInfoResponse?, | ||
|
||
@Schema(description = "매칭 선호 타입") | ||
val matchType: MatchType?, | ||
) | ||
Comment on lines
+8
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 현재 회원 정보 조회와 관련된 디자인이나 와이어프레임이 없어, 참여자의 모든 정보를 반환하고 있습니다. 추후 필요 없는 필드가 있다면, 그에 맞게 응답을 간소화하여 최적화해 나가는 것이 좋을 것 같습니다! 또한, 실험자의 경우에도 현재 참여자 응답 구조처럼 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 추가적으로 수정님의 경우에는 매칭 선호 타입을 응답에서 반환할 때, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저는 처음에 '실험자'의 입장에서 '선호 타입'이라는 이름을 그대로 채택해서 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 좋습니다! 아무래도 프론트에게는 통일된 응답 필드를 주어야해서 해당 PR에서 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 회원의 기본 정보를 보는 URI는 이렇게 명하는 거 어떠신지 궁금합니다!