Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] 썸네일과 이미지 저장 로직 간단화 #17

Open
1 task
chanchanwoong opened this issue Jun 10, 2024 · 0 comments
Open
1 task

[REFACTOR] 썸네일과 이미지 저장 로직 간단화 #17

chanchanwoong opened this issue Jun 10, 2024 · 0 comments

Comments

@chanchanwoong
Copy link
Collaborator

리팩토링 설명
현재 썸네일, 이미지 save를 각각 처리하고 있습니다.
한 번에 하는 것을 추천해주셔서 진행해볼려고 합니다.

  • 썸네일, 이미지를 따로 분리하지 않고 isThumbnail 로만 진행

추가 설명

    private void createAuctionImages(CreateAuctionPostDto createAuctionPostDto) {
        try {
            // 썸네일 저장
            auctionImagesRepository.save(
                    AuctionImages.builder()
                            .auctionUuid(createAuctionPostDto.getAuctionUuid())
                            .imageUrl(createAuctionPostDto.getThumbnail())
                            .isThumbnail(true)
                            .build()
            );

            // 일반 이미지 저장
            List<String> images = createAuctionPostDto.getImages();

            for (String image : images) {
                auctionImagesRepository.save(
                        AuctionImages.builder()
                                .auctionUuid(createAuctionPostDto.getAuctionUuid())
                                .imageUrl(image)
                                .isThumbnail(false)
                                .build()
                );
            }
        } catch (Exception e) {
            log.info("Create Auction Image Error", e);
            throw new CustomException(ResponseStatus.POSTGRESQL_ERROR);
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant