From 25c1fff1a248c469d2eb4ce679e726e141eaed6d Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 21:52:04 +0900 Subject: [PATCH 01/10] =?UTF-8?q?refactor:=20member=20->=20customer?= =?UTF-8?q?=EB=A1=9C=20=EB=AA=85=EC=B9=AD=20=EB=B3=80=EA=B2=BD=20#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java | 2 +- src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java | 2 +- .../api/domain/inquiry/repository/ContactRepository.java | 2 +- .../inquiry/repository/ContactRepositoryCustomImpl.java | 2 +- .../io/oduck/api/domain/inquiry/service/ContactPolicy.java | 4 ++-- src/main/java/io/oduck/api/domain/member/entity/Member.java | 2 +- .../io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java b/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java index f86a913b..0053b2ea 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java +++ b/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java @@ -18,7 +18,7 @@ public static ContactRequestHolder from(PostReq request, Member member) { .content(request.getContent()) .type(request.getType()) .answered(false) - .member(member) + .customer(member) .build(); return new ContactRequestHolder(contact); } diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java b/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java index 90201391..82b9cd18 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java +++ b/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java @@ -31,7 +31,7 @@ public class Contact extends BaseEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") - private Member member; + private Member customer; @Column(nullable = false, length = 100) private String title; diff --git a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepository.java b/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepository.java index 90f82e44..053c25ec 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepository.java +++ b/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepository.java @@ -8,6 +8,6 @@ public interface ContactRepository extends JpaRepository, ContactRepositoryCustom { - @Query("select c from Contact c join fetch c.member where c.id = :id") + @Query("select c from Contact c join fetch c.customer where c.id = :id") Optional findWithMemberById(@Param("id") Long id); } diff --git a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustomImpl.java b/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustomImpl.java index 7e3f4fa7..c49d4073 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustomImpl.java +++ b/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustomImpl.java @@ -65,6 +65,6 @@ private BooleanExpression idEq(Long id) { } private BooleanExpression memberIdEq(Long memberId) { - return memberId == null ? null : contact.member.id.eq(memberId); + return memberId == null ? null : contact.customer.id.eq(memberId); } } diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/ContactPolicy.java b/src/main/java/io/oduck/api/domain/inquiry/service/ContactPolicy.java index e88ae59f..a7c4142b 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/ContactPolicy.java +++ b/src/main/java/io/oduck/api/domain/inquiry/service/ContactPolicy.java @@ -12,10 +12,10 @@ public void isAccessOwnInquiry(Contact contact, Member member) { if(!isOwnInquiry(contact, member)) { throw new ForbiddenException("not has permission"); } - contact.getMember().getId(); + contact.getCustomer().getId(); } private boolean isOwnInquiry(Contact contact, Member member) { - return contact.getMember().getId().equals(member.getId()); + return contact.getCustomer().getId().equals(member.getId()); } } \ No newline at end of file diff --git a/src/main/java/io/oduck/api/domain/member/entity/Member.java b/src/main/java/io/oduck/api/domain/member/entity/Member.java index 988716b7..86308c42 100644 --- a/src/main/java/io/oduck/api/domain/member/entity/Member.java +++ b/src/main/java/io/oduck/api/domain/member/entity/Member.java @@ -71,7 +71,7 @@ public class Member extends BaseEntity { @OneToMany(mappedBy = "member", cascade = CascadeType.PERSIST) private List attractionPoints; - @OneToMany(mappedBy = "member", cascade = CascadeType.PERSIST) + @OneToMany(mappedBy = "customer", cascade = CascadeType.PERSIST) private List contacts = new ArrayList<>(); @Builder diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java index 1e8e6245..3da6d27e 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java +++ b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java @@ -17,7 +17,7 @@ public class ContactPolicyTest { //given Member writer = Member.builder().id(1L).build(); - Contact contact = Contact.builder().member(writer).build(); + Contact contact = Contact.builder().customer(writer).build(); Member target = Member.builder().id(2L).build(); From 1b62ec1e38f22917dbd661a8c6eb6c80560b99d4 Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 21:53:19 +0900 Subject: [PATCH 02/10] =?UTF-8?q?refactor:=20FeedbackType=EC=9D=98=20NOT?= =?UTF-8?q?=5FSELECT=20->=20NONE=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/oduck/api/domain/inquiry/entity/FeedbackType.java | 2 +- src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/FeedbackType.java b/src/main/java/io/oduck/api/domain/inquiry/entity/FeedbackType.java index ea65828c..3aad2450 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/FeedbackType.java +++ b/src/main/java/io/oduck/api/domain/inquiry/entity/FeedbackType.java @@ -3,5 +3,5 @@ public enum FeedbackType { HELPFUL, NOT_HELPFUL, - NOT_SELECT + NONE } diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java index 0c7477ed..72811322 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java +++ b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java @@ -67,7 +67,7 @@ public class ContactTest { void 회원은_운영진의_답변에_피드백_할_수_있다() { //given Answer answer = Answer.builder() - .helpful(FeedbackType.NOT_SELECT) + .helpful(FeedbackType.NONE) .build(); Contact contact = Contact.builder() From c418352328deedd7edbca828813bb351d4017cd8 Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:29:08 +0900 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EB=8F=84=EB=A9=94=EC=9D=B8=20=EC=B6=94=EA=B0=80,=20=EB=8B=B5?= =?UTF-8?q?=EB=B3=80=20=EB=B0=8F=20=EB=8B=B5=EB=B3=80=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=EB=8F=84=EB=A9=94=EC=9D=B8=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oduck/api/domain/admin/entity/Admin.java | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/main/java/io/oduck/api/domain/admin/entity/Admin.java diff --git a/src/main/java/io/oduck/api/domain/admin/entity/Admin.java b/src/main/java/io/oduck/api/domain/admin/entity/Admin.java new file mode 100644 index 00000000..197b4582 --- /dev/null +++ b/src/main/java/io/oduck/api/domain/admin/entity/Admin.java @@ -0,0 +1,64 @@ +package io.oduck.api.domain.admin.entity; + +import io.oduck.api.domain.inquiry.entity.Answer; +import io.oduck.api.domain.inquiry.entity.FeedbackType; +import io.oduck.api.domain.inquiry.service.AnswerHolder; +import io.oduck.api.domain.inquiry.service.AnswerUpdateHolder; +import io.oduck.api.global.exception.BadRequestException; +import io.oduck.api.global.exception.NotFoundException; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import java.util.ArrayList; +import java.util.List; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED) +@Builder +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Table(name = "member") +@Entity +public class Admin { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @OneToMany(mappedBy = "admin", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) + private List answers = new ArrayList<>(); + + public void answer(AnswerHolder holder) { + Answer answer = Answer.builder() + .content(holder.getContent()) + .helpful(FeedbackType.NONE) + .check(false) + .contact(holder.getContact()) + .admin(this) + .build(); + answers.add(answer); + + answer.answer(); + } + + public void updateAnswer(AnswerUpdateHolder holder) { + Answer answer = answers.stream() + .filter(a -> a.getId() == holder.getAnswerId()) + .findFirst() + .orElseThrow(() -> new NotFoundException("answer")); + + if(answer.isCheck() == true) { + throw new BadRequestException("이미 고객이 확인한 문의입니다."); + } + + answer.update(holder.getContent()); + } +} From b350d612467bdfb805e75a672f91c60ab1a19e20 Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:29:24 +0900 Subject: [PATCH 04/10] =?UTF-8?q?feat:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EB=A6=AC=ED=8F=AC=EC=A7=80=ED=86=A0=EB=A6=AC=20#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/admin/repository/AdminRepository.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/io/oduck/api/domain/admin/repository/AdminRepository.java diff --git a/src/main/java/io/oduck/api/domain/admin/repository/AdminRepository.java b/src/main/java/io/oduck/api/domain/admin/repository/AdminRepository.java new file mode 100644 index 00000000..65c2eb68 --- /dev/null +++ b/src/main/java/io/oduck/api/domain/admin/repository/AdminRepository.java @@ -0,0 +1,13 @@ +package io.oduck.api.domain.admin.repository; + +import io.oduck.api.domain.admin.entity.Admin; +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface AdminRepository extends JpaRepository { + + @Query("select distinct a from Admin a join fetch a.answers where a.id = :id") + Optional findWithAnswerById(@Param("id") Long id); +} From d40b523671ef0a7fb7e90fb6f28f30aafd9fa5d4 Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:38:52 +0900 Subject: [PATCH 05/10] =?UTF-8?q?feat:=20=EB=8B=B5=EB=B3=80=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EC=B6=94=EA=B0=80=20#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/domain/inquiry/dto/ContactReq.java | 10 +++++++++- .../api/domain/inquiry/entity/Answer.java | 19 ++++++++++++++++++- .../api/domain/inquiry/entity/Contact.java | 4 ++++ .../domain/inquiry/service/AnswerHolder.java | 5 +++-- .../inquiry/service/AnswerUpdateHolder.java | 17 +++++++++++++++++ 5 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 src/main/java/io/oduck/api/domain/inquiry/service/AnswerUpdateHolder.java diff --git a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactReq.java b/src/main/java/io/oduck/api/domain/inquiry/dto/ContactReq.java index 60715314..0c312983 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactReq.java +++ b/src/main/java/io/oduck/api/domain/inquiry/dto/ContactReq.java @@ -29,8 +29,16 @@ public static class PostReq { @Getter @AllArgsConstructor public static class AnswerReq { - private Long id; + @NotBlank + @Length(min = 1, max = 1000, + message = "글자 수는 1~1000를 허용합니다.") + private String content; + } + + @Getter + @AllArgsConstructor + public static class AnswerUpdateReq { @NotBlank @Length(min = 1, max = 1000, message = "글자 수는 1~1000를 허용합니다.") diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/Answer.java b/src/main/java/io/oduck/api/domain/inquiry/entity/Answer.java index 00105543..4d93fc87 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/Answer.java +++ b/src/main/java/io/oduck/api/domain/inquiry/entity/Answer.java @@ -1,10 +1,15 @@ package io.oduck.api.domain.inquiry.entity; +import io.oduck.api.domain.admin.entity.Admin; +import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToOne; import jakarta.persistence.Table; import lombok.AllArgsConstructor; @@ -31,9 +36,13 @@ public class Answer { @Column(name = "check_answer") private boolean check = false; - @OneToOne(mappedBy = "answer") + @OneToOne(mappedBy = "answer", cascade = CascadeType.PERSIST) private Contact contact; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Admin admin; + public void check() { check = true; } @@ -41,4 +50,12 @@ public void check() { public void feedback(FeedbackType helpful) { this.helpful = helpful; } + + public void update(String content) { + this.content = content; + } + + public void answer() { + contact.answer(); + } } diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java b/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java index 82b9cd18..31ecfb4a 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java +++ b/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java @@ -51,4 +51,8 @@ public class Contact extends BaseEntity { public void feedback(FeedbackType helpful) { answer.feedback(helpful); } + + public void answer() { + answered = true; + } } diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/AnswerHolder.java b/src/main/java/io/oduck/api/domain/inquiry/service/AnswerHolder.java index e8e5ebb3..9b5983d7 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/AnswerHolder.java +++ b/src/main/java/io/oduck/api/domain/inquiry/service/AnswerHolder.java @@ -9,8 +9,9 @@ @AllArgsConstructor public class AnswerHolder { private Contact contact; - private AnswerReq request; + private String content; + public static AnswerHolder from(Contact contact, AnswerReq request) { - return new AnswerHolder(contact, request); + return new AnswerHolder(contact, request.getContent()); } } diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/AnswerUpdateHolder.java b/src/main/java/io/oduck/api/domain/inquiry/service/AnswerUpdateHolder.java new file mode 100644 index 00000000..01ae46e1 --- /dev/null +++ b/src/main/java/io/oduck/api/domain/inquiry/service/AnswerUpdateHolder.java @@ -0,0 +1,17 @@ +package io.oduck.api.domain.inquiry.service; + +import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class AnswerUpdateHolder { + private Long answerId; + private String content; + + public static AnswerUpdateHolder from(Long answerId, AnswerUpdateReq request) { + return new AnswerUpdateHolder(answerId, request.getContent()); + } +} From bab3cb7f18f1acaf6c3b585bbdb495190864d57b Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:39:12 +0900 Subject: [PATCH 06/10] =?UTF-8?q?feat:=20=EB=8B=B5=EB=B3=80=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inquiry/service/ContactService.java | 8 +++-- .../inquiry/service/ContactServiceImpl.java | 33 ++++++++++++++----- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/ContactService.java b/src/main/java/io/oduck/api/domain/inquiry/service/ContactService.java index 5556846e..dec6b263 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/ContactService.java +++ b/src/main/java/io/oduck/api/domain/inquiry/service/ContactService.java @@ -1,5 +1,7 @@ package io.oduck.api.domain.inquiry.service; +import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerReq; +import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; import io.oduck.api.domain.inquiry.dto.ContactReq.PostReq; import io.oduck.api.domain.inquiry.dto.ContactRes.DetailRes; import io.oduck.api.domain.inquiry.dto.ContactRes.MyInquiry; @@ -19,7 +21,7 @@ public interface ContactService { // Page getAll(); // -// void answer(Long adminId, AnswerReq request); -// -// void update(Long id); + void answer(Long id, Long adminId, AnswerReq request); + + void update(Long answerId, Long adminId, AnswerUpdateReq request); } diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/ContactServiceImpl.java b/src/main/java/io/oduck/api/domain/inquiry/service/ContactServiceImpl.java index 60faff82..2fd3cf95 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/ContactServiceImpl.java +++ b/src/main/java/io/oduck/api/domain/inquiry/service/ContactServiceImpl.java @@ -3,8 +3,12 @@ import static io.oduck.api.domain.inquiry.dto.ContactReq.PostReq; import static io.oduck.api.domain.inquiry.dto.ContactRes.MyInquiry; +import io.oduck.api.domain.admin.entity.Admin; +import io.oduck.api.domain.admin.repository.AdminRepository; import io.oduck.api.domain.inquiry.dto.AnswerFeedback; import io.oduck.api.domain.inquiry.dto.ContactId; +import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerReq; +import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; import io.oduck.api.domain.inquiry.dto.ContactRequestHolder; import io.oduck.api.domain.inquiry.dto.ContactRes.DetailRes; import io.oduck.api.domain.inquiry.entity.Contact; @@ -29,6 +33,7 @@ public class ContactServiceImpl implements ContactService { private final ContactRepository contactRepository; private final ContactPolicy contactPolicy; + private final AdminRepository adminRepository; @Override @Transactional @@ -93,14 +98,24 @@ public void feedbackAnswer(Long id, Long memberId, FeedbackType helpful) { // return null; // } -// @Override -// @Transactional -// public void answer(Long adminId, AnswerReq request) { -// } + @Override + @Transactional + public void answer(Long id, Long adminId, AnswerReq request) { + Contact contact = contactRepository.findWithMemberById(id) + .orElseThrow(() -> new NotFoundException("inquiry")); -// @Override -// @Transactional -// public void update(Long id) { -// -// } + Admin admin = adminRepository.findWithAnswerById(adminId) + .orElseThrow(() -> new NotFoundException("admin")); + + admin.answer(AnswerHolder.from(contact, request)); + } + + @Override + @Transactional + public void update(Long answerId, Long adminId, AnswerUpdateReq request) { + Admin admin = adminRepository.findWithAnswerById(adminId) + .orElseThrow(() -> new NotFoundException("admin")); + + admin.updateAnswer(AnswerUpdateHolder.from(answerId, request)); + } } From 3877e59912ebded572cbe84c67029abe3306f6b6 Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:39:21 +0900 Subject: [PATCH 07/10] =?UTF-8?q?feat:=20=EB=8B=B5=EB=B3=80=20=EB=A6=AC?= =?UTF-8?q?=ED=8F=AC=EC=A7=80=ED=86=A0=EB=A6=AC=20=EC=B6=94=EA=B0=80=20#13?= =?UTF-8?q?9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/domain/inquiry/repository/AnswerRepository.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/java/io/oduck/api/domain/inquiry/repository/AnswerRepository.java diff --git a/src/main/java/io/oduck/api/domain/inquiry/repository/AnswerRepository.java b/src/main/java/io/oduck/api/domain/inquiry/repository/AnswerRepository.java new file mode 100644 index 00000000..c11e460a --- /dev/null +++ b/src/main/java/io/oduck/api/domain/inquiry/repository/AnswerRepository.java @@ -0,0 +1,8 @@ +package io.oduck.api.domain.inquiry.repository; + +import io.oduck.api.domain.inquiry.entity.Answer; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface AnswerRepository extends JpaRepository { + +} \ No newline at end of file From 95a0c4b8d4c774ff9d161a696a80cadb3199368d Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:39:33 +0900 Subject: [PATCH 08/10] =?UTF-8?q?feat:=20=EB=8B=B5=EB=B3=80=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/unit/inquiry/domain/AnswerTest.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java b/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java new file mode 100644 index 00000000..5e6d04de --- /dev/null +++ b/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java @@ -0,0 +1,85 @@ +package io.oduck.api.unit.inquiry.domain; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import io.oduck.api.domain.admin.entity.Admin; +import io.oduck.api.domain.inquiry.dto.ContactReq; +import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerReq; +import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; +import io.oduck.api.domain.inquiry.entity.Answer; +import io.oduck.api.domain.inquiry.entity.Contact; +import io.oduck.api.domain.inquiry.service.AnswerHolder; +import io.oduck.api.domain.inquiry.service.AnswerUpdateHolder; +import io.oduck.api.global.exception.BadRequestException; +import java.util.ArrayList; +import org.junit.jupiter.api.Test; + +public class AnswerTest { + + @Test + void 관리자는_문의할_수_있다() { + // given + Contact contact = Contact.builder() + .answered(false) + .build(); + + Admin admin = Admin.builder() + .answers(new ArrayList<>()) + .build(); + + AnswerReq request = new AnswerReq("문의"); + + // when + admin.answer(AnswerHolder.from(contact, request)); + + // then + assertThat(admin.getAnswers().get(0).getContact().isAnswered()).isTrue(); + assertThat(admin.getAnswers().get(0).getContent()).isEqualTo("문의"); + } + + @Test + void 관리자는_답변을_수정할_수있다() { + // given + Contact contact = Contact.builder() + .answered(false) + .build(); + + Admin admin = Admin.builder() + .answers(new ArrayList<>()) + .build(); + + AnswerReq request = new AnswerReq("문의"); + admin.answer(AnswerHolder.from(contact, request)); + + // when + admin.updateAnswer(AnswerUpdateHolder.from(null, new AnswerUpdateReq("문의 수정"))); + + // then + assertThat(admin.getAnswers().get(0).getContent()).isEqualTo("문의 수정"); + } + + @Test + void 관리자는_확인한_답변을_수정할_수_없다() { + // given + Contact contact = Contact.builder() + .answered(false) + .build(); + + Admin admin = Admin.builder() + .answers(new ArrayList<>()) + .build(); + + AnswerReq request = new AnswerReq("문의"); + admin.answer(AnswerHolder.from(contact, request)); + + Answer answer = admin.getAnswers().get(0); + answer.check(); + + // when + // then + assertThatThrownBy(() -> admin.updateAnswer(AnswerUpdateHolder.from(null, new AnswerUpdateReq("문의 수정")))) + .isInstanceOf(BadRequestException.class) + .hasMessageContaining("이미 고객이 확인한 문의입니다."); + } +} From 033abc49afa2b233064dac6664c13704305237df Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:42:11 +0900 Subject: [PATCH 09/10] =?UTF-8?q?feat:=20inquiry=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=20contact=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EB=A1=9C=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=AA=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oduck/api/domain/admin/entity/Admin.java | 8 +++---- .../dto/AnswerFeedback.java | 4 ++-- .../{inquiry => contact}/dto/ContactId.java | 2 +- .../{inquiry => contact}/dto/ContactReq.java | 4 ++-- .../dto/ContactRequestHolder.java | 6 ++--- .../{inquiry => contact}/dto/ContactRes.java | 4 ++-- .../{inquiry => contact}/entity/Answer.java | 2 +- .../{inquiry => contact}/entity/Contact.java | 2 +- .../entity/FeedbackType.java | 2 +- .../entity/InquiryType.java | 2 +- .../{inquiry => contact}/entity/Result.java | 2 +- .../{inquiry => contact}/entity/Status.java | 2 +- .../repository/AnswerRepository.java | 4 ++-- .../repository/ContactRepository.java | 4 ++-- .../repository/ContactRepositoryCustom.java | 4 ++-- .../ContactRepositoryCustomImpl.java | 8 +++---- .../service/AnswerHolder.java | 6 ++--- .../service/AnswerUpdateHolder.java | 4 ++-- .../service/ContactPolicy.java | 4 ++-- .../service/ContactService.java | 16 ++++++------- .../service/ContactServiceImpl.java | 24 +++++++++---------- .../api/domain/member/entity/Member.java | 8 +++---- .../api/unit/inquiry/domain/AnswerTest.java | 13 +++++----- .../inquiry/domain/ContactPolicyTest.java | 4 ++-- .../api/unit/inquiry/domain/ContactTest.java | 16 ++++++------- .../repository/ContactRepositoryTest.java | 8 +++---- 26 files changed, 81 insertions(+), 82 deletions(-) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/dto/AnswerFeedback.java (79%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/dto/ContactId.java (87%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/dto/ContactReq.java (92%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/dto/ContactRequestHolder.java (80%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/dto/ContactRes.java (91%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/entity/Answer.java (97%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/entity/Contact.java (97%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/entity/FeedbackType.java (61%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/entity/InquiryType.java (63%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/entity/Result.java (55%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/entity/Status.java (61%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/repository/AnswerRepository.java (58%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/repository/ContactRepository.java (81%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/repository/ContactRepositoryCustom.java (71%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/repository/ContactRepositoryCustomImpl.java (89%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/service/AnswerHolder.java (66%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/service/AnswerUpdateHolder.java (78%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/service/ContactPolicy.java (85%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/service/ContactService.java (58%) rename src/main/java/io/oduck/api/domain/{inquiry => contact}/service/ContactServiceImpl.java (84%) diff --git a/src/main/java/io/oduck/api/domain/admin/entity/Admin.java b/src/main/java/io/oduck/api/domain/admin/entity/Admin.java index 197b4582..23ff17c6 100644 --- a/src/main/java/io/oduck/api/domain/admin/entity/Admin.java +++ b/src/main/java/io/oduck/api/domain/admin/entity/Admin.java @@ -1,9 +1,9 @@ package io.oduck.api.domain.admin.entity; -import io.oduck.api.domain.inquiry.entity.Answer; -import io.oduck.api.domain.inquiry.entity.FeedbackType; -import io.oduck.api.domain.inquiry.service.AnswerHolder; -import io.oduck.api.domain.inquiry.service.AnswerUpdateHolder; +import io.oduck.api.domain.contact.entity.Answer; +import io.oduck.api.domain.contact.entity.FeedbackType; +import io.oduck.api.domain.contact.service.AnswerHolder; +import io.oduck.api.domain.contact.service.AnswerUpdateHolder; import io.oduck.api.global.exception.BadRequestException; import io.oduck.api.global.exception.NotFoundException; import jakarta.persistence.CascadeType; diff --git a/src/main/java/io/oduck/api/domain/inquiry/dto/AnswerFeedback.java b/src/main/java/io/oduck/api/domain/contact/dto/AnswerFeedback.java similarity index 79% rename from src/main/java/io/oduck/api/domain/inquiry/dto/AnswerFeedback.java rename to src/main/java/io/oduck/api/domain/contact/dto/AnswerFeedback.java index 30231aab..d18cab0a 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/dto/AnswerFeedback.java +++ b/src/main/java/io/oduck/api/domain/contact/dto/AnswerFeedback.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.dto; +package io.oduck.api.domain.contact.dto; -import io.oduck.api.domain.inquiry.entity.FeedbackType; +import io.oduck.api.domain.contact.entity.FeedbackType; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactId.java b/src/main/java/io/oduck/api/domain/contact/dto/ContactId.java similarity index 87% rename from src/main/java/io/oduck/api/domain/inquiry/dto/ContactId.java rename to src/main/java/io/oduck/api/domain/contact/dto/ContactId.java index 8e2e3aa0..74adf4cb 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactId.java +++ b/src/main/java/io/oduck/api/domain/contact/dto/ContactId.java @@ -1,4 +1,4 @@ -package io.oduck.api.domain.inquiry.dto; +package io.oduck.api.domain.contact.dto; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactReq.java b/src/main/java/io/oduck/api/domain/contact/dto/ContactReq.java similarity index 92% rename from src/main/java/io/oduck/api/domain/inquiry/dto/ContactReq.java rename to src/main/java/io/oduck/api/domain/contact/dto/ContactReq.java index 0c312983..9467dbf0 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactReq.java +++ b/src/main/java/io/oduck/api/domain/contact/dto/ContactReq.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.dto; +package io.oduck.api.domain.contact.dto; -import io.oduck.api.domain.inquiry.entity.InquiryType; +import io.oduck.api.domain.contact.entity.InquiryType; import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java b/src/main/java/io/oduck/api/domain/contact/dto/ContactRequestHolder.java similarity index 80% rename from src/main/java/io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java rename to src/main/java/io/oduck/api/domain/contact/dto/ContactRequestHolder.java index 0053b2ea..628f6c83 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRequestHolder.java +++ b/src/main/java/io/oduck/api/domain/contact/dto/ContactRequestHolder.java @@ -1,7 +1,7 @@ -package io.oduck.api.domain.inquiry.dto; +package io.oduck.api.domain.contact.dto; -import io.oduck.api.domain.inquiry.dto.ContactReq.PostReq; -import io.oduck.api.domain.inquiry.entity.Contact; +import io.oduck.api.domain.contact.dto.ContactReq.PostReq; +import io.oduck.api.domain.contact.entity.Contact; import io.oduck.api.domain.member.entity.Member; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRes.java b/src/main/java/io/oduck/api/domain/contact/dto/ContactRes.java similarity index 91% rename from src/main/java/io/oduck/api/domain/inquiry/dto/ContactRes.java rename to src/main/java/io/oduck/api/domain/contact/dto/ContactRes.java index 1b0f6563..375f8ddd 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/dto/ContactRes.java +++ b/src/main/java/io/oduck/api/domain/contact/dto/ContactRes.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.dto; +package io.oduck.api.domain.contact.dto; -import io.oduck.api.domain.inquiry.entity.Contact; +import io.oduck.api.domain.contact.entity.Contact; import java.time.LocalDate; import java.time.LocalDateTime; import lombok.AllArgsConstructor; diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/Answer.java b/src/main/java/io/oduck/api/domain/contact/entity/Answer.java similarity index 97% rename from src/main/java/io/oduck/api/domain/inquiry/entity/Answer.java rename to src/main/java/io/oduck/api/domain/contact/entity/Answer.java index 4d93fc87..ea422815 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/Answer.java +++ b/src/main/java/io/oduck/api/domain/contact/entity/Answer.java @@ -1,4 +1,4 @@ -package io.oduck.api.domain.inquiry.entity; +package io.oduck.api.domain.contact.entity; import io.oduck.api.domain.admin.entity.Admin; import jakarta.persistence.CascadeType; diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java b/src/main/java/io/oduck/api/domain/contact/entity/Contact.java similarity index 97% rename from src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java rename to src/main/java/io/oduck/api/domain/contact/entity/Contact.java index 31ecfb4a..4c232745 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/Contact.java +++ b/src/main/java/io/oduck/api/domain/contact/entity/Contact.java @@ -1,4 +1,4 @@ -package io.oduck.api.domain.inquiry.entity; +package io.oduck.api.domain.contact.entity; import io.oduck.api.domain.member.entity.Member; import io.oduck.api.global.audit.BaseEntity; diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/FeedbackType.java b/src/main/java/io/oduck/api/domain/contact/entity/FeedbackType.java similarity index 61% rename from src/main/java/io/oduck/api/domain/inquiry/entity/FeedbackType.java rename to src/main/java/io/oduck/api/domain/contact/entity/FeedbackType.java index 3aad2450..31185832 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/FeedbackType.java +++ b/src/main/java/io/oduck/api/domain/contact/entity/FeedbackType.java @@ -1,4 +1,4 @@ -package io.oduck.api.domain.inquiry.entity; +package io.oduck.api.domain.contact.entity; public enum FeedbackType { HELPFUL, diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/InquiryType.java b/src/main/java/io/oduck/api/domain/contact/entity/InquiryType.java similarity index 63% rename from src/main/java/io/oduck/api/domain/inquiry/entity/InquiryType.java rename to src/main/java/io/oduck/api/domain/contact/entity/InquiryType.java index 827b6d78..81e1035c 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/InquiryType.java +++ b/src/main/java/io/oduck/api/domain/contact/entity/InquiryType.java @@ -1,4 +1,4 @@ -package io.oduck.api.domain.inquiry.entity; +package io.oduck.api.domain.contact.entity; public enum InquiryType { ADD_REQUEST, diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/Result.java b/src/main/java/io/oduck/api/domain/contact/entity/Result.java similarity index 55% rename from src/main/java/io/oduck/api/domain/inquiry/entity/Result.java rename to src/main/java/io/oduck/api/domain/contact/entity/Result.java index 534856ce..79519318 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/Result.java +++ b/src/main/java/io/oduck/api/domain/contact/entity/Result.java @@ -1,4 +1,4 @@ -package io.oduck.api.domain.inquiry.entity; +package io.oduck.api.domain.contact.entity; public enum Result { DELETE, diff --git a/src/main/java/io/oduck/api/domain/inquiry/entity/Status.java b/src/main/java/io/oduck/api/domain/contact/entity/Status.java similarity index 61% rename from src/main/java/io/oduck/api/domain/inquiry/entity/Status.java rename to src/main/java/io/oduck/api/domain/contact/entity/Status.java index 94a7424c..4c1091af 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/entity/Status.java +++ b/src/main/java/io/oduck/api/domain/contact/entity/Status.java @@ -1,4 +1,4 @@ -package io.oduck.api.domain.inquiry.entity; +package io.oduck.api.domain.contact.entity; public enum Status { WAITING, diff --git a/src/main/java/io/oduck/api/domain/inquiry/repository/AnswerRepository.java b/src/main/java/io/oduck/api/domain/contact/repository/AnswerRepository.java similarity index 58% rename from src/main/java/io/oduck/api/domain/inquiry/repository/AnswerRepository.java rename to src/main/java/io/oduck/api/domain/contact/repository/AnswerRepository.java index c11e460a..23515744 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/repository/AnswerRepository.java +++ b/src/main/java/io/oduck/api/domain/contact/repository/AnswerRepository.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.repository; +package io.oduck.api.domain.contact.repository; -import io.oduck.api.domain.inquiry.entity.Answer; +import io.oduck.api.domain.contact.entity.Answer; import org.springframework.data.jpa.repository.JpaRepository; public interface AnswerRepository extends JpaRepository { diff --git a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepository.java b/src/main/java/io/oduck/api/domain/contact/repository/ContactRepository.java similarity index 81% rename from src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepository.java rename to src/main/java/io/oduck/api/domain/contact/repository/ContactRepository.java index 053c25ec..a33bed29 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepository.java +++ b/src/main/java/io/oduck/api/domain/contact/repository/ContactRepository.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.repository; +package io.oduck.api.domain.contact.repository; -import io.oduck.api.domain.inquiry.entity.Contact; +import io.oduck.api.domain.contact.entity.Contact; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustom.java b/src/main/java/io/oduck/api/domain/contact/repository/ContactRepositoryCustom.java similarity index 71% rename from src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustom.java rename to src/main/java/io/oduck/api/domain/contact/repository/ContactRepositoryCustom.java index 0ce6b07b..4cf01ff2 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustom.java +++ b/src/main/java/io/oduck/api/domain/contact/repository/ContactRepositoryCustom.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.repository; +package io.oduck.api.domain.contact.repository; -import io.oduck.api.domain.inquiry.dto.ContactRes.MyInquiry; +import io.oduck.api.domain.contact.dto.ContactRes.MyInquiry; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustomImpl.java b/src/main/java/io/oduck/api/domain/contact/repository/ContactRepositoryCustomImpl.java similarity index 89% rename from src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustomImpl.java rename to src/main/java/io/oduck/api/domain/contact/repository/ContactRepositoryCustomImpl.java index c49d4073..e90990b9 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/repository/ContactRepositoryCustomImpl.java +++ b/src/main/java/io/oduck/api/domain/contact/repository/ContactRepositoryCustomImpl.java @@ -1,13 +1,13 @@ -package io.oduck.api.domain.inquiry.repository; +package io.oduck.api.domain.contact.repository; -import static io.oduck.api.domain.inquiry.entity.QAnswer.answer; -import static io.oduck.api.domain.inquiry.entity.QContact.contact; +import static io.oduck.api.domain.contact.entity.QAnswer.answer; +import static io.oduck.api.domain.contact.entity.QContact.contact; import com.querydsl.core.types.Projections; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; -import io.oduck.api.domain.inquiry.dto.ContactRes.MyInquiry; +import io.oduck.api.domain.contact.dto.ContactRes.MyInquiry; import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/AnswerHolder.java b/src/main/java/io/oduck/api/domain/contact/service/AnswerHolder.java similarity index 66% rename from src/main/java/io/oduck/api/domain/inquiry/service/AnswerHolder.java rename to src/main/java/io/oduck/api/domain/contact/service/AnswerHolder.java index 9b5983d7..3b2094f9 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/AnswerHolder.java +++ b/src/main/java/io/oduck/api/domain/contact/service/AnswerHolder.java @@ -1,7 +1,7 @@ -package io.oduck.api.domain.inquiry.service; +package io.oduck.api.domain.contact.service; -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerReq; -import io.oduck.api.domain.inquiry.entity.Contact; +import io.oduck.api.domain.contact.dto.ContactReq.AnswerReq; +import io.oduck.api.domain.contact.entity.Contact; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/AnswerUpdateHolder.java b/src/main/java/io/oduck/api/domain/contact/service/AnswerUpdateHolder.java similarity index 78% rename from src/main/java/io/oduck/api/domain/inquiry/service/AnswerUpdateHolder.java rename to src/main/java/io/oduck/api/domain/contact/service/AnswerUpdateHolder.java index 01ae46e1..d2b84703 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/AnswerUpdateHolder.java +++ b/src/main/java/io/oduck/api/domain/contact/service/AnswerUpdateHolder.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.service; +package io.oduck.api.domain.contact.service; -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; +import io.oduck.api.domain.contact.dto.ContactReq.AnswerUpdateReq; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/ContactPolicy.java b/src/main/java/io/oduck/api/domain/contact/service/ContactPolicy.java similarity index 85% rename from src/main/java/io/oduck/api/domain/inquiry/service/ContactPolicy.java rename to src/main/java/io/oduck/api/domain/contact/service/ContactPolicy.java index a7c4142b..a0ad1d48 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/ContactPolicy.java +++ b/src/main/java/io/oduck/api/domain/contact/service/ContactPolicy.java @@ -1,6 +1,6 @@ -package io.oduck.api.domain.inquiry.service; +package io.oduck.api.domain.contact.service; -import io.oduck.api.domain.inquiry.entity.Contact; +import io.oduck.api.domain.contact.entity.Contact; import io.oduck.api.domain.member.entity.Member; import io.oduck.api.global.exception.ForbiddenException; import org.springframework.stereotype.Component; diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/ContactService.java b/src/main/java/io/oduck/api/domain/contact/service/ContactService.java similarity index 58% rename from src/main/java/io/oduck/api/domain/inquiry/service/ContactService.java rename to src/main/java/io/oduck/api/domain/contact/service/ContactService.java index dec6b263..0868c855 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/ContactService.java +++ b/src/main/java/io/oduck/api/domain/contact/service/ContactService.java @@ -1,11 +1,11 @@ -package io.oduck.api.domain.inquiry.service; - -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerReq; -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; -import io.oduck.api.domain.inquiry.dto.ContactReq.PostReq; -import io.oduck.api.domain.inquiry.dto.ContactRes.DetailRes; -import io.oduck.api.domain.inquiry.dto.ContactRes.MyInquiry; -import io.oduck.api.domain.inquiry.entity.FeedbackType; +package io.oduck.api.domain.contact.service; + +import io.oduck.api.domain.contact.dto.ContactReq.AnswerReq; +import io.oduck.api.domain.contact.dto.ContactReq.AnswerUpdateReq; +import io.oduck.api.domain.contact.dto.ContactReq.PostReq; +import io.oduck.api.domain.contact.dto.ContactRes.DetailRes; +import io.oduck.api.domain.contact.dto.ContactRes.MyInquiry; +import io.oduck.api.domain.contact.entity.FeedbackType; import io.oduck.api.global.common.PageResponse; public interface ContactService { diff --git a/src/main/java/io/oduck/api/domain/inquiry/service/ContactServiceImpl.java b/src/main/java/io/oduck/api/domain/contact/service/ContactServiceImpl.java similarity index 84% rename from src/main/java/io/oduck/api/domain/inquiry/service/ContactServiceImpl.java rename to src/main/java/io/oduck/api/domain/contact/service/ContactServiceImpl.java index 2fd3cf95..c570c83e 100644 --- a/src/main/java/io/oduck/api/domain/inquiry/service/ContactServiceImpl.java +++ b/src/main/java/io/oduck/api/domain/contact/service/ContactServiceImpl.java @@ -1,19 +1,19 @@ -package io.oduck.api.domain.inquiry.service; +package io.oduck.api.domain.contact.service; -import static io.oduck.api.domain.inquiry.dto.ContactReq.PostReq; -import static io.oduck.api.domain.inquiry.dto.ContactRes.MyInquiry; +import static io.oduck.api.domain.contact.dto.ContactReq.PostReq; +import static io.oduck.api.domain.contact.dto.ContactRes.MyInquiry; import io.oduck.api.domain.admin.entity.Admin; import io.oduck.api.domain.admin.repository.AdminRepository; -import io.oduck.api.domain.inquiry.dto.AnswerFeedback; -import io.oduck.api.domain.inquiry.dto.ContactId; -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerReq; -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; -import io.oduck.api.domain.inquiry.dto.ContactRequestHolder; -import io.oduck.api.domain.inquiry.dto.ContactRes.DetailRes; -import io.oduck.api.domain.inquiry.entity.Contact; -import io.oduck.api.domain.inquiry.entity.FeedbackType; -import io.oduck.api.domain.inquiry.repository.ContactRepository; +import io.oduck.api.domain.contact.dto.AnswerFeedback; +import io.oduck.api.domain.contact.dto.ContactId; +import io.oduck.api.domain.contact.dto.ContactReq.AnswerReq; +import io.oduck.api.domain.contact.dto.ContactReq.AnswerUpdateReq; +import io.oduck.api.domain.contact.dto.ContactRequestHolder; +import io.oduck.api.domain.contact.dto.ContactRes.DetailRes; +import io.oduck.api.domain.contact.entity.Contact; +import io.oduck.api.domain.contact.entity.FeedbackType; +import io.oduck.api.domain.contact.repository.ContactRepository; import io.oduck.api.domain.member.entity.Member; import io.oduck.api.domain.member.repository.MemberRepository; import io.oduck.api.global.common.PageResponse; diff --git a/src/main/java/io/oduck/api/domain/member/entity/Member.java b/src/main/java/io/oduck/api/domain/member/entity/Member.java index 86308c42..5f78db2e 100644 --- a/src/main/java/io/oduck/api/domain/member/entity/Member.java +++ b/src/main/java/io/oduck/api/domain/member/entity/Member.java @@ -2,10 +2,10 @@ import io.oduck.api.domain.attractionPoint.entity.AttractionPoint; import io.oduck.api.domain.bookmark.entity.Bookmark; -import io.oduck.api.domain.inquiry.dto.AnswerFeedback; -import io.oduck.api.domain.inquiry.dto.ContactId; -import io.oduck.api.domain.inquiry.dto.ContactRequestHolder; -import io.oduck.api.domain.inquiry.entity.Contact; +import io.oduck.api.domain.contact.dto.AnswerFeedback; +import io.oduck.api.domain.contact.dto.ContactId; +import io.oduck.api.domain.contact.dto.ContactRequestHolder; +import io.oduck.api.domain.contact.entity.Contact; import io.oduck.api.domain.review.entity.ShortReview; import io.oduck.api.domain.reviewLike.entity.ShortReviewLike; import io.oduck.api.domain.starRating.entity.StarRating; diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java b/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java index 5e6d04de..4819314c 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java +++ b/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java @@ -4,13 +4,12 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import io.oduck.api.domain.admin.entity.Admin; -import io.oduck.api.domain.inquiry.dto.ContactReq; -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerReq; -import io.oduck.api.domain.inquiry.dto.ContactReq.AnswerUpdateReq; -import io.oduck.api.domain.inquiry.entity.Answer; -import io.oduck.api.domain.inquiry.entity.Contact; -import io.oduck.api.domain.inquiry.service.AnswerHolder; -import io.oduck.api.domain.inquiry.service.AnswerUpdateHolder; +import io.oduck.api.domain.contact.dto.ContactReq.AnswerReq; +import io.oduck.api.domain.contact.dto.ContactReq.AnswerUpdateReq; +import io.oduck.api.domain.contact.entity.Answer; +import io.oduck.api.domain.contact.entity.Contact; +import io.oduck.api.domain.contact.service.AnswerHolder; +import io.oduck.api.domain.contact.service.AnswerUpdateHolder; import io.oduck.api.global.exception.BadRequestException; import java.util.ArrayList; import org.junit.jupiter.api.Test; diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java index 3da6d27e..7bfe5158 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java +++ b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java @@ -2,8 +2,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; -import io.oduck.api.domain.inquiry.entity.Contact; -import io.oduck.api.domain.inquiry.service.ContactPolicy; +import io.oduck.api.domain.contact.entity.Contact; +import io.oduck.api.domain.contact.service.ContactPolicy; import io.oduck.api.domain.member.entity.Member; import io.oduck.api.global.exception.ForbiddenException; import org.junit.jupiter.api.Test; diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java index 72811322..fd59b3b7 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java +++ b/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java @@ -3,14 +3,14 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.oduck.api.domain.inquiry.dto.ContactId; -import io.oduck.api.domain.inquiry.dto.AnswerFeedback; -import io.oduck.api.domain.inquiry.dto.ContactReq.PostReq; -import io.oduck.api.domain.inquiry.dto.ContactRequestHolder; -import io.oduck.api.domain.inquiry.entity.Answer; -import io.oduck.api.domain.inquiry.entity.Contact; -import io.oduck.api.domain.inquiry.entity.FeedbackType; -import io.oduck.api.domain.inquiry.entity.InquiryType; +import io.oduck.api.domain.contact.dto.ContactId; +import io.oduck.api.domain.contact.dto.AnswerFeedback; +import io.oduck.api.domain.contact.dto.ContactReq.PostReq; +import io.oduck.api.domain.contact.dto.ContactRequestHolder; +import io.oduck.api.domain.contact.entity.Answer; +import io.oduck.api.domain.contact.entity.Contact; +import io.oduck.api.domain.contact.entity.FeedbackType; +import io.oduck.api.domain.contact.entity.InquiryType; import io.oduck.api.domain.member.entity.Member; import java.util.ArrayList; import java.util.List; diff --git a/src/test/java/io/oduck/api/unit/inquiry/repository/ContactRepositoryTest.java b/src/test/java/io/oduck/api/unit/inquiry/repository/ContactRepositoryTest.java index fd2f3d50..c1a6f173 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/repository/ContactRepositoryTest.java +++ b/src/test/java/io/oduck/api/unit/inquiry/repository/ContactRepositoryTest.java @@ -2,10 +2,10 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.oduck.api.domain.inquiry.dto.ContactReq.PostReq; -import io.oduck.api.domain.inquiry.dto.ContactRequestHolder; -import io.oduck.api.domain.inquiry.entity.InquiryType; -import io.oduck.api.domain.inquiry.repository.ContactRepository; +import io.oduck.api.domain.contact.dto.ContactReq.PostReq; +import io.oduck.api.domain.contact.dto.ContactRequestHolder; +import io.oduck.api.domain.contact.entity.InquiryType; +import io.oduck.api.domain.contact.repository.ContactRepository; import io.oduck.api.domain.member.entity.Member; import io.oduck.api.domain.member.repository.MemberRepository; import java.util.ArrayList; From 59aeb0c3d525d42a4fbff2181030109e6368f494 Mon Sep 17 00:00:00 2001 From: jaykayBaek Date: Mon, 11 Dec 2023 22:43:04 +0900 Subject: [PATCH 10/10] =?UTF-8?q?test:=20inquiry=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=20contact=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EB=A1=9C=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=AA=85=20?= =?UTF-8?q?=EB=B3=80=20#139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oduck/api/unit/{inquiry => contact}/domain/AnswerTest.java | 2 +- .../api/unit/{inquiry => contact}/domain/ContactPolicyTest.java | 2 +- .../oduck/api/unit/{inquiry => contact}/domain/ContactTest.java | 2 +- .../{inquiry => contact}/repository/ContactRepositoryTest.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename src/test/java/io/oduck/api/unit/{inquiry => contact}/domain/AnswerTest.java (98%) rename src/test/java/io/oduck/api/unit/{inquiry => contact}/domain/ContactPolicyTest.java (95%) rename src/test/java/io/oduck/api/unit/{inquiry => contact}/domain/ContactTest.java (98%) rename src/test/java/io/oduck/api/unit/{inquiry => contact}/repository/ContactRepositoryTest.java (97%) diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java b/src/test/java/io/oduck/api/unit/contact/domain/AnswerTest.java similarity index 98% rename from src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java rename to src/test/java/io/oduck/api/unit/contact/domain/AnswerTest.java index 4819314c..d6fa24a0 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/AnswerTest.java +++ b/src/test/java/io/oduck/api/unit/contact/domain/AnswerTest.java @@ -1,4 +1,4 @@ -package io.oduck.api.unit.inquiry.domain; +package io.oduck.api.unit.contact.domain; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java b/src/test/java/io/oduck/api/unit/contact/domain/ContactPolicyTest.java similarity index 95% rename from src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java rename to src/test/java/io/oduck/api/unit/contact/domain/ContactPolicyTest.java index 7bfe5158..535948f5 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactPolicyTest.java +++ b/src/test/java/io/oduck/api/unit/contact/domain/ContactPolicyTest.java @@ -1,4 +1,4 @@ -package io.oduck.api.unit.inquiry.domain; +package io.oduck.api.unit.contact.domain; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java b/src/test/java/io/oduck/api/unit/contact/domain/ContactTest.java similarity index 98% rename from src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java rename to src/test/java/io/oduck/api/unit/contact/domain/ContactTest.java index fd59b3b7..1ecd25d7 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/domain/ContactTest.java +++ b/src/test/java/io/oduck/api/unit/contact/domain/ContactTest.java @@ -1,4 +1,4 @@ -package io.oduck.api.unit.inquiry.domain; +package io.oduck.api.unit.contact.domain; import static org.assertj.core.api.Assertions.assertThat; diff --git a/src/test/java/io/oduck/api/unit/inquiry/repository/ContactRepositoryTest.java b/src/test/java/io/oduck/api/unit/contact/repository/ContactRepositoryTest.java similarity index 97% rename from src/test/java/io/oduck/api/unit/inquiry/repository/ContactRepositoryTest.java rename to src/test/java/io/oduck/api/unit/contact/repository/ContactRepositoryTest.java index c1a6f173..db478b8d 100644 --- a/src/test/java/io/oduck/api/unit/inquiry/repository/ContactRepositoryTest.java +++ b/src/test/java/io/oduck/api/unit/contact/repository/ContactRepositoryTest.java @@ -1,4 +1,4 @@ -package io.oduck.api.unit.inquiry.repository; +package io.oduck.api.unit.contact.repository; import static org.assertj.core.api.Assertions.assertThat;