Skip to content

Commit

Permalink
fix: masterIntroduce Member to MemberId
Browse files Browse the repository at this point in the history
  • Loading branch information
nanna29 committed Aug 2, 2024
1 parent b1a7911 commit 9de47a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ public class MasterIntroduce extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@OneToOne
/*@OneToOne
@JoinColumn(name = "member_id", nullable = false)
@NotNull
private Member member;
private Member member;*/

@Column(nullable = false)
private Long memberId;

@Size(max = 24)
private String oneLiner;
Expand All @@ -37,8 +40,8 @@ public class MasterIntroduce extends BaseEntity {


@Builder
public MasterIntroduce(Member member, String oneLiner, String introduction, String motive, String prosAndCons, String jobSuitability) {
this.member = member;
public MasterIntroduce(Long memberId, String oneLiner, String introduction, String motive, String prosAndCons, String jobSuitability) {
this.memberId = memberId;
this.oneLiner = oneLiner;
this.introduction = introduction;
this.motive = motive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class MasterIntroduceResDto {

public MasterIntroduceResDto(MasterIntroduce masterIntroduce/*, List<String> introduceList*/) {
this.id = masterIntroduce.getId();
this.memberId=masterIntroduce.getMember().getId();
this.memberId=masterIntroduce.getMemberId();
this.oneLiner = masterIntroduce.getOneLiner();
this.introduction = masterIntroduce.getIntroduction();
this.motive = masterIntroduce.getMotive();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public MasterIntroduceResDto saveMasterIntro(Member requestMember, MasterIntrodu
}

MasterIntroduce masterIntroduce=MasterIntroduce.builder()
.member(requestMember)
.memberId(requestMember.getId())
.oneLiner(masterIntroduceReqDto.getOneLiner())
.motive(masterIntroduceReqDto.getMotive())
.introduction(masterIntroduceReqDto.getIntroduction())
Expand Down Expand Up @@ -66,7 +66,7 @@ public List<MasterIntroduceResDto> getMasterIntro(Member requestMember){
public MasterIntroduceResDto updateMasterIntro(Member requestMember, Long id, MasterIntroduceReqDto masterIntroduceReqDto) throws Exception{
MasterIntroduce masterIntroduce = masterIntroduceRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("masterIntroduce ", id));
if (!masterIntroduce.getMember().getId().equals(requestMember.getId())) {
if (!masterIntroduce.getMemberId().equals(requestMember.getId())) {
throw new IntroOwnerMismatchException();
}
masterIntroduce.update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void updateMaster() throws Exception {
final String jobSuitability="jobSuitability-test";

MasterIntroduce masterIntroduce = masterIntroduceRepository.save(MasterIntroduce.builder()
.member(requestMember)
.memberId(requestMember.getId())
.oneLiner(oneLiner)
.introduction(introduction)
.motive(motive)
Expand Down

0 comments on commit 9de47a7

Please sign in to comment.