Skip to content

Commit

Permalink
[BUG] : 문의등록 서비스 로직 추가 - close #19
Browse files Browse the repository at this point in the history
  • Loading branch information
JuseungL committed Jul 28, 2024
1 parent 7c76f00 commit e0f547c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
}

0 comments on commit e0f547c

Please sign in to comment.