Skip to content

Commit

Permalink
[fix] User thumnail 로직 수정 - #127
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarlgnszx committed Jul 16, 2024
1 parent 7d4b6ad commit 65dfd36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ResponseEntity<UserJwtInfoRes> signUp(
@RequestPart(name = "userSignUpReq", required = true) @Parameter(description = "회원가입 요청 데이터") final UserSignUpReq userSignUpReq,
@RequestPart(name = "image", required = true) @Parameter(description = "프로필 이미지") MultipartFile image,
@RequestPart(name = "tag", required = true) @Parameter(description = "사용자 태그") List<DateTagType> tag
) throws IOException;
) throws IOException, ExecutionException, InterruptedException;

@Operation(summary = "로그인", description = "사용자가 로그인을 합니다.")
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ResponseEntity<UserJwtInfoRes> signUp(@RequestHeader(AUTHORIZATION) final
@RequestPart("userSignUpReq") final UserSignUpReq userSignUPReq,
@RequestPart("image") MultipartFile image,
@RequestPart("tag") List<DateTagType> tag
) throws IOException {
) throws IOException, ExecutionException, InterruptedException {
UserJwtInfoRes userSignUpRes = authService.signUp(token, userSignUPReq, image, tag);
return ResponseEntity.status(HttpStatus.CREATED).body(userSignUpRes);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.dateroad.user.service;

import java.util.concurrent.ExecutionException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dateroad.auth.jwt.JwtProvider;
Expand Down Expand Up @@ -32,8 +33,6 @@
import java.io.IOException;
import java.util.List;

import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;

@RequiredArgsConstructor
@Transactional(readOnly = true)
@Service
Expand All @@ -51,13 +50,13 @@ public class AuthService {
private String cachePath;

@Transactional
public UserJwtInfoRes signUp(final String token, final UserSignUpReq userSignUpReq, MultipartFile image, List<DateTagType> tag) throws IOException {
public UserJwtInfoRes signUp(final String token, final UserSignUpReq userSignUpReq, MultipartFile image, List<DateTagType> tag)
throws IOException, ExecutionException, InterruptedException {
String platformUserId = getUserPlatformId(userSignUpReq.platform(), token);
validateUserTagSize(tag);
checkNickname(userSignUpReq.name());
validateDuplicatedUser(userSignUpReq.platform(), platformUserId);

User newUser = saveUser(userSignUpReq.name(), cachePath + s3Service.uploadImage(path, image), userSignUpReq.platform(), platformUserId);
User newUser = saveUser(userSignUpReq.name(), cachePath + s3Service.uploadImage("/user", image).get(), userSignUpReq.platform(), platformUserId);
saveUserTag(newUser, tag);
Token issuedToken = issueToken(newUser.getId());
return UserJwtInfoRes.of(newUser.getId(), issuedToken.accessToken(), issuedToken.refreshToken());
Expand Down

0 comments on commit 65dfd36

Please sign in to comment.