-
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
Feature/role constansts로 빼기 #848 #852
The head ref may contain hidden characters: "feature/Role-constansts\uB85C-\uBE7C\uAE30-#848"
Conversation
src/constants/member.ts
Outdated
BACK_전산관리자: 'ROLE_BACK_전산관리자', | ||
INFRA_전산관리자: 'ROLE_INFRA_전산관리자', | ||
회원: 'ROLE_회원', | ||
출제자: 'ROLE_출제자', |
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.
상수를 선언할 때, chairman
이 아닌 한글로 회장
으로 선언해줬습니다! 영어로 하면 오히려 코드읽기가 어려울 것 같아서 입니다..! 그런데 한글의 경우, FRONT_전산관리자
같은 경우 어떻게 선언해줘야할지(카멜케이스, _ 등등) 고민입니다..
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.
한글 섞여있는 경우 _
좋은 것 같아요!
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.
저도 영어랑 한글이 섞여있다면 언더바로 구분하는게 좋은 것 같습니다~!!
export const MEMBER_ROLE3 = { | ||
회장: prefix('회장'), | ||
부회장: prefix('부회장'), | ||
} as const; |
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_ROLE
상수를 선언하는 방식이 3가지인데, 어느게 좋을지 고민이 됩니다..
ROLE_회장
과 같이 바로 텍스트로 넣어주기 -> 해당 방식이 간단하지만,ROLE_
부분이 중복되는데 이걸 바로 박아버리기 애매했습니다.- prefix 변수
백틱
안에 같이 넣어주기 - prefix 함수 만들어서 사용하기
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.
2222
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.
왜죠!!!!!
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.
저는 1번도 괜찮을 것 같긴 합니다!
- 이유
- 에러 메시지를 상수로 바꾸는 과정에서는 (중복되더라도) 그냥 텍스트로 사용합니다.
- prefix() 가 어떤 형태인지 알고 있다면 이해할 수 있겠지만, 모른다면 해당 함수를 타고 들어가서 확인을 해야할 것 같습니다
근데 공통되는걸 묶으려면 백틱을 사용하는게 조금 더 전달력이 좋을 것 같습니당
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.
왜죠!!!!!
1. ROLE_
이라는 prefix를 백엔드와 공통적으로 사용하고 있는데, 직책을 어떻게 표기할 지에 따라서 충분히 변경 가능한 부분으로 보입니다. 1번으로 가게되면 변경될 경우 수동으로 업데이트 해주어야 하는 게 번거로울 것 같아요!
3. 사실 이게 제일 깔끔해보이지는 한데, 단순한 텍스트에 함수 실행문이 들어가는 게 조금 과한 것 같다는 생각도 들더라구요!
그래서 최종적으로 prefix 변수를 사용하지만 템플릿 리터럴로 표현된 2번으로 선택하였습니다! 하지만 prefix로 사용되는 ROLE_
이 크게 변동이 많을 것 같은 부분은 아니라서 1번도 괜찮을 것 같아요!
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.
{jobName !== 'ROLE_전산관리자' ? ( | ||
{jobName !== MEMBER_ROLE.전산관리자 && ( |
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.
굿!!
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.
1,2,3 선택된 걸로 반영되면 approve 하겠습니다!
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.
👍
export const MEMBER_ROLE3 = { | ||
회장: prefix('회장'), | ||
부회장: prefix('부회장'), | ||
} as const; |
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.
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.
좋습니다~!! 질문에 답해주셔서 감사해용 ㅎㅎ 수고하셨습니다!!
} | ||
|
||
const badgeImage = roles.find((role) => role.name === jobName)?.img; | ||
// NOTE jobName으로는 "ROLE_전산관리자" 내려오지만, roles에는 존재하지 않습니다! 세부적인 전산관리자(프론트, 백, 인프라)만 존재합니다 |
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.
오옹 이런 주석 좋은것같슴당
src/constants/member.ts
Outdated
BACK_전산관리자: 'ROLE_BACK_전산관리자', | ||
INFRA_전산관리자: 'ROLE_INFRA_전산관리자', | ||
회원: 'ROLE_회원', | ||
출제자: 'ROLE_출제자', |
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.
저도 영어랑 한글이 섞여있다면 언더바로 구분하는게 좋은 것 같습니다~!!
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.
굿굿!
연관 이슈
작업 요약
To 리뷰어... 💌
5분