-
Notifications
You must be signed in to change notification settings - Fork 5
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: 사서 대출권수 변경 #620
base: develop
Are you sure you want to change the base?
The head ref may contain hidden characters: "619-\uC0AC\uC11C-\uB300\uCD9C\uAD8C\uC218-4\uAD8C\uC73C\uB85C-\uBCC0\uACBD"
feat: 사서 대출권수 변경 #620
Conversation
lendingLimit 변수의 값이 selectedUser가 librarian(현재 로그인한 유저)인 경우 4로 설정됨 - prop으로 넘겨받고 있는데, Atom 에서 받아와서 설정하도록 다시 변경해야함
setSelectedBooks내부에서 불러오는 함수를 splice에서 filter로 변경
Rent Modal User List와 Rent Inquire Box User 모두 연체인 경우만 괄호를 닫아주고 있어서 책 권수 초과에도 닫도록 조건 추가
remark(비고) array를 만들어서 selectedBooks의 index 이용하도록 설정
TextareaWithLabel에서 setState를 다시 생성해서 관리하고 있던 부분을 받아온 state를 이용하도록 변경
selectedUser.isPenalty && (penalty += "대출제한 (연체"); | ||
|
||
// 제한 권수 판단 | ||
const lendingLimit = librarian && librarian.id === selectedUser.id ? 4 : 2; |
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.
34번 라인같은 코드가 많이 보이는데 함수도 빼면 가독성이 더 좋을거 같아요. util함수 같은 느낌으로다가 constant 폴더에 넣으면 적합하다고 생각합니다.
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.
constant의 status.js에 함수화 시켜서 넣어봤습니다. 해당 함수에 객체를 인자로 넘기는데, 객체의 요소(isAdmin이나 id)가 undefined 같은 빈 값으로 들어오는 것도 고려해야 좋은지 고민이 됩니다.
@@ -8,24 +10,38 @@ type Props = { | |||
}; | |||
|
|||
const UserList = ({ user, setSelectedUser, closeModal }: Props) => { | |||
|
|||
const librarian = useRecoilValue(userAtom); |
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 librarian = useRecoilValue(userAtom); | |
const currentUser= useRecoilValue(userAtom); |
librarian
는 사서유저를 뜻하는데, 맥락상 사서유저보다는 현재유저가 더 적합한거 같습니다.
librarian
으로 하는 특별한 이유가 있나요?!
@@ -12,12 +12,17 @@ import RentModalConfirm from "./RentModalConfirm"; | |||
import LoginIcon from "../../asset/img/login_icon_white.svg"; | |||
import BookIcon from "../../asset/img/admin_icon.svg"; | |||
import "../../asset/css/Rent.css"; | |||
import { useRecoilValue } from "recoil"; | |||
import { userAtom } from "~/atom/userAtom"; | |||
|
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.
/** | |
* `Rent` 컴포넌트는 도서 대출 기능을 제공하는 페이지입니다. | |
* @description | |
* | |
* 유의점: | |
* - 사서의 대출권수 4권으로 설정. 사서 본인의 대출건만 4권으로 적용 | |
* | |
* 상태: | |
* - `selectedUser`: 대출해줄 사용자 정보 | |
* - `selectedBooks`: 대출해줄 도서 목록 | |
* | |
* 훅: | |
* - `useModal`: 모달 창 열기 및 닫기 기능 제공 | |
* - `useRecoilValue`: Recoil 상태 관리 라이브러리에서 현재 사용자 정보 가져오기 | |
* | |
* @returns {JSX.Element} 도서 대출 페이지를 렌더링하는 JSX 요소 | |
*/ | |
JSDoc을 통해 다른 파일에서도 비지니스 로직(사서만 4권)을 확인할 수 있도록 수정하면 유지보수하기 용이할 듯 합니다.
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. 변수 이름을 librarian에서 currUser로 수정했습니다. 2. lending limit의 경우 constant 폴더의 status에서 가져와서 사용하도록 했습니다.
개요
사서의 대출권수를 4권으로 변경했습니다. (사서의 특권)
사서 본인이 본인의 대출을 진행할 때만 4권까지 가능합니다. 이는 앞으로 개발 될 예정인 집현전의 무인화 및 코드작성 편의를 고려하여 설정한 조건입니다.
관련 이슈
#619
추가 기능