fix: conflict 처리
This commit is contained in:
parent
b9cd3de043
commit
83c4172c62
@ -1,7 +1,7 @@
|
||||
package com.edufocus.edufocus.lecture.controller;
|
||||
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -20,8 +20,8 @@ public class LectureController {
|
||||
private final LectureService lectureService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<?> createLecture (@RequestBody long userId, @RequestBody LectureCreateRequest lectureCreateRequest) {
|
||||
lectureService.createLecture(userId, lectureCreateRequest);
|
||||
public ResponseEntity<?> createLecture (@RequestBody long userId, @RequestBody LectureRegist lectureRegist) {
|
||||
lectureService.createLecture(userId, lectureRegist);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import java.util.Date;
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LectureCreateRequest {
|
||||
public class LectureRegist {
|
||||
|
||||
private String title;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.edufocus.edufocus.lecture.service;
|
||||
|
||||
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 java.util.List;
|
||||
@ -10,7 +10,7 @@ import java.util.List;
|
||||
@Service
|
||||
public interface LectureService {
|
||||
|
||||
void createLecture(long userId, LectureCreateRequest lectureCreateRequest);
|
||||
void createLecture(long userId, LectureRegist lectureRegist);
|
||||
|
||||
boolean deleteLecture(long userId, long LectureId);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.edufocus.edufocus.lecture.service;
|
||||
|
||||
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.user.model.entity.User;
|
||||
import com.edufocus.edufocus.user.model.repository.UserRepository;
|
||||
@ -21,18 +21,18 @@ public class LectureServiceImpl implements LectureService {
|
||||
private final UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public void createLecture(long userId, LectureCreateRequest lectureCreateRequest) {
|
||||
public void createLecture(long userId, LectureRegist lectureRegist) {
|
||||
|
||||
User user = userRepository.findById(userId).get();
|
||||
|
||||
Lecture lecture = new Lecture();
|
||||
lecture.setUser(user);
|
||||
|
||||
lecture.setTitle(lectureCreateRequest.getTitle());
|
||||
lecture.setDescription(lectureCreateRequest.getDescription());
|
||||
lecture.setStartDate(lectureCreateRequest.getStartDate());
|
||||
lecture.setEndDate(lectureCreateRequest.getEndDate());
|
||||
lecture.setPlan(lectureCreateRequest.getPlan());
|
||||
lecture.setTitle(lectureRegist.getTitle());
|
||||
lecture.setDescription(lectureRegist.getDescription());
|
||||
lecture.setStartDate(lectureRegist.getStartDate());
|
||||
lecture.setEndDate(lectureRegist.getEndDate());
|
||||
lecture.setPlan(lectureRegist.getPlan());
|
||||
|
||||
lectureRepository.save(lecture);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user