diff --git a/src/main/java/com/example/letscareer/self_intro/controller/SelfIntroController.java b/src/main/java/com/example/letscareer/self_intro/controller/SelfIntroController.java index 611d85d..ab7ebae 100644 --- a/src/main/java/com/example/letscareer/self_intro/controller/SelfIntroController.java +++ b/src/main/java/com/example/letscareer/self_intro/controller/SelfIntroController.java @@ -6,7 +6,7 @@ import com.example.letscareer.common.exception.enums.SuccessCode; import com.example.letscareer.common.exception.model.BadRequestException; import com.example.letscareer.common.exception.model.NotFoundException; -import com.example.letscareer.self_intro.dto.SaveSelfIntroRequest; +import com.example.letscareer.self_intro.dto.request.SaveSelfIntroRequest; import com.example.letscareer.self_intro.service.SelfIntroService; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/com/example/letscareer/self_intro/domain/SelfIntro.java b/src/main/java/com/example/letscareer/self_intro/domain/SelfIntro.java index bf61b75..2a8322c 100644 --- a/src/main/java/com/example/letscareer/self_intro/domain/SelfIntro.java +++ b/src/main/java/com/example/letscareer/self_intro/domain/SelfIntro.java @@ -24,7 +24,7 @@ public class SelfIntro { @Lob private String content; - @OneToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "stageId") @NotNull private Stage stage; diff --git a/src/main/java/com/example/letscareer/self_intro/service/SelfIntroService.java b/src/main/java/com/example/letscareer/self_intro/service/SelfIntroService.java index 29f15c2..d77b7ba 100644 --- a/src/main/java/com/example/letscareer/self_intro/service/SelfIntroService.java +++ b/src/main/java/com/example/letscareer/self_intro/service/SelfIntroService.java @@ -4,7 +4,8 @@ import com.example.letscareer.schedule.domain.Schedule; import com.example.letscareer.schedule.repository.ScheduleRepository; import com.example.letscareer.self_intro.domain.SelfIntro; -import com.example.letscareer.self_intro.dto.SaveSelfIntroRequest; +import com.example.letscareer.self_intro.dto.SelfIntroDTO; +import com.example.letscareer.self_intro.dto.request.SaveSelfIntroRequest; import com.example.letscareer.self_intro.repository.SelfIntroRepository; import com.example.letscareer.stage.domain.Stage; import com.example.letscareer.stage.repository.StageRepository; @@ -36,11 +37,14 @@ public void saveSelfIntro(Long userId, Long scheduleId, Long stageId, SaveSelfIn User user = userRepository.findById(userId) .orElseThrow(() -> new NotFoundException(USER_NOT_FOUND_EXCEPTION)); - SelfIntro selfIntro = SelfIntro.builder() - .stage(stage) - .content(request.content()) - .build(); - - selfIntroRepository.save(selfIntro); + for(SelfIntroDTO selfIntroDTO : request.selfIntros()) { + SelfIntro selfIntro = SelfIntro.builder() + .title(selfIntroDTO.title()) + .sequence(selfIntroDTO.sequence()) + .content(selfIntroDTO.content()) + .stage(stage) + .build(); + selfIntroRepository.save(selfIntro); + } } }