diff --git a/src/main/java/lion6/DrinkGuide/api/contact/service/ContactCommandService.java b/src/main/java/lion6/DrinkGuide/api/contact/service/ContactCommandService.java index a7fb88e..91bdd30 100644 --- a/src/main/java/lion6/DrinkGuide/api/contact/service/ContactCommandService.java +++ b/src/main/java/lion6/DrinkGuide/api/contact/service/ContactCommandService.java @@ -1,6 +1,8 @@ package lion6.DrinkGuide.api.contact.service; +import lion6.DrinkGuide.api.contact.domain.Contact; import lion6.DrinkGuide.api.contact.repository.ContactRepository; +import lion6.DrinkGuide.api.member.repository.MemberRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -9,9 +11,15 @@ @Transactional @RequiredArgsConstructor public class ContactCommandService { + private final MemberRepository memberRepository; private final ContactRepository contactRepository; public void createContact(Long memberId, String title, String content) { - + Contact contact = Contact.builder() + .title(title) + .content(content) + .member(memberRepository.findMemberByIdOrThrow(memberId)) + .build(); + contactRepository.save(contact); } }