fix: conflict 처리

This commit is contained in:
kgc9007 2024-07-18 15:03:16 +09:00
parent b9cd3de043
commit 83c4172c62
4 changed files with 13 additions and 13 deletions

View File

@ -1,7 +1,7 @@
package com.edufocus.edufocus.lecture.controller; package com.edufocus.edufocus.lecture.controller;
import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.lecture.entity.Lecture;
import com.edufocus.edufocus.lecture.entity.LectureCreateRequest; import com.edufocus.edufocus.lecture.entity.LectureRegist;
import com.edufocus.edufocus.lecture.service.LectureService; import com.edufocus.edufocus.lecture.service.LectureService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -20,8 +20,8 @@ public class LectureController {
private final LectureService lectureService; private final LectureService lectureService;
@PostMapping @PostMapping
public ResponseEntity<?> createLecture (@RequestBody long userId, @RequestBody LectureCreateRequest lectureCreateRequest) { public ResponseEntity<?> createLecture (@RequestBody long userId, @RequestBody LectureRegist lectureRegist) {
lectureService.createLecture(userId, lectureCreateRequest); lectureService.createLecture(userId, lectureRegist);
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
} }

View File

@ -10,7 +10,7 @@ import java.util.Date;
@Getter @Getter
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class LectureCreateRequest { public class LectureRegist {
private String title; private String title;

View File

@ -1,7 +1,7 @@
package com.edufocus.edufocus.lecture.service; package com.edufocus.edufocus.lecture.service;
import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.lecture.entity.Lecture;
import com.edufocus.edufocus.lecture.entity.LectureCreateRequest; import com.edufocus.edufocus.lecture.entity.LectureRegist;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -10,7 +10,7 @@ import java.util.List;
@Service @Service
public interface LectureService { public interface LectureService {
void createLecture(long userId, LectureCreateRequest lectureCreateRequest); void createLecture(long userId, LectureRegist lectureRegist);
boolean deleteLecture(long userId, long LectureId); boolean deleteLecture(long userId, long LectureId);

View File

@ -1,7 +1,7 @@
package com.edufocus.edufocus.lecture.service; package com.edufocus.edufocus.lecture.service;
import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.lecture.entity.Lecture;
import com.edufocus.edufocus.lecture.entity.LectureCreateRequest; import com.edufocus.edufocus.lecture.entity.LectureRegist;
import com.edufocus.edufocus.lecture.repository.LectureRepository; import com.edufocus.edufocus.lecture.repository.LectureRepository;
import com.edufocus.edufocus.user.model.entity.User; import com.edufocus.edufocus.user.model.entity.User;
import com.edufocus.edufocus.user.model.repository.UserRepository; import com.edufocus.edufocus.user.model.repository.UserRepository;
@ -21,18 +21,18 @@ public class LectureServiceImpl implements LectureService {
private final UserRepository userRepository; private final UserRepository userRepository;
@Override @Override
public void createLecture(long userId, LectureCreateRequest lectureCreateRequest) { public void createLecture(long userId, LectureRegist lectureRegist) {
User user = userRepository.findById(userId).get(); User user = userRepository.findById(userId).get();
Lecture lecture = new Lecture(); Lecture lecture = new Lecture();
lecture.setUser(user); lecture.setUser(user);
lecture.setTitle(lectureCreateRequest.getTitle()); lecture.setTitle(lectureRegist.getTitle());
lecture.setDescription(lectureCreateRequest.getDescription()); lecture.setDescription(lectureRegist.getDescription());
lecture.setStartDate(lectureCreateRequest.getStartDate()); lecture.setStartDate(lectureRegist.getStartDate());
lecture.setEndDate(lectureCreateRequest.getEndDate()); lecture.setEndDate(lectureRegist.getEndDate());
lecture.setPlan(lectureCreateRequest.getPlan()); lecture.setPlan(lectureRegist.getPlan());
lectureRepository.save(lecture); lectureRepository.save(lecture);
} }