-
Notifications
You must be signed in to change notification settings - Fork 2
feat:레슨수정강사용 #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat:레슨수정강사용 #108
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -37,4 +37,4 @@ public record LessonDetailResponseDto( | |
| LocalDateTime updatedAt, | ||
| List<String> lessonImages | ||
| ) { | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -46,4 +46,4 @@ public static MyLessonApplicationListResponseDto toDtoListWithCount(List<LessonA | |
| count | ||
| ); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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
72 changes: 72 additions & 0 deletions
72
src/main/java/com/threestar/trainus/domain/lesson/teacher/dto/LessonUpdateRequestDto.java
This file contains hidden or 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,72 @@ | ||
| package com.threestar.trainus.domain.lesson.teacher.dto; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| import com.threestar.trainus.domain.lesson.teacher.entity.Category; | ||
|
|
||
| import jakarta.validation.constraints.Max; | ||
| import jakarta.validation.constraints.Min; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| /** | ||
| * 레슨 수정 요청 데이터 | ||
| */ | ||
| public record LessonUpdateRequestDto( | ||
|
|
||
| @Size(max = 50, message = "레슨명은 50자 이내여야 합니다.") | ||
| String lessonName, | ||
|
|
||
| @Size(max = 255, message = "레슨 설명은 255자 이내여야 합니다.") | ||
| String description, | ||
|
|
||
| Category category, | ||
|
|
||
| @Min(value = 0, message = "가격은 0원 이상이어야 합니다.") | ||
| Integer price, | ||
|
|
||
| @Min(value = 1, message = "최대 참가 인원은 1명 이상이어야 합니다.") | ||
| @Max(value = 100, message = "최대 참가 인원은 100명 이하여야 합니다.") | ||
| Integer maxParticipants, | ||
|
|
||
| LocalDateTime startAt, | ||
|
|
||
| LocalDateTime endAt, | ||
|
|
||
| LocalDateTime openTime, | ||
|
|
||
| Boolean openRun, | ||
|
|
||
| @Size(max = 10, message = "시/도는 10자 이하여야 합니다.") | ||
| String city, | ||
|
|
||
| @Size(max = 10, message = "시/군/구는 10자 이하여야 합니다.") | ||
| String district, | ||
|
|
||
| @Size(max = 10, message = "읍/면/동은 10자 이하여야 합니다.") | ||
| String dong, | ||
|
|
||
| @Size(max = 25, message = "상세주소는 25자 이하여야 합니다.") | ||
| String addressDetail, | ||
|
|
||
| @Size(max = 5, message = "이미지는 최대 5장까지 첨부 가능합니다.") | ||
| List<String> lessonImages | ||
|
|
||
| ) { | ||
|
|
||
| // 레슨이름, 설명, 이미지는 항상 수정가능 | ||
| public boolean hasBasicInfoChanges() { | ||
| return lessonName != null || description != null || (lessonImages != null && !lessonImages.isEmpty()); | ||
| } | ||
|
|
||
| // 제한된 필드들은 수정(참가자 없을때만 가능) | ||
| public boolean hasRestrictedChanges() { | ||
| return category != null || price != null || startAt != null || endAt != null || openTime != null | ||
| || openRun != null || city != null || district != null || dong != null || addressDetail != null; | ||
| } | ||
|
|
||
| //시간 관련 필드 수정 체크 | ||
| public boolean hasTimeChanges() { | ||
| return startAt != null || endAt != null; | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/threestar/trainus/domain/lesson/teacher/dto/LessonUpdateResponseDto.java
This file contains hidden or 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,36 @@ | ||
| package com.threestar.trainus.domain.lesson.teacher.dto; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| import com.threestar.trainus.domain.lesson.teacher.entity.Category; | ||
| import com.threestar.trainus.domain.lesson.teacher.entity.LessonStatus; | ||
|
|
||
| import lombok.Builder; | ||
|
|
||
| /** | ||
| * 레슨 수정 응답 데이터 | ||
| */ | ||
| @Builder | ||
| public record LessonUpdateResponseDto( | ||
| Long id, | ||
| String lessonName, | ||
| String description, | ||
| Long lessonLeader, | ||
| Category category, | ||
| Integer price, | ||
| Integer maxParticipants, | ||
| LocalDateTime startAt, | ||
| LocalDateTime endAt, | ||
| LocalDateTime openTime, | ||
| Boolean openRun, | ||
| String city, | ||
| String district, | ||
| String dong, | ||
| String addressDetail, | ||
| LessonStatus status, | ||
| LocalDateTime createdAt, | ||
| LocalDateTime updatedAt, | ||
| List<String> lessonImages | ||
| ) { | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setter 없이 적절하게 설계된 것 같습니다.
requestDto를 받아 update()메서드로 수정 메서드들을 하나로 묶는 방법도 있을 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update()메서드안에서 조건에 대한 검증을 또 해야 되는데 이방법이 더 복잡해 질것 같아서 개별 메소드로 설계하였습니당!