Skip to content

Commit

Permalink
MemberAiText에 memberPhoto 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
SeWooooong committed Nov 11, 2023
1 parent a156ebd commit 8e7c523
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import com.example.wncsbackend.service.PapaGoService;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.wncsbackend.domain.MemberAiText;

import com.example.wncsbackend.domain.Member;
import com.example.wncsbackend.domain.MemberPhoto.MemberPhoto;
import com.example.wncsbackend.global.common.BaseTimeEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
Expand Down Expand Up @@ -28,13 +28,13 @@ public class MemberAiText extends BaseTimeEntity {
private String lora;

@ManyToOne(fetch = FetchType.LAZY)
private Member member;
private MemberPhoto memberPhoto;

public MemberAiText(String seed, String prompt, String lora, Member member) {
public MemberAiText(String seed, String prompt, String lora, MemberPhoto memberPhoto) {
this.seed = seed;
this.prompt = prompt;
this.lora = lora;
this.member = member;
this.memberPhoto = memberPhoto;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public static class MemberAiTextInfo {
private String seed;
private String prompt;
private String lora;
private Long memberId;
private Long memberPhotoId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import com.example.wncsbackend.domain.Member;
import com.example.wncsbackend.domain.MemberAiText.MemberAiText;
import com.example.wncsbackend.domain.MemberAiText.dto.MemberAiTextRequestDto.MemberAiTextInfo;
import com.example.wncsbackend.domain.MemberPhoto.MemberPhoto;
import com.example.wncsbackend.repository.MemberAiTextRepository;
import com.example.wncsbackend.repository.MemberRepository;
import java.util.Optional;
import com.example.wncsbackend.repository.MemberPhotoRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand All @@ -15,12 +15,12 @@
public class MemberAiTextService {

private final MemberAiTextRepository memberAiTextRepository;
private final MemberRepository memberRepository;
private final MemberPhotoRepository memberPhotoRepository;

public String insertAiText(MemberAiTextInfo memberAiTextInfo) {
Member member = memberRepository.findById(memberAiTextInfo.getMemberId()).orElseThrow();
MemberPhoto memberPhoto = memberPhotoRepository.findById(memberAiTextInfo.getMemberPhotoId()).orElseThrow();
MemberAiText memberAiText = new MemberAiText(memberAiTextInfo.getSeed(), memberAiTextInfo.getPrompt(),
memberAiTextInfo.getLora(), member);
memberAiTextInfo.getLora(), memberPhoto);
memberAiTextRepository.save(memberAiText);
return "Ai 텍스트 저장 완료";
}
Expand Down

0 comments on commit 8e7c523

Please sign in to comment.