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: 사서 대출권수 변경 #620

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

hyeunkim42
Copy link

@hyeunkim42 hyeunkim42 commented Sep 14, 2024

개요

사서의 대출권수를 4권으로 변경했습니다. (사서의 특권)
사서 본인이 본인의 대출을 진행할 때만 4권까지 가능합니다. 이는 앞으로 개발 될 예정인 집현전의 무인화 및 코드작성 편의를 고려하여 설정한 조건입니다.

관련 이슈

#619

추가 기능

  • 대출 진행 시 사서 표시하는 UI 추가
스크린샷 2024-09-20 오전 11 58 59
  • 대출 확인 모달의 도서 간 경계 및 비고란의 배경색 추가
스크린샷 2024-09-20 오후 3 13 02

@hyeunkim42 hyeunkim42 linked an issue Sep 14, 2024 that may be closed by this pull request
5 tasks
lendingLimit 변수의 값이 selectedUser가 librarian(현재 로그인한 유저)인 경우 4로 설정됨
- prop으로 넘겨받고 있는데, Atom 에서 받아와서 설정하도록 다시 변경해야함
setSelectedBooks내부에서 불러오는 함수를  splice에서 filter로 변경
@hyeunkim42 hyeunkim42 closed this Sep 19, 2024
@mixsung mixsung added 사서 UI/UX UI/UX 관련 labels Sep 20, 2024
@hyeunkim42 hyeunkim42 changed the title WIP WIP: 사서 대출권수 변경 Sep 20, 2024
@hyeunkim42 hyeunkim42 changed the title WIP: 사서 대출권수 변경 wip: 사서 대출권수 변경 Sep 20, 2024
@hyeunkim42 hyeunkim42 marked this pull request as ready for review September 21, 2024 06:37
@hyeunkim42 hyeunkim42 marked this pull request as draft September 21, 2024 06:38
TextareaWithLabel에서 setState를 다시 생성해서 관리하고 있던 부분을 받아온 state를 이용하도록 변경
@mixsung mixsung changed the title wip: 사서 대출권수 변경 feat: 사서 대출권수 변경 Sep 21, 2024
@mixsung mixsung marked this pull request as ready for review September 21, 2024 14:57
selectedUser.isPenalty && (penalty += "대출제한 (연체");

// 제한 권수 판단
const lendingLimit = librarian && librarian.id === selectedUser.id ? 4 : 2;
Copy link
Member

@YeonSeong-Lee YeonSeong-Lee Sep 22, 2024

Choose a reason for hiding this comment

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

34번 라인같은 코드가 많이 보이는데 함수도 빼면 가독성이 더 좋을거 같아요. util함수 같은 느낌으로다가 constant 폴더에 넣으면 적합하다고 생각합니다.

Copy link

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 같은 빈 값으로 들어오는 것도 고려해야 좋은지 고민이 됩니다.

src/component/rent/RentModalConfirm.tsx Outdated Show resolved Hide resolved
@@ -8,24 +10,38 @@ type Props = {
};

const UserList = ({ user, setSelectedUser, closeModal }: Props) => {

const librarian = useRecoilValue(userAtom);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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";

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* `Rent` 컴포넌트는 도서 대출 기능을 제공하는 페이지입니다.
* @description
*
* 유의점:
* - 사서의 대출권수 4권으로 설정. 사서 본인의 대출건만 4권으로 적용
*
* 상태:
* - `selectedUser`: 대출해줄 사용자 정보
* - `selectedBooks`: 대출해줄 도서 목록
*
* :
* - `useModal`: 모달 열기 닫기 기능 제공
* - `useRecoilValue`: Recoil 상태 관리 라이브러리에서 현재 사용자 정보 가져오기
*
* @returns {JSX.Element} 도서 대출 페이지를 렌더링하는 JSX 요소
*/

JSDoc을 통해 다른 파일에서도 비지니스 로직(사서만 4권)을 확인할 수 있도록 수정하면 유지보수하기 용이할 듯 합니다.

Copy link

Choose a reason for hiding this comment

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

반영했습니다!

mixsung and others added 3 commits September 23, 2024 17:40
피드백 반영해서
1. 변수 이름을 librarian에서 currUser로 수정했습니다.
2. lending limit의 경우 constant 폴더의 status에서 가져와서 사용하도록 했습니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI/UX UI/UX 관련 사서
Projects
None yet
Development

Successfully merging this pull request may close these issues.

사서 대출권수 4권으로 변경
3 participants