-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] 타임라인 조회
- Loading branch information
Showing
14 changed files
with
270 additions
and
31 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
3 changes: 3 additions & 0 deletions
3
src/main/java/com/tiki/server/document/repository/DocumentRepository.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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package com.tiki.server.document.repository; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import com.tiki.server.document.entity.Document; | ||
|
||
public interface DocumentRepository extends JpaRepository<Document, Long> { | ||
List<Document> findAllByTimeBlockId(long timeBlockId); | ||
} |
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,24 @@ | ||
package com.tiki.server.document.vo; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
import com.tiki.server.document.entity.Document; | ||
|
||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder(access = PRIVATE) | ||
public record DocumentVO( | ||
long documentId, | ||
@NonNull String fileName, | ||
@NonNull String fileUrl | ||
) { | ||
|
||
public static DocumentVO from(Document document) { | ||
return DocumentVO.builder() | ||
.documentId(document.getId()) | ||
.fileName(document.getFileName()) | ||
.fileUrl(document.getFileUrl()) | ||
.build(); | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
src/main/java/com/tiki/server/timeblock/dto/response/TimelineGetResponse.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,43 @@ | ||
package com.tiki.server.timeblock.dto.response; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
import com.tiki.server.timeblock.vo.TimeBlockVO; | ||
|
||
import lombok.Builder; | ||
import lombok.NonNull; | ||
|
||
@Builder(access = PRIVATE) | ||
public record TimelineGetResponse( | ||
List<TimeBlockGetResponse> timeBlocks | ||
) { | ||
|
||
public static TimelineGetResponse from(List<TimeBlockVO> timeBlockVOs) { | ||
return TimelineGetResponse.builder() | ||
.timeBlocks(timeBlockVOs.stream().map(TimeBlockGetResponse::from).toList()) | ||
.build(); | ||
} | ||
|
||
@Builder(access = PRIVATE) | ||
public record TimeBlockGetResponse( | ||
long timeBlockId, | ||
@NonNull String name, | ||
@NonNull String color, | ||
@NonNull LocalDate startDate, | ||
@NonNull LocalDate endDate | ||
) { | ||
|
||
public static TimeBlockGetResponse from(TimeBlockVO timeBlockVO) { | ||
return TimeBlockGetResponse.builder() | ||
.timeBlockId(timeBlockVO.timeBlockId()) | ||
.name(timeBlockVO.name()) | ||
.color(timeBlockVO.color()) | ||
.startDate(timeBlockVO.startDate()) | ||
.endDate(timeBlockVO.endDate()) | ||
.build(); | ||
} | ||
} | ||
} |
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
12 changes: 10 additions & 2 deletions
12
src/main/java/com/tiki/server/timeblock/repository/TimeBlockRepository.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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
package com.tiki.server.timeblock.repository; | ||
|
||
import org.springframework.data.repository.CrudRepository; | ||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import com.tiki.server.timeblock.entity.TimeBlock; | ||
|
||
public interface TimeBlockRepository extends CrudRepository<TimeBlock, Long> { | ||
public interface TimeBlockRepository extends JpaRepository<TimeBlock, Long> { | ||
|
||
@Query(value = "select * from time_block " | ||
+ "where team_id = :teamId and accessible_position = :position and to_char(created_at, 'YYYY-MM') = :date " | ||
+ "order by start_date DESC", nativeQuery = true) | ||
List<TimeBlock> findByTeamAndAccessiblePositionAndDate(long teamId, String position, String date); | ||
} |
Oops, something went wrong.