-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Feat/#93] MemberType 정의 및 구독시 멤버 저장 과정 추가 #103
Conversation
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.
리뷰 부탁드립니다
/** module */ | ||
api(project(":data")) | ||
|
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.
api-repo 모듈에서 data 모듈 추가
val memberId = memberService.readMemberId(ReadMemberIdDto(useCaseIn.email)) ?: memberService.insertMember( | ||
InsertMemberDto(useCaseIn.email, MemberType.NORMAL_USER) | ||
) |
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.
구독시 멤버가 존재하지 않을 경우(memberService.readMemberId = null 리턴) 멤버를 저장하는데, 기본적으로 NORMAL_USER로 저장함. writer 같은 유저는 이미 writer로서 디비에 있다고 가정했음. 어드민 유저일리는 없을거고.. 그래서 노말 유저로 설정
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.
클래스는 Member인데 여긴 또 User라 해놨네요.. 이건 수정할게요
package com.few.data.common.code | ||
|
||
enum class MemberType(val code: Byte, val displayName: String) { | ||
NORMAL_USER(60, "일반유저"), | ||
ADMIN_USER(0, "어드민유저"), | ||
AUTHOR_USER(120, "작가유저"); | ||
|
||
companion object { | ||
fun fromCode(code: Byte): MemberType? { | ||
return values().find { it.code == code } | ||
} | ||
} | ||
} |
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.
멤버 타입 정의한 코드인데 front에선 멤버를 저장하거나 할땐 타입으로 통신하는게 좋아보이고 소스코드 상에서 60, 120 같은 멤버 타입 코드 값을 직접 지정하거나 하는 등의 코드 작성하지 않도록 주의해야 합니다. 멤버코드를 가져오거나 조회하거나 등등은 모두 MemberType 내에서 fromCode를 통하도록 해주세요
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.
즉, 60, 120 이런 숫자는 소스코드 상에서 MemberType에서만 보여야 함.
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.
구현 고생하셨습니다~!
api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberDao.kt
Outdated
Show resolved
Hide resolved
|
||
fun readMemberId(dto: readMemberIdDto): Long { | ||
return 1L // TODO: implemenets | ||
fun readMemberId(dto: ReadMemberIdDto): Long? { |
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.
여기 Dto는 api-repo에서 쓰는 query, command 때문에 dto로 하신거죠?
저는 service에도 query, command를 쓰기는 했는데 그럼 어색할까요?
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.
제가 쭉 봤는데 지금 쿼리, 커맨드 usecase in/out 등등 저희끼리 명칭이 안맞는 부분이 좀 있어서 한번에 맞춰가는 리펙토링 하시죠(패키지명도)
val memberId = memberService.readMemberId(ReadMemberIdDto(useCaseIn.email)) ?: memberService.insertMember( | ||
InsertMemberDto(useCaseIn.email, MemberType.NORMAL) | ||
) |
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.
굿굿
NORMAL(60, "일반유저"), | ||
ADMIN(0, "어드민유저"), | ||
WRITER(120, "작가유저"); |
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.
여기도 displayName을 멤버로 통일하는게 좋을꺼 같아요
@@ -30,7 +30,7 @@ class SubscriptionController( | |||
@RequestBody body: SubscribeWorkbookRequest | |||
): ApiResponse<ApiResponse.Success> { | |||
subscribeWorkbookUseCase.execute( | |||
SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = body.email, memberId = 1L) // TODO: memberId | |||
SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = body.email) // TODO: memberId |
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.
todo memberId는 추후에는 email이 아닌 memberId로 하면 좋겠다는 코멘트인거죠?
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.
아 저거 주석 삭제해야됨
api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberDao.kt
Outdated
Show resolved
Hide resolved
DSL.jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name").`as`(MemberRecord::name.name), | ||
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name) |
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.
추가로 일반 멤버에는 아마 name, url 키가 포함된 json이 아니라 {} 값만 들어갈 것 같아요!
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.
일반 멤버는 디스크립트션이 없다?
🎫 연관 이슈
resolved #93 #75
💁♂️ PR 내용
🙏 작업
🙈 PR 참고 사항
📸 스크린샷
🤖 테스트 체크리스트