-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEV-28] 커스텀 수강과목 수정 api 분리 생성 삭제 (#249)
* refactor: UpdateTakenLectureController update -> generate, delete로 분리 * feat: 수강과목 삭제 UseCase * feat: 수강과목 삭제 Service * refactor: 수강과목 삭제 Port id 단건 삭제로 변경 * refactor: 수강과목 삭제 Adapter id 단건 삭제로 변경 * feat: application 레벨 수강 과목 생성 로직 추가 * feat: 수강과목 저장 로직 추가 * feat: 과목 id에 의한 과목 단건 조회 * refactor: UpdateTakenLectureController update -> generate, delete로 분리 * refactor: UpdateTakenLectureController update -> generate, delete로 분리로 인한 파일 삭제 * feat: 수강과목 삭제 로직 추가 * test: spring test container 통합을 위한 test 설정 * test: UpdateTakenLectureController update -> generate, delete로 분리로 test * refactor: Semester 타입 String으로 설정 * refactor: Controller 메서드명 변경 * refactor: Controller 메서드명 변경 * refactor: path variable 변수명 camel case로 변경 * refactor: parsing으로 인한 수강과목 생성과 구분되도록 customize 명시 * refactor: DeleteTakenLecture UseCase Service 통합
- Loading branch information
나경호
authored
Apr 12, 2024
1 parent
1ebe900
commit 834c517
Showing
32 changed files
with
367 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...myongjigraduatebe/takenlecture/api/dto/request/GenerateCustomizedTakenLectureRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.plzgraduate.myongjigraduatebe.takenlecture.api.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class GenerateCustomizedTakenLectureRequest { | ||
|
||
@Schema(name = "lectureId", example = "103") | ||
private Long lectureId; | ||
|
||
@Builder | ||
private GenerateCustomizedTakenLectureRequest(Long lectureId) { | ||
this.lectureId = lectureId; | ||
} | ||
} |
26 changes: 0 additions & 26 deletions
26
...plzgraduate/myongjigraduatebe/takenlecture/api/dto/request/UpdateTakenLectureRequest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...jigraduatebe/takenlecture/application/service/delete/DeleteTakenLectureByUserService.java
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
.../myongjigraduatebe/takenlecture/application/service/delete/DeleteTakenLectureService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.plzgraduate.myongjigraduatebe.takenlecture.application.service.delete; | ||
|
||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import com.plzgraduate.myongjigraduatebe.completedcredit.application.usecase.GenerateOrModifyCompletedCreditUseCase; | ||
import com.plzgraduate.myongjigraduatebe.core.meta.UseCase; | ||
import com.plzgraduate.myongjigraduatebe.takenlecture.application.usecase.delete.DeleteTakenLectureUseCase; | ||
import com.plzgraduate.myongjigraduatebe.takenlecture.application.port.DeleteTakenLecturePort; | ||
import com.plzgraduate.myongjigraduatebe.user.application.usecase.find.FindUserUseCase; | ||
import com.plzgraduate.myongjigraduatebe.user.domain.model.User; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@UseCase | ||
@Transactional | ||
@RequiredArgsConstructor | ||
class DeleteTakenLectureService implements DeleteTakenLectureUseCase { | ||
|
||
private final FindUserUseCase findUserUseCase; | ||
private final DeleteTakenLecturePort deleteTakenLecturePort; | ||
private final GenerateOrModifyCompletedCreditUseCase generateOrModifyCompletedCreditUseCase; | ||
|
||
@Override | ||
public void deleteAllTakenLecturesByUser(User user) { | ||
deleteTakenLecturePort.deleteAllTakenLecturesByUser(user); | ||
} | ||
|
||
@Override | ||
public void deleteTakenLecture(Long userId, Long deletedTakenLectureId) { | ||
User user = findUserUseCase.findUserById(userId); | ||
deleteTakenLecturePort.deleteTakenLectureById(deletedTakenLectureId); | ||
generateOrModifyCompletedCreditUseCase.generateOrModifyCompletedCredit(user); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...aduatebe/takenlecture/application/service/save/GenerateCustomizedTakenLectureService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.plzgraduate.myongjigraduatebe.takenlecture.application.service.save; | ||
|
||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import com.plzgraduate.myongjigraduatebe.completedcredit.application.usecase.GenerateOrModifyCompletedCreditUseCase; | ||
import com.plzgraduate.myongjigraduatebe.core.meta.UseCase; | ||
import com.plzgraduate.myongjigraduatebe.lecture.application.port.FindLecturePort; | ||
import com.plzgraduate.myongjigraduatebe.lecture.domain.model.Lecture; | ||
import com.plzgraduate.myongjigraduatebe.takenlecture.application.port.SaveTakenLecturePort; | ||
import com.plzgraduate.myongjigraduatebe.takenlecture.application.usecase.save.GenerateCustomizedTakenLectureUseCase; | ||
import com.plzgraduate.myongjigraduatebe.takenlecture.domain.model.TakenLecture; | ||
import com.plzgraduate.myongjigraduatebe.user.application.usecase.find.FindUserUseCase; | ||
import com.plzgraduate.myongjigraduatebe.user.domain.model.User; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@UseCase | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class GenerateCustomizedTakenLectureService implements GenerateCustomizedTakenLectureUseCase { | ||
|
||
private final FindUserUseCase findUserUseCase; | ||
private final FindLecturePort findLecturePort; | ||
private final SaveTakenLecturePort saveTakenLecturePort; | ||
private final GenerateOrModifyCompletedCreditUseCase generateOrModifyCompletedCreditUseCase; | ||
|
||
@Override | ||
public void generateCustomizedTakenLecture(final Long userId, final Long addedTakenLectureId) { | ||
User user = findUserUseCase.findUserById(userId); | ||
Lecture lecture = findLecturePort.findLectureById(addedTakenLectureId); | ||
addCustomTakenLecture(user, lecture); | ||
generateOrModifyCompletedCreditUseCase.generateOrModifyCompletedCredit(user); | ||
} | ||
|
||
private void addCustomTakenLecture(User user, Lecture addedLecture) { | ||
TakenLecture addedTakenLecture = TakenLecture.custom(user, addedLecture); | ||
saveTakenLecturePort.saveTakenLecture(addedTakenLecture); | ||
} | ||
} |
44 changes: 0 additions & 44 deletions
44
.../myongjigraduatebe/takenlecture/application/service/update/UpdateTakenLectureService.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...aduatebe/takenlecture/application/usecase/save/GenerateCustomizedTakenLectureUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.plzgraduate.myongjigraduatebe.takenlecture.application.usecase.save; | ||
|
||
|
||
public interface GenerateCustomizedTakenLectureUseCase { | ||
void generateCustomizedTakenLecture(Long userId, Long addedTakenLectureId); | ||
} |
10 changes: 0 additions & 10 deletions
10
.../myongjigraduatebe/takenlecture/application/usecase/update/UpdateTakenLectureUseCase.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.