Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/com/parentsgowork/server/domain/JobInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class JobInfo extends BaseEntity {
@Column
private String title;

@Column
@Lob
@Column(columnDefinition = "LONGTEXT")
private String content;

// @Column(columnDefinition = "TEXT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import com.parentsgowork.server.web.dto.EducationInfoDTO.EducationInfoResponseDTO;

public interface EducationInfoCommandService {
EducationInfoResponseDTO.DeleteEducationInfoDTO delete(Long userId, Long educationInfoId);
EducationInfoResponseDTO.DeleteEducationInfoDTO delete(Long educationInfoId, Long userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class EducationInfoCommandServiceImpl implements EducationInfoCommandServ
private final UserRepository userRepository;

@Override
public EducationInfoResponseDTO.DeleteEducationInfoDTO delete(Long userId, Long educationInfoId) {
public EducationInfoResponseDTO.DeleteEducationInfoDTO delete(Long educationInfoId, Long userId) {

userRepository.findById(userId)
.orElseThrow(() -> new UserHandler(ErrorStatus.USER_NOT_FOUND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public interface JobInfoCommandService {

List<JobInfoResponseDTO.AddJobResultDTO> addJobInfo(Long userId, List<JobInfoRequestDTO.SaveJobInfoDTO> saveJobInfoDTOList);

JobInfoResponseDTO.DeleteJobInfoDTO delete(Long userId, Long jobInfoId);
JobInfoResponseDTO.DeleteJobInfoDTO delete(Long jobInfoId, Long userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public List<JobInfoResponseDTO.AddJobResultDTO> addJobInfo(Long userId, List<Job
}

@Override
public JobInfoResponseDTO.DeleteJobInfoDTO delete(Long userId, Long jobInfoId) {
public JobInfoResponseDTO.DeleteJobInfoDTO delete(Long jobInfoId, Long userId) {

userRepository.findById(userId)
.orElseThrow(() -> new JobInfoHandler(ErrorStatus.USER_NOT_FOUND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import com.parentsgowork.server.web.dto.PolicyInfoDTO.PolicyInfoResponseDTO;

public interface PolicyInfoCommandService {
PolicyInfoResponseDTO.DeletePolicyInfoDTO delete(Long userId, Long policyInfoId);
PolicyInfoResponseDTO.DeletePolicyInfoDTO delete(Long policyInfoId, Long userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import com.parentsgowork.server.repository.UserRepository;
import com.parentsgowork.server.web.dto.PolicyInfoDTO.PolicyInfoResponseDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class PolicyInfoCommandServiceImpl implements PolicyInfoCommandService {
Expand All @@ -19,16 +21,23 @@ public class PolicyInfoCommandServiceImpl implements PolicyInfoCommandService {
private final UserRepository userRepository;

@Override
public PolicyInfoResponseDTO.DeletePolicyInfoDTO delete(Long userId, Long policyInfoId) {
public PolicyInfoResponseDTO.DeletePolicyInfoDTO delete(Long policyInfoId, Long userId) {
log.info("[삭제 시도] userId: {}, policyInfoId: {}", userId, policyInfoId);

userRepository.findById(userId)
.orElseThrow(() -> new UserHandler(ErrorStatus.USER_NOT_FOUND));

PolicyInfo policyInfo = policyInfoRepository.findByIdAndUserId(policyInfoId, userId)
.orElseThrow(() -> new PolicyInfoHandler(ErrorStatus.POLICY_INFO_NOT_FOUND));
.orElseThrow(() -> {
log.warn("[삭제 실패] policyInfoId: {}는 userId: {}의 데이터가 아님 또는 없음", policyInfoId, userId);
return new PolicyInfoHandler(ErrorStatus.POLICY_INFO_NOT_FOUND);
});

policyInfoRepository.deleteById(policyInfoId);

log.info("[삭제 성공] policyInfoId: {}", policyInfoId);

return PolicyInfoConverter.DeletePolicyInfoDTO(policyInfo);
}

}