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

[Feat/#93] MemberType 정의 및 구독시 멤버 저장 과정 추가 #103

Merged
merged 9 commits into from
Jun 24, 2024

Conversation

hun-ca
Copy link
Member

@hun-ca hun-ca commented Jun 23, 2024

🎫 연관 이슈

resolved #93 #75

💁‍♂️ PR 내용

🙏 작업

🙈 PR 참고 사항

📸 스크린샷

🤖 테스트 체크리스트

  • 체크 미완료
  • 체크 완료

@hun-ca hun-ca added the feature 새로운 기능을 만들 때 사용됩니다 label Jun 23, 2024
@hun-ca hun-ca self-assigned this Jun 23, 2024
@hun-ca hun-ca requested a review from belljun3395 as a code owner June 23, 2024 16:10
@hun-ca hun-ca linked an issue Jun 23, 2024 that may be closed by this pull request
Copy link
Member Author

@hun-ca hun-ca left a comment

Choose a reason for hiding this comment

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

리뷰 부탁드립니다

Comment on lines +25 to +27
/** module */
api(project(":data"))

Copy link
Member Author

Choose a reason for hiding this comment

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

api-repo 모듈에서 data 모듈 추가

Comment on lines 24 to 26
val memberId = memberService.readMemberId(ReadMemberIdDto(useCaseIn.email)) ?: memberService.insertMember(
InsertMemberDto(useCaseIn.email, MemberType.NORMAL_USER)
)
Copy link
Member Author

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로서 디비에 있다고 가정했음. 어드민 유저일리는 없을거고.. 그래서 노말 유저로 설정

Copy link
Member Author

Choose a reason for hiding this comment

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

클래스는 Member인데 여긴 또 User라 해놨네요.. 이건 수정할게요

Comment on lines 1 to 13
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 }
}
}
}
Copy link
Member Author

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를 통하도록 해주세요

Copy link
Member Author

Choose a reason for hiding this comment

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

즉, 60, 120 이런 숫자는 소스코드 상에서 MemberType에서만 보여야 함.

Copy link
Collaborator

@belljun3395 belljun3395 left a comment

Choose a reason for hiding this comment

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

구현 고생하셨습니다~!


fun readMemberId(dto: readMemberIdDto): Long {
return 1L // TODO: implemenets
fun readMemberId(dto: ReadMemberIdDto): Long? {
Copy link
Collaborator

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를 쓰기는 했는데 그럼 어색할까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

제가 쭉 봤는데 지금 쿼리, 커맨드 usecase in/out 등등 저희끼리 명칭이 안맞는 부분이 좀 있어서 한번에 맞춰가는 리펙토링 하시죠(패키지명도)

Comment on lines +24 to +26
val memberId = memberService.readMemberId(ReadMemberIdDto(useCaseIn.email)) ?: memberService.insertMember(
InsertMemberDto(useCaseIn.email, MemberType.NORMAL)
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

굿굿

Comment on lines 4 to 6
NORMAL(60, "일반유저"),
ADMIN(0, "어드민유저"),
WRITER(120, "작가유저");
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

todo memberId는 추후에는 email이 아닌 memberId로 하면 좋겠다는 코멘트인거죠?

Copy link
Member Author

Choose a reason for hiding this comment

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

아 저거 주석 삭제해야됨

Comment on lines 39 to 40
DSL.jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name").`as`(MemberRecord::name.name),
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

추가로 일반 멤버에는 아마 name, url 키가 포함된 json이 아니라 {} 값만 들어갈 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

일반 멤버는 디스크립트션이 없다?

@hun-ca hun-ca requested a review from belljun3395 June 24, 2024 11:27
@hun-ca hun-ca merged commit 3029e57 into main Jun 24, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능을 만들 때 사용됩니다
Projects
None yet
Development

Successfully merging this pull request may close these issues.

구독시 멤버 테이블 저장 로직 추가 MEMBER TYPE_CD 정의
2 participants