From 3d0859843d3ff8865d8763f0339c0157c87d2183 Mon Sep 17 00:00:00 2001 From: ddongseop Date: Thu, 28 Mar 2024 20:28:59 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20[FIX]=20popularRate=20=EC=BF=BC?= =?UTF-8?q?=EB=A6=AC=EC=97=90=20=ED=8F=AC=ED=95=A8=20=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/sopt/lequuServer/InitDb.java | 1 + .../domain/book/facade/BookFacade.java | 17 +++++++++-------- .../lequuServer/domain/book/model/Book.java | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/sopt/lequuServer/InitDb.java b/src/main/java/org/sopt/lequuServer/InitDb.java index 32db50a..a7a4dbe 100644 --- a/src/main/java/org/sopt/lequuServer/InitDb.java +++ b/src/main/java/org/sopt/lequuServer/InitDb.java @@ -74,6 +74,7 @@ public void dbInit() { .description(bookDummy.getDescription()) .backgroundColor("#F5F5F5") .member(member1) + .popularRate(0) .build(); em.persist(book); } diff --git a/src/main/java/org/sopt/lequuServer/domain/book/facade/BookFacade.java b/src/main/java/org/sopt/lequuServer/domain/book/facade/BookFacade.java index 06fe29f..8367b89 100644 --- a/src/main/java/org/sopt/lequuServer/domain/book/facade/BookFacade.java +++ b/src/main/java/org/sopt/lequuServer/domain/book/facade/BookFacade.java @@ -59,14 +59,15 @@ public BookCreateResponseDto createBook(BookCreateRequestDto request, Long membe String imageUrl = s3Service.getCloudFrontURL(BOOK_FAVORITE_IMAGE_FOLDER_NAME.getValue() + request.favoriteImage()); Book book = Book.builder() - .uuid(bookUuid) - .favoriteName(badWordFilterService.badWordChange(memberId, request.favoriteName())) - .favoriteImage(imageUrl) - .title(badWordFilterService.badWordChange(memberId, request.title())) - .description(badWordFilterService.badWordChange(memberId, request.description())) - .backgroundColor(request.backgroundColor()) - .member(member) - .build(); + .uuid(bookUuid) + .favoriteName(badWordFilterService.badWordChange(memberId, request.favoriteName())) + .favoriteImage(imageUrl) + .title(badWordFilterService.badWordChange(memberId, request.title())) + .description(badWordFilterService.badWordChange(memberId, request.description())) + .backgroundColor(request.backgroundColor()) + .member(member) + .popularRate(0) + .build(); return bookService.createBook(book, member); } diff --git a/src/main/java/org/sopt/lequuServer/domain/book/model/Book.java b/src/main/java/org/sopt/lequuServer/domain/book/model/Book.java index a846bec..c6dcde1 100644 --- a/src/main/java/org/sopt/lequuServer/domain/book/model/Book.java +++ b/src/main/java/org/sopt/lequuServer/domain/book/model/Book.java @@ -67,7 +67,7 @@ public void addFavorite(Favorite favorite) { private int popularRate; @Builder - public Book(String uuid, String favoriteName, String favoriteImage, String title, String description, String backgroundColor, Member member) { + public Book(String uuid, String favoriteName, String favoriteImage, String title, String description, String backgroundColor, Member member, int popularRate) { this.uuid = uuid; this.favoriteName = favoriteName; this.favoriteImage = favoriteImage; @@ -75,10 +75,10 @@ public Book(String uuid, String favoriteName, String favoriteImage, String title this.description = description; this.backgroundColor = backgroundColor; this.member = member; - this.popularRate = 0; + this.popularRate = popularRate; } - public static Book of(String uuid, String favoriteName, String favoriteImage, String title, String description, String backgroundColor, Member member) { - return new Book(uuid, favoriteName, favoriteImage, title, description, backgroundColor, member); + public static Book of(String uuid, String favoriteName, String favoriteImage, String title, String description, String backgroundColor, Member member, int popularRate) { + return new Book(uuid, favoriteName, favoriteImage, title, description, backgroundColor, member, popularRate); } }