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

Feature: 유저 프로필 수정 기능 구현 #61

Merged
merged 6 commits into from
Jun 4, 2024
Merged

Conversation

lcomment
Copy link
Collaborator

@lcomment lcomment commented Jun 3, 2024

Issue Number

#52

Description

유저 프로필 수정 API를 구현하였습니다. 테스트를 작성하던 중 JWT 관련해서 통합 테스트 관련 추상 클래스에 getAuthToken() 메서드를 추가하였고, 테스트에 반영했으니 참고해주세요.

ps. patch가 아닌 put을 활용한 이유는 TestRestTemplate에 Patch 관련 설정이 불가능해서입니다. (RestTemplate으로 바꾸면 가능한데, 의존성도 추가해야 해서 모든 업데이트 API에 대하여 PUT을 활용하는게 어떨지 의견 드립니다.)

Core Code

. . .
	@Transactional
	public void updateInformation(final User signInUser, final ProfileUpdateRequest dto) {
		final User user = userReader.findByUserId(signInUser.getId());
		final ProfileUpdateParam param = UserMapper.supplyProfileUpdateParamBy(dto);

		user.updateProfile(param);
	}
. . .

etc

@lcomment lcomment added feature 새로운 기능 개발 test 테스트 작성 labels Jun 3, 2024
@lcomment lcomment requested a review from YongsHub June 3, 2024 09:03
@lcomment lcomment self-assigned this Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

Test Results

48 tests   47 ✅  5s ⏱️
10 suites   1 💤
10 files     0 ❌

Results for commit 41dcbae.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@YongsHub YongsHub left a comment

Choose a reason for hiding this comment

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

고생하셨습니다

Copy link
Contributor

Choose a reason for hiding this comment

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

request1 method에서도 토큰 생성 메서드로 적용 부탁드립니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

적용돼있습니다!

Comment on lines +49 to +55
final ProfileUpdateRequest body = getConstructorMonkey().giveMeBuilder(ProfileUpdateRequest.class)
.set("nickname", Arbitraries.strings().withCharRange('a', 'z').ofMinLength(1).ofMaxLength(20))
.set("profileImageUrl", Arbitraries.strings().withCharRange('a', 'z').ofMinLength(1).ofMaxLength(200))
.set("email", Arbitraries.strings().withCharRange('a', 'z').ofMinLength(1).ofMaxLength(50))
.set("gender", Arbitraries.of(Gender.class))
.set("birthday", LocalDate.now())
.sample();
Copy link
Contributor

Choose a reason for hiding this comment

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

ConstructorMonkey를 이용해서 Fixture만들면 이렇게 커스텀하지 않아도 자동으로 값이 들어간 ProfileUpdateRequest 인스턴스가 생성될텐데 코드 중복때매 불편하면 한번 확인해보세용!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

통합 테스트 시, 엔티티의 컬럼도 신경써야해서요, 범위를 지정하지 않으면 data too long 에러가 경우에 따라 발생합니다,,

@lcomment lcomment merged commit 9d4e47a into master Jun 4, 2024
2 checks passed
@lcomment lcomment deleted the feature/#52 branch June 4, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능 개발 test 테스트 작성
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants