From 206b9bcc0dea8cb697cdf035e9505a9be3104ef4 Mon Sep 17 00:00:00 2001 From: Taeho Date: Sat, 11 Nov 2023 17:59:29 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EB=94=94=EB=B9=84=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=9E=84=EC=8B=9C=20?= =?UTF-8?q?ddl-auto=20create?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linknamu/src/main/resources/application-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linknamu/src/main/resources/application-prod.yml b/linknamu/src/main/resources/application-prod.yml index c49bec51..812a5054 100644 --- a/linknamu/src/main/resources/application-prod.yml +++ b/linknamu/src/main/resources/application-prod.yml @@ -14,7 +14,7 @@ spring: jpa: hibernate: - ddl-auto: update + ddl-auto: create show-sql: false database-platform: org.hibernate.dialect.MySQLDialect properties: From 5f4eaa6828885cd36d33e8e6a1796e6a7c13d97f Mon Sep 17 00:00:00 2001 From: Taeho Date: Sat, 11 Nov 2023 19:03:58 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Convention:=20Naver=20=EC=BB=A8=EB=B2=A4?= =?UTF-8?q?=EC=85=98=20=EB=A7=9E=EC=B6=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BookmarkController.java | 4 +- .../bookmark/dto/BookmarkRequestDto.java | 4 +- .../bookmark/dto/BookmarkResponseDto.java | 2 + .../bookmark/dto/BookmarkSearchCondition.java | 1 + .../bookmark/dto/validator/SearchCheck.java | 4 +- .../dto/validator/SearchCheckValidator.java | 5 +- .../linknamu/bookmark/entity/Bookmark.java | 10 ++-- .../BookmarkCustomRepositoryImpl.java | 2 + .../bookmark/service/BookmarkService.java | 60 ++++++------------- .../BookmarkTagExceptionStatus.java | 1 + .../controller/BookmarkTagController.java | 2 + .../bookmarktag/entity/BookmarkTag.java | 4 +- .../bookmarktag/entity/BookmarkTagId.java | 2 +- .../repository/BookmarkTagJpaRepository.java | 2 +- .../BookmarkTagJpaRepositoryCustom.java | 1 + .../BookmarkTagJpaRepositoryImpl.java | 6 +- .../category/CategoryExceptionStatus.java | 1 + .../controller/CategoryController.java | 2 + .../category/dto/CategoryGetResponseDto.java | 1 + .../repository/CategoryJpaRepository.java | 4 +- .../category/service/CategoryService.java | 17 +++--- .../linknamu/core/config/FilterConfig.java | 1 + .../core/config/GoogleDocsConfig.java | 2 + .../config/HttpConnectionProxyConfig.java | 18 +++--- .../kakao/linknamu/core/config/JpaConfig.java | 1 + .../linknamu/core/config/QueryDslConfig.java | 2 + .../kakao/linknamu/core/config/S3Config.java | 4 +- .../linknamu/core/config/S3ConfigProxy.java | 3 +- .../linknamu/core/config/SchedulerConfig.java | 1 - .../kakao/linknamu/core/dto/PageInfoDto.java | 1 - .../core/encryption/AesEncryption.java | 8 +-- .../core/encryption/EncryptionAlgorithm.java | 3 - .../encryption/EncryptionExceptionStatus.java | 2 +- .../core/exception/ClientException.java | 2 +- .../linknamu/core/exception/Exception400.java | 1 + .../linknamu/core/exception/Exception401.java | 1 + .../linknamu/core/exception/Exception403.java | 1 + .../linknamu/core/exception/Exception404.java | 1 + .../linknamu/core/exception/Exception500.java | 1 + .../linknamu/core/exception/Exception502.java | 1 + .../exception/GlobalExceptionHandler.java | 8 ++- .../core/exception/ServerException.java | 1 + .../linknamu/core/log/LoggingFilter.java | 12 ++-- .../core/redis/RedisExceptionStatus.java | 2 +- .../core/redis/entity/BlackListToken.java | 3 +- .../core/redis/entity/RefreshToken.java | 5 +- .../repository/BlackListTokenRepository.java | 1 + .../repository/RefreshTokenRepository.java | 1 + .../redis/service/BlackListTokenService.java | 2 + .../redis/service/RefreshTokenService.java | 3 +- .../core/security/CustomUserDetails.java | 3 +- .../security/CustomUserDetailsService.java | 2 + .../security/JwtAuthenticationFilter.java | 2 + .../core/security/JwtExceptionFilter.java | 2 + .../linknamu/core/security/JwtProvider.java | 1 + .../core/security/SecurityConfig.java | 3 +- .../linknamu/core/util/AuditingEntity.java | 1 + .../core/util/FilterResponseUtils.java | 2 + .../linknamu/core/util/S3ImageClient.java | 6 +- .../linknamu/kakao/KakaoExceptionStatus.java | 1 + .../controller/KakaoSendMeController.java | 2 + .../kakao/dto/KakaoSendMeResponseDto.java | 1 - .../service/KaKaoSendMeExtractService.java | 3 +- .../share/controller/ShareController.java | 2 + .../category/ShareCategoryService.java | 5 +- .../workspace/ShareWorkspaceService.java | 2 + .../linknamu/tag/TagExceptionStatus.java | 1 + .../com/kakao/linknamu/tag/entity/Tag.java | 4 +- .../tag/repository/TagJpaRepository.java | 3 +- .../linknamu/tag/service/TagService.java | 2 + .../googleDocs/GoogleDocsExceptionStatus.java | 7 ++- .../controller/GoogleDocsController.java | 2 + .../googledocs/entity/GooglePage.java | 4 +- .../repository/GooglePageJpaRepository.java | 1 + .../service/GoogleDocsApiBatchService.java | 2 + .../service/GoogleDocsApiService.java | 5 +- .../googledocs/util/GoogleDocsProvider.java | 2 + .../controller/DevNotionController.java | 1 + .../notion/controller/NotionController.java | 2 + .../notion/entity/NotionAccount.java | 3 +- .../thirdparty/notion/entity/NotionPage.java | 5 +- .../NotionAccountJpaRepository.java | 3 +- .../repository/NotionPageJpaRepository.java | 1 + .../notion/service/NotionApiBatchService.java | 34 ++++++----- .../notion/service/NotionApiService.java | 9 ++- .../notion/util/NotionApiUriBuilder.java | 1 - .../notion/util/NotionProvider.java | 14 +++-- .../linknamu/user/UserExceptionStatus.java | 2 +- .../controller/DevSocialLoginController.java | 3 +- .../controller/GoogleLoginController.java | 2 + .../user/controller/UserController.java | 5 +- .../kakao/linknamu/user/dto/ReissueDto.java | 1 - .../com/kakao/linknamu/user/entity/User.java | 3 +- .../user/entity/constant/Provider.java | 1 - .../linknamu/user/entity/constant/Role.java | 1 - .../user/repository/UserJpaRepository.java | 1 + .../linknamu/user/service/GoogleService.java | 3 +- .../linknamu/user/service/UserService.java | 3 +- .../workspace/WorkspaceExceptionStatus.java | 2 +- .../controller/WorkspaceController.java | 2 + .../dto/WorkspaceGetResponseDto.java | 3 +- .../linknamu/workspace/entity/Workspace.java | 4 +- .../entity/constant/LinkProvider.java | 1 - .../repository/WorkspaceJpaRepository.java | 3 +- .../workspace/service/WorkspaceService.java | 3 +- 105 files changed, 249 insertions(+), 165 deletions(-) diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/controller/BookmarkController.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/controller/BookmarkController.java index 1c307c6b..968d0a73 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/controller/BookmarkController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/controller/BookmarkController.java @@ -3,6 +3,7 @@ import com.kakao.linknamu.bookmark.dto.BookmarkSearchCondition; import com.kakao.linknamu.bookmark.dto.BookmarkSearchResponseDto; import com.kakao.linknamu.bookmark.service.*; + import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; @@ -51,7 +52,8 @@ public ResponseEntity updateBookmark( @PathVariable Long bookmarkId, @AuthenticationPrincipal CustomUserDetails userDetails ) { - BookmarkResponseDto.BookmarkUpdateResponseDto responseDto = bookmarkService.updateBookmark(dto, bookmarkId, userDetails.getUser()); + BookmarkResponseDto.BookmarkUpdateResponseDto responseDto = bookmarkService.updateBookmark(dto, bookmarkId, + userDetails.getUser()); return ResponseEntity.ok(ApiUtils.success(responseDto)); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkRequestDto.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkRequestDto.java index 58585e32..84e2171d 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkRequestDto.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkRequestDto.java @@ -2,6 +2,7 @@ import com.kakao.linknamu.bookmark.entity.Bookmark; import com.kakao.linknamu.category.entity.Category; + import jakarta.validation.constraints.*; import lombok.Builder; import lombok.Getter; @@ -60,7 +61,8 @@ public record BookmarkUpdateRequestDto( public record BookmarkImageUpdateRequestDto( @NotBlank(message = "북마크 링크는 공백이 될 수 없습니다.") String imageUrl - ) {} + ) { + } public record BookmarkMoveRequestDto( List bookmarkIdList, diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkResponseDto.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkResponseDto.java index 042b5649..e571b7f9 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkResponseDto.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkResponseDto.java @@ -23,6 +23,7 @@ public record BookmarkUpdateResponseDto( } } + @SuppressWarnings("checkstyle:RegexpSingleline") public record BookmarkGetResponseDto( Long bookmarkId, String title, @@ -47,6 +48,7 @@ public static BookmarkGetResponseDto of(BookmarkUserQueryDto bookmark, List .createdAt(bookmark.getCreatedAt()) .build(); } + public static BookmarkGetResponseDto of(Bookmark bookmark, List tagList) { return BookmarkGetResponseDto.builder() .bookmarkId(bookmark.getBookmarkId()) diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkSearchCondition.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkSearchCondition.java index 82ebc315..e8745f15 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkSearchCondition.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/BookmarkSearchCondition.java @@ -3,6 +3,7 @@ import java.util.List; import com.kakao.linknamu.bookmark.dto.validator.SearchCheck; + import jakarta.validation.constraints.NotBlank; import lombok.Builder; diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheck.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheck.java index d2b42ee0..0ebd008b 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheck.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheck.java @@ -6,11 +6,13 @@ import java.lang.annotation.*; @Documented -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = SearchCheckValidator.class) public @interface SearchCheck { String message() default "조건에 맞지 않은 필드값입니다."; + Class[] groups() default {}; + Class[] payload() default {}; } diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheckValidator.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheckValidator.java index 8fc0d64d..89dfea95 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheckValidator.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/dto/validator/SearchCheckValidator.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.bookmark.dto.validator; import com.kakao.linknamu.bookmark.dto.BookmarkSearchCondition; + import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidatorContext; @@ -9,9 +10,9 @@ public class SearchCheckValidator implements ConstraintValidator 1024) { + if (bookmarkLink.length() > 1024) { throw new Exception400(BookmarkExceptionStatus.BOOKMARK_LINK_TOO_LONG); } return bookmarkLink; @@ -93,7 +95,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - Bookmark bookmark = (Bookmark) obj; + Bookmark bookmark = (Bookmark)obj; return Objects.equals(getBookmarkId(), bookmark.getBookmarkId()) && Objects.equals(getBookmarkLink(), bookmark.getBookmarkLink()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/repository/BookmarkCustomRepositoryImpl.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/repository/BookmarkCustomRepositoryImpl.java index 595696e1..9753418f 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/repository/BookmarkCustomRepositoryImpl.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/repository/BookmarkCustomRepositoryImpl.java @@ -1,8 +1,10 @@ package com.kakao.linknamu.bookmark.repository; import com.kakao.linknamu.bookmark.entity.Bookmark; + import jakarta.persistence.EntityManager; import lombok.RequiredArgsConstructor; + import org.springframework.jdbc.core.BatchPreparedStatementSetter; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Repository; diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmark/service/BookmarkService.java b/linknamu/src/main/java/com/kakao/linknamu/bookmark/service/BookmarkService.java index b49ec943..3b8c7bc4 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmark/service/BookmarkService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmark/service/BookmarkService.java @@ -16,8 +16,10 @@ import com.kakao.linknamu.tag.entity.Tag; import com.kakao.linknamu.tag.service.TagService; import com.kakao.linknamu.user.entity.User; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -58,15 +60,10 @@ public boolean existByBookmarkLinkAndCategoryId(String bookmarkLink, Long catego public List getRecentBookmark(Pageable pageable, User user) { List bookmarkList = bookmarkJpaRepository.recentBookmarks(pageable, user.getUserId()).toList(); List bookmarkTagList = bookmarkTagJpaRepository.findByBookmarkIdsFetchJoinTag( - bookmarkList - .stream() - .map(Bookmark::getBookmarkId) - .toList() - ); + bookmarkList.stream().map(Bookmark::getBookmarkId).toList()); Map> bookmarkTagListMap = bookmarkTagList.stream() - .collect(groupingBy(BookmarkTag::getBookmark - , Collectors.mapping(BookmarkTag::getTag, toList()))); + .collect(groupingBy(BookmarkTag::getBookmark, Collectors.mapping(BookmarkTag::getTag, toList()))); return bookmarkList.stream() .map(bookmark -> BookmarkResponseDto.BookmarkGetResponseDto.of(bookmark, bookmarkTagListMap.get(bookmark))) @@ -95,14 +92,9 @@ public void addBookmark(Bookmark bookmark, Category newCategory, List tagLi for (String tagName : tagList.stream().map(Tag::getTagName).toList()) { // 해당 태그가 존재하지 않는다면 새롭게 생성한다. Tag tag = tagService.findByTagNameAndUserId(tagName, user) - .orElseGet( - () -> tagService.create(tagName, user) - ); - - bookmarkTagList.add(BookmarkTag.builder() - .bookmark(newBookmark) - .tag(tag) - .build()); + .orElseGet(() -> tagService.create(tagName, user)); + + bookmarkTagList.add(BookmarkTag.builder().bookmark(newBookmark).tag(tag).build()); } bookmarkTagJpaRepository.saveAll(bookmarkTagList); @@ -127,14 +119,9 @@ public void addBookmark(BookmarkRequestDto.BookmarkAddDto bookmarkAddDto, User u for (String tagName : bookmarkAddDto.getTags()) { // 해당 태그가 존재하지 않는다면 새롭게 생성한다. Tag tag = tagService.findByTagNameAndUserId(tagName, user) - .orElseGet( - () -> tagService.create(tagName, user) - ); - - bookmarkTagList.add(BookmarkTag.builder() - .bookmark(bookmark) - .tag(tag) - .build()); + .orElseGet(() -> tagService.create(tagName, user)); + + bookmarkTagList.add(BookmarkTag.builder().bookmark(bookmark).tag(tag).build()); } bookmarkTagJpaRepository.saveAll(bookmarkTagList); @@ -159,18 +146,14 @@ public BookmarkResponseDto.BookmarkGetResponseDto getBookmarkById(Long bookmarkI } @Transactional - public BookmarkResponseDto.BookmarkUpdateResponseDto updateBookmark( - BookmarkRequestDto.BookmarkUpdateRequestDto dto, - Long bookmarkId, - User user - ) { + public BookmarkResponseDto.BookmarkUpdateResponseDto updateBookmark(BookmarkRequestDto.BookmarkUpdateRequestDto dto, + Long bookmarkId, User user) { Bookmark bookmark = bookmarkJpaRepository.findByIdFetchJoinCategoryAndWorkspace(bookmarkId) .orElseThrow(() -> new Exception404(BookmarkExceptionStatus.BOOKMARK_NOT_FOUND)); validUser(bookmark, user); bookmarkJpaRepository.updateBookmark(bookmarkId, dto.bookmarkName(), dto.description()); - List tags = bookmarkTagJpaRepository.findTagNamesByBookmarkId(bookmarkId); return BookmarkResponseDto.BookmarkUpdateResponseDto.builder() @@ -184,11 +167,7 @@ public BookmarkResponseDto.BookmarkUpdateResponseDto updateBookmark( } @Transactional - public void bookmarkImageUpdate( - BookmarkRequestDto.BookmarkImageUpdateRequestDto dto, - Long bookmarkId, - User user - ) { + public void bookmarkImageUpdate(BookmarkRequestDto.BookmarkImageUpdateRequestDto dto, Long bookmarkId, User user) { Bookmark bookmark = bookmarkJpaRepository.findByIdFetchJoinCategoryAndWorkspace(bookmarkId) .orElseThrow(() -> new Exception404(BookmarkExceptionStatus.BOOKMARK_NOT_FOUND)); @@ -216,8 +195,9 @@ public void moveBookmark(BookmarkRequestDto.BookmarkMoveRequestDto dto, User use for (Bookmark bookmark : requestedBookmarks) { validUser(bookmark, user); // 만약 같은 카테고리로 이동한다면 중복 검사를 할 필요가 없다. - if(!isMoveSameCategory(bookmark.getCategory(), toCategory)) + if (!isMoveSameCategory(bookmark.getCategory(), toCategory)) { validDuplicatedLink(toCategory, bookmark.getBookmarkLink()); + } examineSet.add(bookmark.getBookmarkId()); } @@ -239,8 +219,7 @@ public BookmarkSearchResponseDto searchBookmark(BookmarkSearchCondition conditio } public void validUser(Bookmark bookmark, User user) { - if (!bookmark.getCategory().getWorkspace().getUser().getUserId() - .equals(user.getUserId())) { + if (!bookmark.getCategory().getWorkspace().getUser().getUserId().equals(user.getUserId())) { throw new Exception403(BookmarkExceptionStatus.BOOKMARK_FORBIDDEN); } } @@ -259,10 +238,9 @@ private void validExistRequest(Set examineSet, Set requestedSet) { } private void validDuplicatedLink(Category category, String bookmarkLink) { - bookmarkJpaRepository.findByCategoryIdAndBookmarkLink(category.getCategoryId(), bookmarkLink) - .ifPresent((b) -> { - throw new Exception400(BookmarkExceptionStatus.BOOKMARK_ALREADY_EXISTS); - }); + bookmarkJpaRepository.findByCategoryIdAndBookmarkLink(category.getCategoryId(), bookmarkLink).ifPresent((b) -> { + throw new Exception400(BookmarkExceptionStatus.BOOKMARK_ALREADY_EXISTS); + }); } private List getBookmarkContentDtos(Page bookmarks) { diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/BookmarkTagExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/BookmarkTagExceptionStatus.java index c78f5eeb..29af02c8 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/BookmarkTagExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/BookmarkTagExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.bookmarktag; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/controller/BookmarkTagController.java b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/controller/BookmarkTagController.java index 7d1f914f..60f21787 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/controller/BookmarkTagController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/controller/BookmarkTagController.java @@ -5,7 +5,9 @@ import com.kakao.linknamu.bookmarktag.service.BookmarkTagService; import com.kakao.linknamu.core.security.CustomUserDetails; import com.kakao.linknamu.core.util.ApiUtils; + import lombok.RequiredArgsConstructor; + import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTag.java b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTag.java index e8455469..f13c9359 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTag.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTag.java @@ -3,10 +3,12 @@ import com.kakao.linknamu.bookmark.entity.Bookmark; import com.kakao.linknamu.core.util.AuditingEntity; import com.kakao.linknamu.tag.entity.Tag; + import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; + import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; @@ -47,7 +49,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - BookmarkTag that = (BookmarkTag) obj; + BookmarkTag that = (BookmarkTag)obj; return Objects.equals(bookmarkTagId, that.bookmarkTagId); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTagId.java b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTagId.java index 831a26b9..2ba7c697 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTagId.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/entity/BookmarkTagId.java @@ -25,7 +25,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - BookmarkTagId that = (BookmarkTagId) obj; + BookmarkTagId that = (BookmarkTagId)obj; return Objects.equals(bookmarkId, that.bookmarkId) && Objects.equals(tagId, that.tagId); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepository.java index 91586522..b7b909f8 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepository.java @@ -29,5 +29,5 @@ public interface BookmarkTagJpaRepository Optional findByIdFetchJoinTag(@Param("bookmarkTagId") BookmarkTagId bookmarkTagId); @Query("select bt from BookmarkTag bt join fetch bt.tag t where bt.bookmark.bookmarkId in :bookmarkIdList") - List findByBookmarkIdsFetchJoinTag(@Param("bookmarkIdList") List BookmarkIdList); + List findByBookmarkIdsFetchJoinTag(@Param("bookmarkIdList") List bookmarkIdList); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryCustom.java b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryCustom.java index 24bf7e20..a8dfbffd 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryCustom.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryCustom.java @@ -2,6 +2,7 @@ import com.kakao.linknamu.bookmark.dto.BookmarkSearchCondition; import com.kakao.linknamu.bookmark.entity.Bookmark; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryImpl.java b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryImpl.java index 602fe6f5..0957140b 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryImpl.java +++ b/linknamu/src/main/java/com/kakao/linknamu/bookmarktag/repository/BookmarkTagJpaRepositoryImpl.java @@ -5,7 +5,9 @@ import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; + import lombok.RequiredArgsConstructor; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.support.PageableExecutionUtils; @@ -19,12 +21,10 @@ import static java.util.Objects.isNull; import static org.springframework.util.StringUtils.hasText; - @Repository @RequiredArgsConstructor public class BookmarkTagJpaRepositoryImpl implements BookmarkTagJpaRepositoryCustom { - private final JPAQueryFactory queryFactory; @Override @@ -43,7 +43,7 @@ public Page search(BookmarkSearchCondition condition, Long userId, Pag bookmarkTag.tag.tagName.in(condition.tags()) ) .groupBy(bookmarkTag.bookmark.bookmarkId) - .having(bookmarkTag.tag.count().eq((long) condition.tags().size())) + .having(bookmarkTag.tag.count().eq((long)condition.tags().size())) .orderBy(bookmark.createdAt.desc()); // 페이징을 위해 offset, limit을 검색쿼리에 추가한다. diff --git a/linknamu/src/main/java/com/kakao/linknamu/category/CategoryExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/category/CategoryExceptionStatus.java index 2c5ee545..10df7799 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/category/CategoryExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/category/CategoryExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.category; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/linknamu/src/main/java/com/kakao/linknamu/category/controller/CategoryController.java b/linknamu/src/main/java/com/kakao/linknamu/category/controller/CategoryController.java index 1cd4bcff..b6b9a74f 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/category/controller/CategoryController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/category/controller/CategoryController.java @@ -6,8 +6,10 @@ import com.kakao.linknamu.category.service.*; import com.kakao.linknamu.core.security.CustomUserDetails; import com.kakao.linknamu.core.util.ApiUtils; + import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; + import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; diff --git a/linknamu/src/main/java/com/kakao/linknamu/category/dto/CategoryGetResponseDto.java b/linknamu/src/main/java/com/kakao/linknamu/category/dto/CategoryGetResponseDto.java index 077c8cb3..4e3f46d8 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/category/dto/CategoryGetResponseDto.java +++ b/linknamu/src/main/java/com/kakao/linknamu/category/dto/CategoryGetResponseDto.java @@ -3,6 +3,7 @@ import com.kakao.linknamu.bookmark.entity.Bookmark; import com.kakao.linknamu.core.dto.PageInfoDto; import com.kakao.linknamu.tag.entity.Tag; + import lombok.Builder; import java.time.LocalDateTime; diff --git a/linknamu/src/main/java/com/kakao/linknamu/category/repository/CategoryJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/category/repository/CategoryJpaRepository.java index 24f6c7ba..d3737f87 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/category/repository/CategoryJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/category/repository/CategoryJpaRepository.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.category.repository; import com.kakao.linknamu.category.entity.Category; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -10,7 +11,8 @@ public interface CategoryJpaRepository extends JpaRepository { @Query("select c from Category c where c.workspace.id = :workspaceId and c.categoryName = :categoryName") - Optional findByWorkspaceIdAndCategoryName(@Param("workspaceId") Long workspaceId, @Param("categoryName") String categoryName); + Optional findByWorkspaceIdAndCategoryName(@Param("workspaceId") Long workspaceId, + @Param("categoryName") String categoryName); @Query("select c from Category c " + "join fetch c.workspace w " diff --git a/linknamu/src/main/java/com/kakao/linknamu/category/service/CategoryService.java b/linknamu/src/main/java/com/kakao/linknamu/category/service/CategoryService.java index 3e15262f..ea8ae211 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/category/service/CategoryService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/category/service/CategoryService.java @@ -14,6 +14,7 @@ import com.kakao.linknamu.core.exception.Exception400; import com.kakao.linknamu.tag.entity.Tag; import com.kakao.linknamu.workspace.service.WorkspaceService; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -27,6 +28,7 @@ import com.kakao.linknamu.workspace.entity.Workspace; import lombok.RequiredArgsConstructor; + import org.springframework.transaction.annotation.Transactional; @Service @@ -35,7 +37,7 @@ public class CategoryService { private final BookmarkJpaRepository bookmarkJpaRepository; - private final CategoryJpaRepository categoryJPARepository; + private final CategoryJpaRepository categoryJpaRepository; private final BookmarkTagJpaRepository bookmarkTagJpaRepository; private final WorkspaceService workspaceService; @@ -47,23 +49,23 @@ public Category save(String categoryName, Workspace workspace) { .build(); validDuplicatedCategoryName(workspace.getId(), categoryName); - return categoryJPARepository.save(category); + return categoryJpaRepository.save(category); } public Category findByIdFetchJoinWorkspace(Long id) { - return categoryJPARepository.findByIdFetchJoinWorkspace(id).orElseThrow( + return categoryJpaRepository.findByIdFetchJoinWorkspace(id).orElseThrow( () -> new Exception404(CategoryExceptionStatus.CATEGORY_NOT_FOUND) ); } public Category findById(Long id) { - return categoryJPARepository.findById(id).orElseThrow( + return categoryJpaRepository.findById(id).orElseThrow( () -> new Exception404(CategoryExceptionStatus.CATEGORY_NOT_FOUND) ); } public Optional findByWorkspaceIdAndCategoryName(Long workspaceId, String categoryName) { - return categoryJPARepository.findByWorkspaceIdAndCategoryName(workspaceId, categoryName); + return categoryJpaRepository.findByWorkspaceIdAndCategoryName(workspaceId, categoryName); } @Transactional @@ -99,10 +101,9 @@ public void update(CategoryUpdateRequestDto requestDto, Long categoryId, User us public void delete(Long categoryId, User user) { Category category = findByIdFetchJoinWorkspace(categoryId); validUser(category, user); - categoryJPARepository.deleteById(categoryId); + categoryJpaRepository.deleteById(categoryId); } - public void validUser(Category category, User user) { if (!category.getWorkspace().getUser().getUserId().equals(user.getUserId())) { throw new Exception403(CategoryExceptionStatus.CATEGORY_FORBIDDEN); @@ -110,7 +111,7 @@ public void validUser(Category category, User user) { } private void validDuplicatedCategoryName(Long workspaceId, String categoryName) { - categoryJPARepository.findByWorkspaceIdAndCategoryName(workspaceId, categoryName) + categoryJpaRepository.findByWorkspaceIdAndCategoryName(workspaceId, categoryName) .ifPresent((c) -> { throw new Exception400(CategoryExceptionStatus.CATEGORY_ALREADY_EXISTS); }); diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/FilterConfig.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/FilterConfig.java index 88abac9b..ec95f4e1 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/FilterConfig.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/FilterConfig.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.config; import com.kakao.linknamu.core.log.LoggingFilter; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/GoogleDocsConfig.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/GoogleDocsConfig.java index e8b8f955..b9b409bf 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/GoogleDocsConfig.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/GoogleDocsConfig.java @@ -10,7 +10,9 @@ import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.util.store.FileDataStoreFactory; import com.google.api.services.docs.v1.DocsScopes; + import lombok.Getter; + import org.springframework.context.annotation.Configuration; import java.io.*; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/HttpConnectionProxyConfig.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/HttpConnectionProxyConfig.java index f1632a8e..52b2fc05 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/HttpConnectionProxyConfig.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/HttpConnectionProxyConfig.java @@ -15,13 +15,13 @@ public class HttpConnectionProxyConfig { private static final String PROXY_HOST = "krmp-proxy.9rum.cc"; private static final int PROXY_PORT = 3128; - @Bean - public RestTemplate restTemplateWithProxy() { - SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); - Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_HOST, PROXY_PORT)); - requestFactory.setProxy(proxy); - requestFactory.setConnectTimeout(5000); - requestFactory.setReadTimeout(5000); - return new RestTemplate(requestFactory); - } + @Bean + public RestTemplate restTemplateWithProxy() { + SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); + Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_HOST, PROXY_PORT)); + requestFactory.setProxy(proxy); + requestFactory.setConnectTimeout(5000); + requestFactory.setReadTimeout(5000); + return new RestTemplate(requestFactory); + } } diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/JpaConfig.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/JpaConfig.java index 9ef6524f..20b263bd 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/JpaConfig.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/JpaConfig.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.config; import com.kakao.linknamu.core.security.CustomUserDetails; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.domain.AuditorAware; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/QueryDslConfig.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/QueryDslConfig.java index df66128e..56460600 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/QueryDslConfig.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/QueryDslConfig.java @@ -1,8 +1,10 @@ package com.kakao.linknamu.core.config; import com.querydsl.jpa.impl.JPAQueryFactory; + import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/S3Config.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/S3Config.java index a6e8528f..4f10ea87 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/S3Config.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/S3Config.java @@ -4,12 +4,12 @@ import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.AmazonS3ClientBuilder; + import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; - @Profile({"test", "local", "stage"}) @Configuration public class S3Config { @@ -27,7 +27,7 @@ public class S3Config { public AmazonS3Client amazonS3Client() { BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); - return (AmazonS3Client) AmazonS3ClientBuilder + return (AmazonS3Client)AmazonS3ClientBuilder .standard() .withRegion(region) .withCredentials(new AWSStaticCredentialsProvider(credentials)) diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/S3ConfigProxy.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/S3ConfigProxy.java index f96f11a9..8737b474 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/S3ConfigProxy.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/S3ConfigProxy.java @@ -5,6 +5,7 @@ import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.AmazonS3ClientBuilder; + import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -26,7 +27,7 @@ public class S3ConfigProxy { @Bean public AmazonS3Client amazonS3Client() { BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey); - return (AmazonS3Client) AmazonS3ClientBuilder.standard() + return (AmazonS3Client)AmazonS3ClientBuilder.standard() .withRegion(region) .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)) .withClientConfiguration(clientConfiguration()) diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/config/SchedulerConfig.java b/linknamu/src/main/java/com/kakao/linknamu/core/config/SchedulerConfig.java index d54b8475..bd657e47 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/config/SchedulerConfig.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/config/SchedulerConfig.java @@ -3,7 +3,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; - @EnableScheduling @Configuration public class SchedulerConfig { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/dto/PageInfoDto.java b/linknamu/src/main/java/com/kakao/linknamu/core/dto/PageInfoDto.java index f3cae195..afcabb0e 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/dto/PageInfoDto.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/dto/PageInfoDto.java @@ -18,5 +18,4 @@ public PageInfoDto(Page page) { ); } - } diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/encryption/AesEncryption.java b/linknamu/src/main/java/com/kakao/linknamu/core/encryption/AesEncryption.java index 6be8236d..5f0bd23c 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/encryption/AesEncryption.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/encryption/AesEncryption.java @@ -2,19 +2,21 @@ import com.kakao.linknamu.core.exception.Exception400; import com.kakao.linknamu.core.exception.Exception500; + import lombok.extern.slf4j.Slf4j; + import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.crypto.Cipher; import javax.crypto.spec.GCMParameterSpec; import javax.crypto.spec.SecretKeySpec; + import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.SecureRandom; import java.util.Base64; - @Slf4j @Component public class AesEncryption { @@ -22,7 +24,6 @@ public class AesEncryption { @Value("${AES_SECRET_KEY}") private String secretKey; - private static final String ALGORITHM = EncryptionAlgorithm.AES.getAlgorithm(); private static final String MAIN_ALGORITHM = EncryptionAlgorithm.AES.getMainAlgorithm(); private static final int GCM_IV_BYTE = EncryptionAlgorithm.AES.getIvByteLength(); @@ -51,7 +52,6 @@ public String encode(String plainString) { + Base64.getEncoder().encodeToString(encryptedWorkSpaceIdBytes); return encodedBase64.replaceAll("/", "-"); - } catch (InvalidKeyException e) { throw new Exception400(EncryptionExceptionStatus.ENCRYPTION_INVALID_KEY); } catch (Exception e) { @@ -60,7 +60,6 @@ public String encode(String plainString) { } } - public String decode(String encodedString) { try { byte[] keyBytes = secretKey.getBytes(StandardCharsets.UTF_8); @@ -89,5 +88,4 @@ public String decode(String encodedString) { } } - } diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionAlgorithm.java b/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionAlgorithm.java index 85cf9541..066f38bd 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionAlgorithm.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionAlgorithm.java @@ -1,6 +1,5 @@ package com.kakao.linknamu.core.encryption; - import lombok.AllArgsConstructor; import lombok.Getter; @@ -9,11 +8,9 @@ public enum EncryptionAlgorithm { AES("AES/GCM/NoPadding", "AES", 12, 16 * 8); - private final String algorithm; private final String mainAlgorithm; private final int ivByteLength; private final int tagBitLength; - } diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionExceptionStatus.java index 0292f91b..0bf5fbc0 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/encryption/EncryptionExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.encryption; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -10,7 +11,6 @@ public enum EncryptionExceptionStatus implements BaseExceptionStatus { ENCRYPTION_INVALID_KEY("유효하지 않은 암호키 입니다.", 400, "94000"), ENCRYPTION_SERVER_ERROR("서버에서 에러가 발생했습니다.", 500, "95000"); - private final String message; private final int status; private final String errorCode; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/ClientException.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/ClientException.java index 16e74065..5b8a57a5 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/ClientException.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/ClientException.java @@ -1,11 +1,11 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; public abstract class ClientException extends RuntimeException { - public ClientException(String message) { super(message); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception400.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception400.java index 7439e11f..14461555 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception400.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception400.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; public class Exception400 extends ClientException { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception401.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception401.java index 660577e6..411c14a1 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception401.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception401.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; public class Exception401 extends ClientException { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception403.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception403.java index 99b0de8d..b22d0485 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception403.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception403.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; public class Exception403 extends ClientException { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception404.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception404.java index fead6ec9..41296bce 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception404.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception404.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; public class Exception404 extends ClientException { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception500.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception500.java index 933462f7..8689e934 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception500.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception500.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; public class Exception500 extends ServerException { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception502.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception502.java index 7b424ddf..7475e857 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception502.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/Exception502.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; //Bad Gateway에러 시 사용 diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/GlobalExceptionHandler.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/GlobalExceptionHandler.java index 3cde1b9f..713099fa 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/GlobalExceptionHandler.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/GlobalExceptionHandler.java @@ -1,9 +1,11 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import jakarta.validation.ConstraintViolationException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; @@ -22,7 +24,6 @@ public class GlobalExceptionHandler { - @ExceptionHandler({ConstraintViolationException.class}) public ResponseEntity pathVarValidationException(ConstraintViolationException exception) { ApiUtils.ApiResult apiResult = ApiUtils.error(exception.getMessage(), @@ -68,9 +69,10 @@ public ResponseEntity serverException(ServerException exception) { } @ExceptionHandler({Exception.class}) - public ResponseEntity unknownServerError(Exception e) { + public ResponseEntity unknownServerError(Exception exception) { - String errorText = String.format("Location: %s, Cause: %s", e.getStackTrace()[0].toString(), e.getMessage()); + String errorText = String.format("Location: %s, Cause: %s", exception.getStackTrace()[0].toString(), + exception.getMessage()); log.error(errorText); return new ResponseEntity<>( diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/exception/ServerException.java b/linknamu/src/main/java/com/kakao/linknamu/core/exception/ServerException.java index 376073df..d7c73fdd 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/exception/ServerException.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/exception/ServerException.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.exception; import com.kakao.linknamu.core.util.ApiUtils; + import org.springframework.http.HttpStatus; public abstract class ServerException extends RuntimeException { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/log/LoggingFilter.java b/linknamu/src/main/java/com/kakao/linknamu/core/log/LoggingFilter.java index 30356cac..05f1e5ba 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/log/LoggingFilter.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/log/LoggingFilter.java @@ -5,6 +5,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; + import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -22,8 +23,8 @@ public class LoggingFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletRequest httpRequest = (HttpServletRequest) request; - HttpServletResponse httpResponse = (HttpServletResponse) response; + HttpServletRequest httpRequest = (HttpServletRequest)request; + HttpServletResponse httpResponse = (HttpServletResponse)response; ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(httpRequest); chain.doFilter(requestWrapper, response); @@ -54,12 +55,13 @@ private String getRequestBody(ContentCachingRequestWrapper request) { private String exceptImageUrl(String strJson) { try { JSONParser jsonParser = new JSONParser(); - JSONObject obj = (JSONObject) jsonParser.parse(strJson); + JSONObject obj = (JSONObject)jsonParser.parse(strJson); if (obj.get("imageUrl") != null) { - try{ + try { Base64.getDecoder().decode(obj.get("imageUrl").toString()); obj.remove("imageUrl"); - } catch (IllegalArgumentException ignored) {} + } catch (IllegalArgumentException ignored) { + } } return obj.toString(); } catch (ParseException e) { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/redis/RedisExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/core/redis/RedisExceptionStatus.java index a65f4850..416fb5b3 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/redis/RedisExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/redis/RedisExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.redis; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -9,7 +10,6 @@ public enum RedisExceptionStatus implements BaseExceptionStatus { REFRESH_TOKEN_NOT_FOUND("존재하지 않는 Refresh토큰입니다.", 404, "04040"), BLACKLIST_TOKEN("블랙리스트에 존재하는 토큰입니다.", 403, "04031"); - @Getter private final String message; @Getter diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/BlackListToken.java b/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/BlackListToken.java index 3a8edf4f..f300d4d2 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/BlackListToken.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/BlackListToken.java @@ -2,6 +2,7 @@ import lombok.Builder; import lombok.Getter; + import org.springframework.data.annotation.Id; import org.springframework.data.redis.core.RedisHash; import org.springframework.data.redis.core.TimeToLive; @@ -33,7 +34,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - BlackListToken that = (BlackListToken) obj; + BlackListToken that = (BlackListToken)obj; return Objects.equals(getAccessToken(), that.getAccessToken()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/RefreshToken.java b/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/RefreshToken.java index cf39fe5d..7a192bfe 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/RefreshToken.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/redis/entity/RefreshToken.java @@ -2,8 +2,10 @@ import com.kakao.linknamu.core.security.JwtProvider; import com.kakao.linknamu.user.entity.User; + import lombok.Builder; import lombok.Getter; + import org.springframework.data.annotation.Id; import org.springframework.data.redis.core.RedisHash; import org.springframework.data.redis.core.TimeToLive; @@ -21,7 +23,6 @@ public class RefreshToken { private Long userId; - private String email; @Indexed @@ -55,7 +56,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - RefreshToken that = (RefreshToken) obj; + RefreshToken that = (RefreshToken)obj; return Objects.equals(getRefreshToken(), that.getRefreshToken()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/BlackListTokenRepository.java b/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/BlackListTokenRepository.java index 5f859d25..be3c523d 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/BlackListTokenRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/BlackListTokenRepository.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.redis.repository; import com.kakao.linknamu.core.redis.entity.BlackListToken; + import org.springframework.data.repository.CrudRepository; import java.util.Optional; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/RefreshTokenRepository.java b/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/RefreshTokenRepository.java index 83b1c7cf..c815e367 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/RefreshTokenRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/redis/repository/RefreshTokenRepository.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.core.redis.repository; import com.kakao.linknamu.core.redis.entity.RefreshToken; + import org.springframework.data.repository.CrudRepository; import java.util.Optional; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/BlackListTokenService.java b/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/BlackListTokenService.java index c069a5e9..2992d6bb 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/BlackListTokenService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/BlackListTokenService.java @@ -5,7 +5,9 @@ import com.kakao.linknamu.core.redis.entity.BlackListToken; import com.kakao.linknamu.core.redis.repository.BlackListTokenRepository; import com.kakao.linknamu.core.security.JwtProvider; + import lombok.RequiredArgsConstructor; + import org.springframework.stereotype.Service; @Service diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/RefreshTokenService.java b/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/RefreshTokenService.java index 9f4140d5..5ef4a7c2 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/RefreshTokenService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/redis/service/RefreshTokenService.java @@ -5,14 +5,15 @@ import com.kakao.linknamu.core.redis.entity.RefreshToken; import com.kakao.linknamu.core.redis.repository.RefreshTokenRepository; import com.kakao.linknamu.user.entity.User; + import lombok.RequiredArgsConstructor; + import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor public class RefreshTokenService { - private final RefreshTokenRepository refreshTokenRepository; public void save(String refreshToken, String accessToken, User user) { diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetails.java b/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetails.java index f2f6d8a0..190970f1 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetails.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetails.java @@ -1,8 +1,10 @@ package com.kakao.linknamu.core.security; import com.kakao.linknamu.user.entity.User; + import lombok.Getter; import lombok.RequiredArgsConstructor; + import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @@ -17,7 +19,6 @@ public class CustomUserDetails implements UserDetails { private final User user; - @Override public Collection getAuthorities() { return Arrays.stream(user.getRole().name().split(",")) diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetailsService.java b/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetailsService.java index 57bb3b60..3c025543 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetailsService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/security/CustomUserDetailsService.java @@ -3,7 +3,9 @@ import com.kakao.linknamu.core.exception.Exception404; import com.kakao.linknamu.user.UserExceptionStatus; import com.kakao.linknamu.user.repository.UserJpaRepository; + import lombok.RequiredArgsConstructor; + import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtAuthenticationFilter.java b/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtAuthenticationFilter.java index 19df93fa..a5fe34d8 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtAuthenticationFilter.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtAuthenticationFilter.java @@ -8,11 +8,13 @@ import com.kakao.linknamu.core.redis.service.BlackListTokenService; import com.kakao.linknamu.user.entity.User; import com.kakao.linknamu.user.entity.constant.Role; + import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; + import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtExceptionFilter.java b/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtExceptionFilter.java index ac1eab22..0bc30e3e 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtExceptionFilter.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtExceptionFilter.java @@ -5,10 +5,12 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.kakao.linknamu.core.exception.Exception403; import com.kakao.linknamu.core.util.ApiUtils; + import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; + import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtProvider.java b/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtProvider.java index 69bd9a74..fada7c4c 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtProvider.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/security/JwtProvider.java @@ -6,6 +6,7 @@ import com.auth0.jwt.exceptions.TokenExpiredException; import com.auth0.jwt.interfaces.DecodedJWT; import com.kakao.linknamu.user.entity.User; + import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/security/SecurityConfig.java b/linknamu/src/main/java/com/kakao/linknamu/core/security/SecurityConfig.java index 4b0febae..0272694f 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/security/SecurityConfig.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/security/SecurityConfig.java @@ -4,7 +4,9 @@ import com.kakao.linknamu.core.exception.Exception403; import com.kakao.linknamu.core.redis.service.BlackListTokenService; import com.kakao.linknamu.core.util.FilterResponseUtils; + import lombok.RequiredArgsConstructor; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; @@ -24,7 +26,6 @@ @RequiredArgsConstructor public class SecurityConfig { - private final BlackListTokenService blackListTokenService; @Bean diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/util/AuditingEntity.java b/linknamu/src/main/java/com/kakao/linknamu/core/util/AuditingEntity.java index ed0c78ff..058c233d 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/util/AuditingEntity.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/util/AuditingEntity.java @@ -5,6 +5,7 @@ import jakarta.persistence.MappedSuperclass; import lombok.Getter; import lombok.ToString; + import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/util/FilterResponseUtils.java b/linknamu/src/main/java/com/kakao/linknamu/core/util/FilterResponseUtils.java index f5bb43a4..5e6b7f36 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/util/FilterResponseUtils.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/util/FilterResponseUtils.java @@ -3,7 +3,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.kakao.linknamu.core.exception.Exception401; import com.kakao.linknamu.core.exception.Exception403; + import jakarta.servlet.http.HttpServletResponse; + import org.springframework.http.MediaType; import java.io.IOException; diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java b/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java index d35b62ae..1c5579bf 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java @@ -5,11 +5,14 @@ import com.amazonaws.services.s3.model.PutObjectRequest; import com.kakao.linknamu.core.exception.Exception400; import com.kakao.linknamu.thirdparty.utils.JsoupUtils; + import lombok.RequiredArgsConstructor; + import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.imageio.ImageIO; + import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -62,7 +65,6 @@ public String base64ImageToS3(String base64Data, String bookmarkLink) { private ByteArrayInputStream getValidImageInputStream(byte[] byteImage) { - ByteArrayInputStream imageInputStream = new ByteArrayInputStream(byteImage); try { @@ -81,10 +83,8 @@ private ByteArrayInputStream getValidImageInputStream(byte[] byteImage) { return imageInputStream; } - private Boolean getValidImageUrl(String imgUrlString) { - try { URL imgUrl = new URL(imgUrlString); diff --git a/linknamu/src/main/java/com/kakao/linknamu/kakao/KakaoExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/kakao/KakaoExceptionStatus.java index cf2ec8ed..2065b713 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/kakao/KakaoExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/kakao/KakaoExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.kakao; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/linknamu/src/main/java/com/kakao/linknamu/kakao/controller/KakaoSendMeController.java b/linknamu/src/main/java/com/kakao/linknamu/kakao/controller/KakaoSendMeController.java index 9ceba20e..7e33386e 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/kakao/controller/KakaoSendMeController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/kakao/controller/KakaoSendMeController.java @@ -3,7 +3,9 @@ import com.kakao.linknamu.core.util.ApiUtils; import com.kakao.linknamu.kakao.dto.KakaoSendMeResponseDto; import com.kakao.linknamu.kakao.service.KaKaoSendMeExtractService; + import lombok.RequiredArgsConstructor; + import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/linknamu/src/main/java/com/kakao/linknamu/kakao/dto/KakaoSendMeResponseDto.java b/linknamu/src/main/java/com/kakao/linknamu/kakao/dto/KakaoSendMeResponseDto.java index 4eb2a00a..879a194c 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/kakao/dto/KakaoSendMeResponseDto.java +++ b/linknamu/src/main/java/com/kakao/linknamu/kakao/dto/KakaoSendMeResponseDto.java @@ -7,5 +7,4 @@ public record KakaoSendMeResponseDto( ) { - } diff --git a/linknamu/src/main/java/com/kakao/linknamu/kakao/service/KaKaoSendMeExtractService.java b/linknamu/src/main/java/com/kakao/linknamu/kakao/service/KaKaoSendMeExtractService.java index 662f34f8..043f7170 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/kakao/service/KaKaoSendMeExtractService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/kakao/service/KaKaoSendMeExtractService.java @@ -6,7 +6,9 @@ import com.kakao.linknamu.kakao.dto.KakaoSendMeResponseDto; import com.kakao.linknamu.thirdparty.utils.JsoupResult; import com.kakao.linknamu.thirdparty.utils.JsoupUtils; + import lombok.RequiredArgsConstructor; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -69,7 +71,6 @@ public List extractLink(MultipartFile multipartFile) { ); }); - return responseDtos; } catch (IOException e) { throw new Exception500(KakaoExceptionStatus.FILE_READ_FAILED); diff --git a/linknamu/src/main/java/com/kakao/linknamu/share/controller/ShareController.java b/linknamu/src/main/java/com/kakao/linknamu/share/controller/ShareController.java index 76f92c9f..b5c0d77e 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/share/controller/ShareController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/share/controller/ShareController.java @@ -7,8 +7,10 @@ import com.kakao.linknamu.share.dto.workspace.GetWorkSpaceFromLinkResponseDto; import com.kakao.linknamu.share.service.category.ShareCategoryService; import com.kakao.linknamu.share.service.workspace.ShareWorkspaceService; + import jakarta.validation.constraints.Positive; import lombok.RequiredArgsConstructor; + import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; diff --git a/linknamu/src/main/java/com/kakao/linknamu/share/service/category/ShareCategoryService.java b/linknamu/src/main/java/com/kakao/linknamu/share/service/category/ShareCategoryService.java index 8805254f..e34f7f66 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/share/service/category/ShareCategoryService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/share/service/category/ShareCategoryService.java @@ -16,7 +16,9 @@ import com.kakao.linknamu.user.entity.User; import com.kakao.linknamu.workspace.entity.Workspace; import com.kakao.linknamu.workspace.service.WorkspaceService; + import lombok.RequiredArgsConstructor; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -53,7 +55,8 @@ public GetCategoryFromLinkResponseDto getCategory(String encodedCategoryId, Page List tags = bookmarkTagService.findTagByBookmarkId(bookmark.getBookmarkId()); tagListList.add(tags); } - return new GetCategoryFromLinkResponseDto(new PageInfoDto(bookmarkPage), category, bookmarkPage.getContent(), tagListList); + return new GetCategoryFromLinkResponseDto(new PageInfoDto(bookmarkPage), category, bookmarkPage.getContent(), + tagListList); } @Transactional diff --git a/linknamu/src/main/java/com/kakao/linknamu/share/service/workspace/ShareWorkspaceService.java b/linknamu/src/main/java/com/kakao/linknamu/share/service/workspace/ShareWorkspaceService.java index 8689b07a..9da9e87c 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/share/service/workspace/ShareWorkspaceService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/share/service/workspace/ShareWorkspaceService.java @@ -13,8 +13,10 @@ import com.kakao.linknamu.workspace.WorkspaceExceptionStatus; import com.kakao.linknamu.workspace.entity.Workspace; import com.kakao.linknamu.workspace.service.WorkspaceService; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/linknamu/src/main/java/com/kakao/linknamu/tag/TagExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/tag/TagExceptionStatus.java index cd649bf5..088ee63d 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/tag/TagExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/tag/TagExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.tag; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/linknamu/src/main/java/com/kakao/linknamu/tag/entity/Tag.java b/linknamu/src/main/java/com/kakao/linknamu/tag/entity/Tag.java index 54b9f1da..d5582115 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/tag/entity/Tag.java +++ b/linknamu/src/main/java/com/kakao/linknamu/tag/entity/Tag.java @@ -2,10 +2,12 @@ import com.kakao.linknamu.core.util.AuditingEntity; import com.kakao.linknamu.user.entity.User; + import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; + import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; @@ -54,7 +56,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - Tag tag = (Tag) obj; + Tag tag = (Tag)obj; return Objects.equals(tagId, tag.tagId); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/tag/repository/TagJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/tag/repository/TagJpaRepository.java index cd68310f..6b4d3569 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/tag/repository/TagJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/tag/repository/TagJpaRepository.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.tag.repository; import com.kakao.linknamu.tag.entity.Tag; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -12,11 +13,9 @@ public interface TagJpaRepository extends JpaRepository { @Query("select t from Tag t where t.tagName = :tagName") Optional findByName(@Param("tagName") String tagName); - @Query("select t.tagName from Tag t where t.tagId = :tagId") String findNameById(@Param("tagId") Long tagId); - @Query("select t.tagId from Tag t where t.tagName = :tagName") List findIdsByName(@Param("tagName") String name); diff --git a/linknamu/src/main/java/com/kakao/linknamu/tag/service/TagService.java b/linknamu/src/main/java/com/kakao/linknamu/tag/service/TagService.java index ee05c925..82b01995 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/tag/service/TagService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/tag/service/TagService.java @@ -3,7 +3,9 @@ import com.kakao.linknamu.tag.entity.Tag; import com.kakao.linknamu.tag.repository.TagJpaRepository; import com.kakao.linknamu.user.entity.User; + import lombok.RequiredArgsConstructor; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googleDocs/GoogleDocsExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googleDocs/GoogleDocsExceptionStatus.java index 986123b0..0233f71e 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googleDocs/GoogleDocsExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googleDocs/GoogleDocsExceptionStatus.java @@ -1,17 +1,18 @@ package com.kakao.linknamu.thirdparty.googledocs; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public enum GoogleDocsExceptionStatus implements BaseExceptionStatus { - DOCS_ALREADY_EXIST("이미 구글 독스 링크 연동 페이지가 존재합니다.", 400, "74000"), + DOCS_ALREADY_EXIST("이미 구글 독스 링크 연동 페이지가 존재합니다.", 400, "74000"), GOOGLE_DOCS_NOT_ACCESS("구글 독스에 접근 권한이 없습니다. 문서의 접근 권한을 변경해주세요.", 400, "74001"), GOOGLE_DOCS_NOT_EXIST("없는 구글 독스입니다.", 400, "74002"), - DOCS_FORBIDDEN("권한이 없는 접근입니다.", 403, "74030"), + DOCS_FORBIDDEN("권한이 없는 접근입니다.", 403, "74030"), DOCS_NOT_FOUND("존재하지 않는 데이터입니다.", 404, "74040"), - GOOGLE_DOCS_LINK_ERROR("구글 독스 연동 중 문제가 발생했습니다.", 500, "75000"); + GOOGLE_DOCS_LINK_ERROR("구글 독스 연동 중 문제가 발생했습니다.", 500, "75000"); @Getter private final String message; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/controller/GoogleDocsController.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/controller/GoogleDocsController.java index 88c21af9..7c1ae1b3 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/controller/GoogleDocsController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/controller/GoogleDocsController.java @@ -4,8 +4,10 @@ import com.kakao.linknamu.core.util.ApiUtils; import com.kakao.linknamu.thirdparty.googledocs.dto.RegisterGoogleDocsRequestDto; import com.kakao.linknamu.thirdparty.googledocs.service.GoogleDocsApiService; + import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; + import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/entity/GooglePage.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/entity/GooglePage.java index 753ec0ef..58fee8e7 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/entity/GooglePage.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/entity/GooglePage.java @@ -3,11 +3,13 @@ import com.kakao.linknamu.category.entity.Category; import com.kakao.linknamu.core.util.AuditingEntity; import com.kakao.linknamu.user.entity.User; + import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; + import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; @@ -62,7 +64,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - GooglePage that = (GooglePage) obj; + GooglePage that = (GooglePage)obj; return Objects.equals(id, that.id) && Objects.equals(pageName, that.getPageName()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/repository/GooglePageJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/repository/GooglePageJpaRepository.java index b5f23a73..52887733 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/repository/GooglePageJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/repository/GooglePageJpaRepository.java @@ -2,6 +2,7 @@ import com.kakao.linknamu.thirdparty.googledocs.entity.GooglePage; import com.kakao.linknamu.user.entity.User; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiBatchService.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiBatchService.java index 8b13155a..5b3464ce 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiBatchService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiBatchService.java @@ -14,8 +14,10 @@ import com.kakao.linknamu.thirdparty.googledocs.util.InvalidGoogleDocsApiException; import com.kakao.linknamu.thirdparty.utils.JsoupResult; import com.kakao.linknamu.thirdparty.utils.JsoupUtils; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiService.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiService.java index b9890f50..4ac04466 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/service/GoogleDocsApiService.java @@ -14,7 +14,9 @@ import com.kakao.linknamu.workspace.entity.Workspace; import com.kakao.linknamu.workspace.entity.constant.LinkProvider; import com.kakao.linknamu.workspace.service.WorkspaceService; + import lombok.RequiredArgsConstructor; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -37,7 +39,8 @@ public void createDocsApi(RegisterGoogleDocsRequestDto dto, User user) { } // 워크스페이스 지정 - Workspace docsWorkspace = workspaceService.findWorkspaceByUserAndProvider(DEFAULT_WORKSPACE_NAME, user, LinkProvider.GOOGLE_DOCS); + Workspace docsWorkspace = workspaceService.findWorkspaceByUserAndProvider(DEFAULT_WORKSPACE_NAME, user, + LinkProvider.GOOGLE_DOCS); // 카테고리 지정, 초기 카테고리의 이름은 pageName 으로 지정한다. Category docsCategory = categoryService.findByWorkspaceIdAndCategoryName(docsWorkspace.getId(), pageName) diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/util/GoogleDocsProvider.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/util/GoogleDocsProvider.java index f7d91a1b..b2e0df1f 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/util/GoogleDocsProvider.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/googledocs/util/GoogleDocsProvider.java @@ -9,8 +9,10 @@ import com.kakao.linknamu.core.exception.Exception400; import com.kakao.linknamu.core.exception.Exception500; import com.kakao.linknamu.thirdparty.googledocs.GoogleDocsExceptionStatus; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.springframework.stereotype.Service; import java.io.IOException; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/DevNotionController.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/DevNotionController.java index 8095988c..df502fc2 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/DevNotionController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/DevNotionController.java @@ -2,6 +2,7 @@ import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; + import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.web.bind.annotation.GetMapping; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/NotionController.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/NotionController.java index 97da48cf..c095d7e9 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/NotionController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/controller/NotionController.java @@ -5,8 +5,10 @@ import com.kakao.linknamu.thirdparty.notion.dto.RegisterNotionRequestDto; import com.kakao.linknamu.thirdparty.notion.service.NotionApiService; import com.kakao.linknamu.thirdparty.notion.util.NotionProvider; + import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; + import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionAccount.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionAccount.java index 3e32e836..50373020 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionAccount.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionAccount.java @@ -2,6 +2,7 @@ import com.kakao.linknamu.core.util.AuditingEntity; import com.kakao.linknamu.user.entity.User; + import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; @@ -47,7 +48,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - NotionAccount notion = (NotionAccount) obj; + NotionAccount notion = (NotionAccount)obj; return Objects.equals(getId(), notion.getId()) && Objects.equals(getToken(), notion.getToken()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionPage.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionPage.java index ef1ba8e1..7de29e48 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionPage.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/entity/NotionPage.java @@ -2,11 +2,13 @@ import com.kakao.linknamu.category.entity.Category; import com.kakao.linknamu.core.util.AuditingEntity; + import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; + import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; @@ -22,7 +24,6 @@ ) public class NotionPage extends AuditingEntity { - @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "notion_page_id") @@ -65,7 +66,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - NotionPage that = (NotionPage) obj; + NotionPage that = (NotionPage)obj; return Objects.equals(getId(), that.getId()) && Objects.equals(getPageId(), that.getPageId()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionAccountJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionAccountJpaRepository.java index aff72753..bae2f865 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionAccountJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionAccountJpaRepository.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.thirdparty.notion.repository; import com.kakao.linknamu.thirdparty.notion.entity.NotionAccount; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -12,5 +13,5 @@ public interface NotionAccountJpaRepository extends JpaRepository findByUserIdAndAccessToken(@Param("userId") Long userId, - @Param("accessToken") String accessToken); + @Param("accessToken") String accessToken); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionPageJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionPageJpaRepository.java index 34a3f03b..6fba3cbc 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionPageJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/repository/NotionPageJpaRepository.java @@ -2,6 +2,7 @@ import com.kakao.linknamu.thirdparty.notion.entity.NotionAccount; import com.kakao.linknamu.thirdparty.notion.entity.NotionPage; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiBatchService.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiBatchService.java index 27398313..927b93be 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiBatchService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiBatchService.java @@ -8,8 +8,10 @@ import com.kakao.linknamu.thirdparty.notion.util.NotionApiUriBuilder; import com.kakao.linknamu.thirdparty.utils.JsoupResult; import com.kakao.linknamu.thirdparty.utils.JsoupUtils; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -75,15 +77,15 @@ private List getPageLinks(String pageId, String accessToken, NotionPag String uri = notionApiUriBuilder.getBlockUri(pageId, Optional.ofNullable(nextCursor)); try { ResponseEntity response = restTemplate.exchange(uri, HttpMethod.GET, httpEntity, String.class); - JSONObject jsonObject = (JSONObject) jsonParser.parse(response.getBody()); - JSONArray result = (JSONArray) jsonObject.get("results"); - hasMore = (Boolean) jsonObject.get("has_more"); - nextCursor = (String) jsonObject.get("next_cursor"); + JSONObject jsonObject = (JSONObject)jsonParser.parse(response.getBody()); + JSONArray result = (JSONArray)jsonObject.get("results"); + hasMore = (Boolean)jsonObject.get("has_more"); + nextCursor = (String)jsonObject.get("next_cursor"); for (Object o : result) { - JSONObject subObject = (JSONObject) o; - String type = (String) subObject.get("type"); - JSONObject subObjectChild = (JSONObject) subObject.get(type); + JSONObject subObject = (JSONObject)o; + String type = (String)subObject.get("type"); + JSONObject subObjectChild = (JSONObject)subObject.get(type); if (type.equals("bookmark") | type.equals("embed")) { saveBookmarkOrEmbedLink(subObjectChild, resultBookmarks, notionPage); } else { @@ -117,8 +119,8 @@ private List getPageLinks(String pageId, String accessToken, NotionPag private void saveBookmarkOrEmbedLink( JSONObject bookmarkTypeObject, Set resultBookmarks, NotionPage notionPage) { - JSONArray caption = (JSONArray) bookmarkTypeObject.get("caption"); - String url = (String) bookmarkTypeObject.get("url"); + JSONArray caption = (JSONArray)bookmarkTypeObject.get("caption"); + String url = (String)bookmarkTypeObject.get("url"); // 만약 한번 연동한 링크라면 더 이상 진행하지 않는다. if (bookmarkService.existByBookmarkLinkAndCategoryId(url, notionPage.getCategory().getCategoryId())) { return; @@ -128,7 +130,7 @@ private void saveBookmarkOrEmbedLink( if (!caption.isEmpty()) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < caption.size(); i++) { - JSONObject captionObject = (JSONObject) caption.get(i); + JSONObject captionObject = (JSONObject)caption.get(i); sb.append(captionObject.get("plain_text")); } jsoupResult.setTitle(sb.toString().strip()); @@ -145,15 +147,15 @@ private void saveBookmarkOrEmbedLink( // 북마크, 임베드 이외의 링크 데이터를 저장한다. private void saveOtherLink(JSONObject otherTypeObject, Set resultBookmarks, NotionPage notionPage) { - JSONArray richTexts = (JSONArray) otherTypeObject.get("rich_text"); + JSONArray richTexts = (JSONArray)otherTypeObject.get("rich_text"); if (Objects.isNull(richTexts)) { return; } for (Object richText : richTexts) { - String href = (String) ((JSONObject) richText).get("href"); - String title = (String) ((JSONObject) richText).get("plain_text"); - String type = (String) ((JSONObject) richText).get("type"); + String href = (String)((JSONObject)richText).get("href"); + String title = (String)((JSONObject)richText).get("plain_text"); + String type = (String)((JSONObject)richText).get("type"); JsoupResult jsoupResult = new JsoupResult(); if (Objects.nonNull(href)) { @@ -168,8 +170,8 @@ private void saveOtherLink(JSONObject otherTypeObject, Set resultBookm jsoupResult.setTitle(title); } - if(type.equals("mention")) { - if( title.equals("Untitled")) { + if (type.equals("mention")) { + if (title.equals("Untitled")) { jsoupResult.setTitle(DEFAULT_NOTION_PAGE_NAME); } else { jsoupResult.setTitle(title); diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiService.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiService.java index c5e8282b..204b3e06 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/service/NotionApiService.java @@ -16,7 +16,9 @@ import com.kakao.linknamu.workspace.entity.Workspace; import com.kakao.linknamu.workspace.entity.constant.LinkProvider; import com.kakao.linknamu.workspace.service.WorkspaceService; + import lombok.RequiredArgsConstructor; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -40,8 +42,8 @@ public class NotionApiService { 5. noticePage 생성 */ public void createNotionApi(String accessToken, - RegisterNotionRequestDto requestDto, - User user) { + RegisterNotionRequestDto requestDto, + User user) { // 유효한 accessToken과 pageId를 입력했는지 검증 String pageTitle = notionProvider.getPageTitle(accessToken, requestDto.pageId()); @@ -62,7 +64,8 @@ public void createNotionApi(String accessToken, } // 노션 연동 워크스페이스가 있다면 해당 워크스페이스에 카테고리 생성 없으면 노션 워크스페이스 추가 - Workspace notionWorkspace = workspaceService.findWorkspaceByUserAndProvider(DEFAULT_WORKSPACE_NAME, user, LinkProvider.NOTION); + Workspace notionWorkspace = workspaceService.findWorkspaceByUserAndProvider(DEFAULT_WORKSPACE_NAME, user, + LinkProvider.NOTION); // 초기 카테고리의 이름은 노션 페이지의 ID로 지정한다. Category notionCategory = categoryService.findByWorkspaceIdAndCategoryName(notionWorkspace.getId(), diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionApiUriBuilder.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionApiUriBuilder.java index 2efe2e68..d3f3db62 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionApiUriBuilder.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionApiUriBuilder.java @@ -9,7 +9,6 @@ public class NotionApiUriBuilder { private static final String BLOCK_URI = "https://api.notion.com/v1/blocks/"; private static final int PAGE_SIZE = 100; - public String getBlockUri(String pageId, Optional nextCursor) { StringBuilder sb = new StringBuilder(); sb.append(BLOCK_URI) diff --git a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionProvider.java b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionProvider.java index 74a69444..59931e0a 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionProvider.java +++ b/linknamu/src/main/java/com/kakao/linknamu/thirdparty/notion/util/NotionProvider.java @@ -4,8 +4,10 @@ import com.kakao.linknamu.core.exception.Exception500; import com.kakao.linknamu.thirdparty.notion.NotionExceptionStatus; import com.kakao.linknamu.thirdparty.notion.dto.NotionTokenDto; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -79,14 +81,14 @@ public String getPageTitle(String accessToken, String pageId) { ResponseEntity response = restTemplate.exchange(PAGE_URL + pageId, HttpMethod.GET, httpEntity, String.class); JSONParser jsonParser = jsonParserProvider.getObject(); - JSONObject jsonObject = (JSONObject) jsonParser.parse(response.getBody()); - JSONObject properties = (JSONObject) jsonObject.get("properties"); - JSONObject titleObject = (JSONObject) properties.get("title"); - JSONArray titleArray = (JSONArray) titleObject.get("title"); + JSONObject jsonObject = (JSONObject)jsonParser.parse(response.getBody()); + JSONObject properties = (JSONObject)jsonObject.get("properties"); + JSONObject titleObject = (JSONObject)properties.get("title"); + JSONArray titleArray = (JSONArray)titleObject.get("title"); StringBuilder titleBuilder = new StringBuilder(); for (Object o : titleArray) { - JSONObject titleInfo = (JSONObject) o; - titleBuilder.append((String) titleInfo.get("plain_text")); + JSONObject titleInfo = (JSONObject)o; + titleBuilder.append((String)titleInfo.get("plain_text")); } return titleBuilder.toString(); } catch (HttpClientErrorException e) { diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/UserExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/user/UserExceptionStatus.java index 8ac7146c..db450dfb 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/UserExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/UserExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.user; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -14,7 +15,6 @@ public enum UserExceptionStatus implements BaseExceptionStatus { USER_NOT_FOUND("회원이 존재하지 않습니다", 404, "14040"), GOOGLE_API_CONNECTION_ERROR("구글 API 연동 중 문제가 발생했습니다", 500, "15000"); - @Getter private final String message; @Getter diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/controller/DevSocialLoginController.java b/linknamu/src/main/java/com/kakao/linknamu/user/controller/DevSocialLoginController.java index 6843372f..35698449 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/controller/DevSocialLoginController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/controller/DevSocialLoginController.java @@ -2,8 +2,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; + import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; + import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.http.HttpEntity; @@ -31,7 +33,6 @@ @RequestMapping("/dev") public class DevSocialLoginController { - @Value("${oauth2.google.client_id}") private String clientId; diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/controller/GoogleLoginController.java b/linknamu/src/main/java/com/kakao/linknamu/user/controller/GoogleLoginController.java index 85c25a0b..3bb8cba2 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/controller/GoogleLoginController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/controller/GoogleLoginController.java @@ -7,8 +7,10 @@ import com.kakao.linknamu.user.dto.oauth.GoogleUserInfo; import com.kakao.linknamu.user.service.GoogleService; import com.kakao.linknamu.user.service.UserService; + import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; + import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/controller/UserController.java b/linknamu/src/main/java/com/kakao/linknamu/user/controller/UserController.java index c3785043..c45c2404 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/controller/UserController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/controller/UserController.java @@ -5,9 +5,11 @@ import com.kakao.linknamu.core.util.ApiUtils; import com.kakao.linknamu.user.dto.ReissueDto; import com.kakao.linknamu.user.service.UserService; + import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; + import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.PostMapping; @@ -27,7 +29,6 @@ public ResponseEntity reissue(@RequestBody @Valid ReissueDto.ReissueRequestDt return ResponseEntity.ok(ApiUtils.success(resultDto)); } - @PostMapping("/logout") public ResponseEntity logout(HttpServletRequest request) { userService.logout(request.getHeader(JwtProvider.HEADER)); @@ -36,7 +37,7 @@ public ResponseEntity logout(HttpServletRequest request) { @PostMapping("/withdrawal") public ResponseEntity withdrawal(HttpServletRequest request, - @AuthenticationPrincipal CustomUserDetails userDetails) { + @AuthenticationPrincipal CustomUserDetails userDetails) { userService.withdrawal(userDetails.getUser(), request.getHeader(JwtProvider.HEADER)); return ResponseEntity.ok(ApiUtils.success(null)); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/dto/ReissueDto.java b/linknamu/src/main/java/com/kakao/linknamu/user/dto/ReissueDto.java index e8da11b1..0a0927a8 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/dto/ReissueDto.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/dto/ReissueDto.java @@ -5,7 +5,6 @@ public class ReissueDto { - public record ReissueRequestDto( @NotNull(message = "Refresh 토큰을 입력해주세요.") String refreshToken diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/entity/User.java b/linknamu/src/main/java/com/kakao/linknamu/user/entity/User.java index 5225b6b3..2f58a0c2 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/entity/User.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/entity/User.java @@ -3,6 +3,7 @@ import com.kakao.linknamu.core.util.AuditingEntity; import com.kakao.linknamu.user.entity.constant.Provider; import com.kakao.linknamu.user.entity.constant.Role; + import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; @@ -52,7 +53,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - User user = (User) obj; + User user = (User)obj; return Objects.equals(getUserId(), user.getUserId()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Provider.java b/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Provider.java index ba6add5e..7118a45e 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Provider.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Provider.java @@ -8,7 +8,6 @@ public enum Provider { PROVIDER_NORMAL("normal", "일반 회원가입"), PROVIDER_GOOGLE("google", "구글"); - @Getter private final String provider; diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Role.java b/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Role.java index 1d43c0c8..70dce842 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Role.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/entity/constant/Role.java @@ -8,7 +8,6 @@ public enum Role { ROLE_USER("USER", "일반 사용자"), ROLE_ADMIN("ADMIN", "관리자"); - @Getter private final String roleName; diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/repository/UserJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/user/repository/UserJpaRepository.java index 7970f9e3..7183ae00 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/repository/UserJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/repository/UserJpaRepository.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.user.repository; import com.kakao.linknamu.user.entity.User; + import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/service/GoogleService.java b/linknamu/src/main/java/com/kakao/linknamu/user/service/GoogleService.java index f0c38cb9..bcfe6740 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/service/GoogleService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/service/GoogleService.java @@ -6,8 +6,10 @@ import com.kakao.linknamu.user.UserExceptionStatus; import com.kakao.linknamu.user.dto.oauth.GoogleTokenResponseDto; import com.kakao.linknamu.user.dto.oauth.GoogleUserInfo; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.springframework.beans.factory.annotation.Value; import org.springframework.http.*; import org.springframework.stereotype.Service; @@ -25,7 +27,6 @@ public class GoogleService { private final RestTemplate restTemplate; - public GoogleUserInfo getGoogleUserInfo(String token) { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.set("Authorization", "Bearer " + token); diff --git a/linknamu/src/main/java/com/kakao/linknamu/user/service/UserService.java b/linknamu/src/main/java/com/kakao/linknamu/user/service/UserService.java index c7d19aeb..2ad2a820 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/user/service/UserService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/user/service/UserService.java @@ -18,8 +18,10 @@ import com.kakao.linknamu.user.entity.constant.Role; import com.kakao.linknamu.user.repository.UserJpaRepository; import com.kakao.linknamu.workspace.service.WorkspaceService; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; + import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -92,7 +94,6 @@ public void withdrawal(User user, String accessToken) { blackListTokenService.save(accessToken); } - private void checkRefreshTokenInRedis(String refreshToken) { if (!refreshTokenService.existsById(refreshToken)) { throw new Exception404(RedisExceptionStatus.REFRESH_TOKEN_NOT_FOUND); diff --git a/linknamu/src/main/java/com/kakao/linknamu/workspace/WorkspaceExceptionStatus.java b/linknamu/src/main/java/com/kakao/linknamu/workspace/WorkspaceExceptionStatus.java index 30b9f0d1..1039b8a0 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/workspace/WorkspaceExceptionStatus.java +++ b/linknamu/src/main/java/com/kakao/linknamu/workspace/WorkspaceExceptionStatus.java @@ -1,6 +1,7 @@ package com.kakao.linknamu.workspace; import com.kakao.linknamu.core.exception.BaseExceptionStatus; + import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -11,7 +12,6 @@ public enum WorkspaceExceptionStatus implements BaseExceptionStatus { WORKSPACE_FORBIDDEN("접근 권한이 없는 사용자 입니다.", 403, "54030"), WORKSPACE_NOT_FOUND("존재하지 않는 워크스페이스 입니다.", 404, "54040"); - private final String message; private final int status; private final String errorCode; diff --git a/linknamu/src/main/java/com/kakao/linknamu/workspace/controller/WorkspaceController.java b/linknamu/src/main/java/com/kakao/linknamu/workspace/controller/WorkspaceController.java index f5e1adb8..7416ef41 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/workspace/controller/WorkspaceController.java +++ b/linknamu/src/main/java/com/kakao/linknamu/workspace/controller/WorkspaceController.java @@ -5,8 +5,10 @@ import com.kakao.linknamu.workspace.dto.WorkspaceCreateRequestDto; import com.kakao.linknamu.workspace.dto.WorkspaceUpdateRequestDto; import com.kakao.linknamu.workspace.service.*; + import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; + import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; diff --git a/linknamu/src/main/java/com/kakao/linknamu/workspace/dto/WorkspaceGetResponseDto.java b/linknamu/src/main/java/com/kakao/linknamu/workspace/dto/WorkspaceGetResponseDto.java index e7940cd2..566bf8f0 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/workspace/dto/WorkspaceGetResponseDto.java +++ b/linknamu/src/main/java/com/kakao/linknamu/workspace/dto/WorkspaceGetResponseDto.java @@ -2,6 +2,7 @@ import com.kakao.linknamu.category.entity.Category; import com.kakao.linknamu.workspace.entity.Workspace; + import lombok.Builder; import java.util.Comparator; @@ -18,12 +19,10 @@ record CategoryResponseDto( ) { } - @Builder public WorkspaceGetResponseDto { } - public static WorkspaceGetResponseDto of(Workspace workspace) { return WorkspaceGetResponseDto.builder() .workspaceId(workspace.getId()) diff --git a/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/Workspace.java b/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/Workspace.java index 6f0f9ef1..fe3f5fbe 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/Workspace.java +++ b/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/Workspace.java @@ -4,8 +4,10 @@ import com.kakao.linknamu.core.util.AuditingEntity; import com.kakao.linknamu.user.entity.User; import com.kakao.linknamu.workspace.entity.constant.LinkProvider; + import jakarta.persistence.*; import lombok.*; + import org.hibernate.annotations.DynamicUpdate; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; @@ -74,7 +76,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } - Workspace workspace = (Workspace) obj; + Workspace workspace = (Workspace)obj; return Objects.equals(getId(), workspace.getId()); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/constant/LinkProvider.java b/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/constant/LinkProvider.java index 85d175c4..b3f9ae29 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/constant/LinkProvider.java +++ b/linknamu/src/main/java/com/kakao/linknamu/workspace/entity/constant/LinkProvider.java @@ -1,6 +1,5 @@ package com.kakao.linknamu.workspace.entity.constant; - public enum LinkProvider { NORMAL, NOTION, GOOGLE_DOCS; } diff --git a/linknamu/src/main/java/com/kakao/linknamu/workspace/repository/WorkspaceJpaRepository.java b/linknamu/src/main/java/com/kakao/linknamu/workspace/repository/WorkspaceJpaRepository.java index 3786220d..50a66982 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/workspace/repository/WorkspaceJpaRepository.java +++ b/linknamu/src/main/java/com/kakao/linknamu/workspace/repository/WorkspaceJpaRepository.java @@ -2,6 +2,7 @@ import com.kakao.linknamu.workspace.entity.Workspace; import com.kakao.linknamu.workspace.entity.constant.LinkProvider; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -23,5 +24,5 @@ Optional findByUserIdAndWorkspaceName( @Query(value = "select w from Workspace w " + "where w.user.userId =:userId and w.linkProvider = :provider") Optional findByUserIdAndProvider(@Param("userId") Long userId, - @Param("provider") LinkProvider provider); + @Param("provider") LinkProvider provider); } diff --git a/linknamu/src/main/java/com/kakao/linknamu/workspace/service/WorkspaceService.java b/linknamu/src/main/java/com/kakao/linknamu/workspace/service/WorkspaceService.java index 2821aaba..b287fd3d 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/workspace/service/WorkspaceService.java +++ b/linknamu/src/main/java/com/kakao/linknamu/workspace/service/WorkspaceService.java @@ -10,7 +10,9 @@ import com.kakao.linknamu.workspace.entity.Workspace; import com.kakao.linknamu.workspace.entity.constant.LinkProvider; import com.kakao.linknamu.workspace.repository.WorkspaceJpaRepository; + import lombok.RequiredArgsConstructor; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -83,7 +85,6 @@ public void deleteWorkspace(Long workspaceId, User user) { workspaceJpaRepository.delete(workspace); } - // 노션 - 구글독스 연동 전용 워크스페이스 생성. private Workspace createWorkspaceWithLinkProvider(String workspaceName, User user, LinkProvider linkProvider) { Workspace workspace = workspaceJpaRepository.findByUserIdAndWorkspaceName(user.getUserId(), workspaceName) From 9e6091ee3bc099165096a540df4aaca6084afbf6 Mon Sep 17 00:00:00 2001 From: Taeho Date: Sat, 11 Nov 2023 19:15:18 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Fix:=20weekly=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../linknamu/core/util/S3ImageClient.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java b/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java index a48f5683..b4caea0e 100644 --- a/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java +++ b/linknamu/src/main/java/com/kakao/linknamu/core/util/S3ImageClient.java @@ -1,18 +1,5 @@ package com.kakao.linknamu.core.util; -import com.amazonaws.services.s3.AmazonS3Client; -import com.amazonaws.services.s3.model.ObjectMetadata; -import com.amazonaws.services.s3.model.PutObjectRequest; -import com.kakao.linknamu.core.exception.Exception400; -import com.kakao.linknamu.thirdparty.utils.JsoupUtils; - -import lombok.RequiredArgsConstructor; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.imageio.ImageIO; - import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -20,6 +7,18 @@ import java.net.URL; import java.util.UUID; +import javax.imageio.ImageIO; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import com.amazonaws.services.s3.AmazonS3Client; +import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.PutObjectRequest; +import com.kakao.linknamu.core.exception.Exception400; + +import lombok.RequiredArgsConstructor; + @RequiredArgsConstructor @Component public class S3ImageClient {