-
Notifications
You must be signed in to change notification settings - Fork 0
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
[TNT-178] 트레이너 홈화면 캘린더 구현 #68
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
45c2c66
[TNT-178] feat: 홈 화면에서 공통으로 사용 가능한 TopBar 구현
hoyahozz 3033c57
[TNT-178] feat: 홈 화면 캘린더 관련 contract 정의
hoyahozz 212536a
[TNT-178] feat: 홈 화면 내 캘린더 UI 연동
hoyahozz c1439ea
[TNT-178] feat: 캘린더 내 오늘 날짜 UI 구현
hoyahozz 84fadab
[TNT-178] feat: DateFormatter 구현
hoyahozz e31c181
[TNT-178] feat: 트레이너 월간 PT 횟수 조회 API 호출 구현
hoyahozz db85152
[TNT-178] feat: 트레이너 월간 PT 횟수 조회 API, UI 연동
hoyahozz 985fc56
[TNT-178] refactor: 데이터 캐싱 로직 구현 및 성능 개선
hoyahozz bb77f6d
[TNT-178] fix: 월간 캘린더의 '주' 사이에 Margin 추가
hoyahozz e14ef9b
[TNT-178] refactor: 변수명 수정
hoyahozz e1de78e
[TNT-179] fix: TopBar 를 상하 스크롤 영역에 포함 처리
hoyahozz 397b573
[TNT-178] Merge branch 'develop' into feature/TNT-178
hoyahozz 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 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
22 changes: 22 additions & 0 deletions
22
.../network/src/main/java/co/kr/data/network/model/trainer/MonthlyPtSessionCountsResponse.kt
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,22 @@ | ||
package co.kr.data.network.model.trainer | ||
|
||
import co.kr.tnt.domain.model.trainer.DailyPtSessionCount | ||
import co.kr.tnt.domain.utils.DateFormatter | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MonthlyPtSessionCountsResponse( | ||
val calendarPtLessonCounts: List<PtSessionCountsResponse>, | ||
) | ||
|
||
@Serializable | ||
data class PtSessionCountsResponse( | ||
val date: String, | ||
val count: Int, | ||
) | ||
|
||
fun PtSessionCountsResponse.toDomain(dateFormatter: DateFormatter) = | ||
DailyPtSessionCount( | ||
date = dateFormatter.parse(date), | ||
count = count, | ||
) |
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: 22 additions & 0 deletions
22
data/network/src/main/java/co/kr/data/network/source/TrainerRemoteDataSource.kt
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,22 @@ | ||
package co.kr.data.network.source | ||
|
||
import co.kr.data.network.model.trainer.MonthlyPtSessionCountsResponse | ||
import co.kr.data.network.service.ApiService | ||
import co.kr.data.network.util.networkHandler | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class TrainerRemoteDataSource @Inject constructor( | ||
private val apiService: ApiService, | ||
) { | ||
suspend fun getMonthlyPtSessionCounts( | ||
year: Int, | ||
month: Int, | ||
): MonthlyPtSessionCountsResponse = networkHandler { | ||
apiService.getMonthlyPtSessionCounts( | ||
year = year, | ||
month = month, | ||
) | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
data/repository/src/main/java/co/kr/data/repository/TrainerRepositoryImpl.kt
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 co.kr.data.repository | ||
|
||
import co.kr.data.network.model.trainer.toDomain | ||
import co.kr.data.network.source.TrainerRemoteDataSource | ||
import co.kr.tnt.domain.model.trainer.DailyPtSessionCount | ||
import co.kr.tnt.domain.repository.TrainerRepository | ||
import co.kr.tnt.domain.utils.DateFormatter | ||
import java.time.YearMonth | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
internal class TrainerRepositoryImpl @Inject constructor( | ||
private val trainerRemoteDataSource: TrainerRemoteDataSource, | ||
private val dateFormatter: DateFormatter, | ||
) : TrainerRepository { | ||
override suspend fun getMonthlyPtSessionCounts(yearMonth: YearMonth): List<DailyPtSessionCount> = | ||
trainerRemoteDataSource.getMonthlyPtSessionCounts( | ||
year = yearMonth.year, | ||
month = yearMonth.monthValue, | ||
).calendarPtLessonCounts.map { response -> | ||
response.toDomain(dateFormatter) | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
domain/src/main/java/co/kr/tnt/domain/model/trainer/DailyPtSessionCount.kt
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,8 @@ | ||
package co.kr.tnt.domain.model.trainer | ||
|
||
import java.time.LocalDate | ||
|
||
data class DailyPtSessionCount( | ||
val date: LocalDate, | ||
val count: Int, | ||
) |
8 changes: 8 additions & 0 deletions
8
domain/src/main/java/co/kr/tnt/domain/repository/TrainerRepository.kt
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,8 @@ | ||
package co.kr.tnt.domain.repository | ||
|
||
import co.kr.tnt.domain.model.trainer.DailyPtSessionCount | ||
import java.time.YearMonth | ||
|
||
interface TrainerRepository { | ||
suspend fun getMonthlyPtSessionCounts(yearMonth: YearMonth): List<DailyPtSessionCount> | ||
} |
27 changes: 27 additions & 0 deletions
27
domain/src/main/java/co/kr/tnt/domain/utils/DateFormatter.kt
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,27 @@ | ||
package co.kr.tnt.domain.utils | ||
|
||
import java.time.LocalDate | ||
import java.time.format.DateTimeFormatter | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class DateFormatter @Inject constructor() { | ||
fun parse( | ||
rawDate: String, | ||
formatter: DateTimeFormatter = DEFAULT_DATE_FORMAT, | ||
): LocalDate { | ||
require(rawDate.isNotBlank()) | ||
|
||
return LocalDate.parse(rawDate, formatter) | ||
} | ||
|
||
fun format( | ||
date: LocalDate, | ||
formatter: DateTimeFormatter = DEFAULT_DATE_FORMAT, | ||
): String = formatter.format(date) | ||
|
||
companion object { | ||
private val DEFAULT_DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd") | ||
} | ||
} |
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
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.
억 감사합니다