-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: 일정 조회 및 참여 API #29
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bdabceb
[#19] fix: soft delete 적용
west-eastH 9ae3bfc
[#19] feat: 러닝 일정 조회 API
west-eastH 0d76a10
[#19] feat: 러닝 참여 API
west-eastH ffa0f17
[#19] feat: 러닝 참여 취소 API
west-eastH d0e7640
[#19] test: 러닝 일정 조회 테스트
west-eastH 84aa90f
[#19] test: 러닝 일정 참여 관련 테스트
west-eastH 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
22 changes: 22 additions & 0 deletions
22
src/main/java/run/backend/domain/event/dto/response/EventDetailResponse.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,22 @@ | ||
| package run.backend.domain.event.dto.response; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
| import run.backend.domain.event.enums.EventStatus; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| public record EventDetailResponse( | ||
| String title, | ||
| @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
| LocalDateTime startDateTime, | ||
| @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
| LocalDateTime endDateTime, | ||
| String startLocation, | ||
| EventStatus status, | ||
| String distanceKm, | ||
| String runningTime, | ||
| Long runningLeaderId, | ||
| List<ParticipantDto> participants | ||
| ) { | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/main/java/run/backend/domain/event/dto/response/ParticipantDto.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,8 @@ | ||
| package run.backend.domain.event.dto.response; | ||
|
|
||
| public record ParticipantDto( | ||
| Long id, | ||
| String name, | ||
| String image | ||
| ) { | ||
| } |
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
6 changes: 6 additions & 0 deletions
6
src/main/java/run/backend/domain/event/enums/EventStatus.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,6 @@ | ||
| package run.backend.domain.event.enums; | ||
|
|
||
| public enum EventStatus { | ||
| BEFORE, | ||
| COMPLETED; | ||
| } |
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
15 changes: 15 additions & 0 deletions
15
src/main/java/run/backend/domain/event/repository/JoinEventRepository.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 |
|---|---|---|
| @@ -1,12 +1,27 @@ | ||
| package run.backend.domain.event.repository; | ||
|
|
||
| import java.util.List; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Query; | ||
| import org.springframework.data.repository.query.Param; | ||
| import run.backend.domain.event.entity.Event; | ||
| import run.backend.domain.event.entity.JoinEvent; | ||
| import run.backend.domain.member.entity.Member; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| public interface JoinEventRepository extends JpaRepository<JoinEvent, Long> { | ||
|
|
||
| void deleteByEventAndMember(Event event, Member member); | ||
|
|
||
| @Query("SELECT j FROM JoinEvent j WHERE j.event = :event AND j.member = :member AND j.deletedAt IS NULL") | ||
| Optional<JoinEvent> findByEventAndMember(@Param("event") Event event, @Param("member") Member member); | ||
|
|
||
| @Query("SELECT j FROM JoinEvent j WHERE j.event = :event AND j.deletedAt IS NULL") | ||
| List<JoinEvent> findByEventAndNotDeleted(@Param("event") Event event); | ||
|
|
||
| @Query("SELECT j FROM JoinEvent j WHERE j.event = :event AND j.isRunning = true AND j.deletedAt IS NULL") | ||
| List<JoinEvent> findActualParticipantsByEvent(@Param("event") Event event); | ||
|
|
||
| boolean existsByEventAndMemberAndDeletedAtIsNull(Event event, Member member); | ||
| } |
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.
근데 이거 어떤거 Mapping으로 하고, 어떤건 default로 한 기준이 궁금합니다!
저는 모든 필드에 Mapping 다 할거면 그냥 default로 빌더 써서 했고, responseDto 만드는 거에 대해서만 map-struct 사용했는데 동현님은 어떤 기준으로 한건지 궁금합니다..