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

프로필 및 커버 사진업로드 구현 #92

Closed
wants to merge 13 commits into from

Conversation

pkch93
Copy link

@pkch93 pkch93 commented Aug 29, 2019

현재 제 컴퓨터에서 S3에 접근이 불가해 실제로 Profile과 Cover 사진 업로드가 제대로 되는지는 확인 못했습니다. 확인 부탁드려요 ㅎㅎ

현재 Upload를 UploadType이라는 enum에서 해주고 있어요. 구조가 맞게 이뤄졌는지 여러분의 의견도 궁금합니다. *(UploadType의 이름이 적절하지 않은 것 같기도하네요...) 확인부탁드려요!

resolved #33 #68 #87

- 프로필, 커버사진 업로드를 위한 서비스 클래스 생성 (UserImageUploadService)
- 프로필, 커버를 구별하는 enum UploadType
- ImageUploader 함수형 인터페이스로 업로드 구현
- 유저의 이미지를 받는 Dto UploadImage
- UploadType enum을 String에서 변환해주는 UploadTypeConverter 구현 및 등록
- 마이페이지 전용 Dto MyPageResponse 추가
- 친구 정보를 가져오는 jpql 추가 (findFriendsByUserId)
- 내가 올린 사진 정보 가져오는 쿼리 메서드 추가 (findByOwnerId)
…s-2019 into feature/profile

# Conflicts:
#	src/main/java/com/wootecobook/turkey/user/controller/UserApiController.java
#	src/main/java/com/wootecobook/turkey/user/service/UserService.java
#	src/main/resources/static/css/mypage.css
#	src/main/resources/static/js/mypage/mypage.js
#	src/main/resources/static/js/mypage/template.js
- 친구의 정보를 가져오는 JPQL 테스트
- 프로필 및 커버 사진 업로드 테스트
@pkch93 pkch93 added the enhancement New feature or request label Aug 29, 2019
@pkch93 pkch93 added this to the 3주차 milestone Aug 29, 2019
@pkch93 pkch93 self-assigned this Aug 29, 2019
Copy link

@yk1028 yk1028 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 💯

import com.wootecobook.turkey.user.service.UploadType;
import org.springframework.core.convert.converter.Converter;

public class UploadTypeConverter implements Converter<String, UploadType> {
Copy link

Choose a reason for hiding this comment

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

이름이 조금 햇갈리는것 같아요. 이미지를 구분하는 것이니 ImageTypeConverter 같은 이름도 좋을거 같아요.

public boolean existsById(final Long id) {
return userRepository.existsById(id);

Copy link

Choose a reason for hiding this comment

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

한 줄 띄워져있네요.

private List<UserResponse> friends;

@Builder
public MyPageResponse(final UserResponse user, final FileFeature cover, final List<FileFeature> images, final List<UserResponse> friends) {
Copy link

Choose a reason for hiding this comment

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

private는 어떨까요?

@@ -0,0 +1,83 @@
const UPLOAD_URL = (userId) => `/api/users/${userId}/upload`
Copy link

Choose a reason for hiding this comment

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

👍

}

@GetMapping("/{id}")
public ResponseEntity<UserResponse> show(@PathVariable Long id) {
return ResponseEntity.ok(userService.findUserResponseById(id));
public ResponseEntity<MyPageResponse> show(@PathVariable Long id) {
Copy link

Choose a reason for hiding this comment

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

기존것 이외에 아래처럼 새로운 메서드를 하나 만드는게 어떨까요? url만 보면 혼란스러울 수 있을것 같아요.

@GetMapping("/{id}/mypage")
 public ResponseEntity<MyPageResponse> show(@PathVariable Long id) {
    return ResponseEntity.ok(myPageService.findUserResponseById(id));
}

@dpudpu dpudpu closed this Aug 29, 2019
@pkch93 pkch93 deleted the feature/profile branch September 2, 2019 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants