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

refactor: UsersService setOverDueDay -> withLendingInfo #574

Merged
merged 7 commits into from
Jul 11, 2023

Conversation

scarf005
Copy link
Member

@scarf005 scarf005 commented Jul 9, 2023

개요

#544 에서 머지되었다 #567 에서 롤백되었다 다시 돌아왔읍니다...

@scarf005 scarf005 requested a review from jimin52 July 9, 2023 08:10
Copy link
Member

@jimin52 jimin52 left a comment

Choose a reason for hiding this comment

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

어디선가 리뷰한적 있는 코드군요

@scarf005 scarf005 marked this pull request as draft July 9, 2023 08:28
scarf005 added 6 commits July 11, 2023 09:49
map과 foreach는 배열이 비어있어도 동작에 영향을 주지 않으므로 제거
사용자 명칭이 user와 item으로 다르게 불리던 것을 user로 통일
실제로 유저를 변경하지 않고 대여 기록과 함께 반환하므로
@scarf005 scarf005 force-pushed the usersservice-리팩터링 branch from b4c2497 to feaa8bd Compare July 11, 2023 00:49
@scarf005 scarf005 marked this pull request as ready for review July 11, 2023 02:36
@scarf005
Copy link
Member Author

async searchUserBy(conditions: {}, limit: number, page: number)
: Promise<[models.User[], number]> {
const [users, count] = await this.findAndCount({
select: [
'id',
'email',
'nickname',
'intraId',
'slack',
'penaltyEndDate',
'role',
],
where: conditions,
take: limit,
skip: page * limit,
});

const [items, count] = await this.usersRepository.searchUserBy([
{ nickname: Like(`%${nicknameOrEmail}%`) },
{ email: Like(`%${nicknameOrEmail}`) },
], limit, page);
const setItems = await this.setOverDueDay(items);

확인 결과 withLendingsInfo (전 setOverDueDay)의 인자 items는 반드시 배열이기에 item의 존재 유무를 확인하지 않는 커밋 1f9c47a 을 그대로 유지했습니다.

@scarf005 scarf005 changed the title refactor: UsersService.setOverDueDay refactor: UsersService setOverDueDay -> withLendingInfo Jul 11, 2023
@scarf005 scarf005 merged commit 2e51856 into develop Jul 11, 2023
@scarf005 scarf005 deleted the usersservice-리팩터링 branch July 11, 2023 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants