-
Notifications
You must be signed in to change notification settings - Fork 1
홈 화면 목표 조회 API 연동 #62
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
26 commits
Select commit
Hold shift + click to select a range
2ada90d
♻️ Refactor: RepeatType -> RepeatCycle로 변경
dogmania c0aea12
✨ Feat: :core:result 의존성 추가
dogmania 3766e91
♻️ Refactor: androidLibrary -> Java Library로 변경
dogmania 39512e4
✨ Feat: :domain 의존성 추가
dogmania 9cc031d
✨ Feat: :core:result 의존성 추가
dogmania ada22ae
✨ Feat: GoalService 구현
dogmania 4004540
✨ Feat: fetchGoals API 메서드 연동
dogmania b5cc305
✨ Feat: 목표 조회 Domain Model 구현
dogmania 3e1baaa
✨ Feat: 목표 조회 DTO 구현
dogmania 5d4fc8a
✨ Feat: 목표 DTO -> Domain Mapper 구현
dogmania 3fa3cc3
✨ Feat: GoalService Koin 모듈 등록
dogmania 9ee1f1b
♻️ Refactor: api/v1 추가
dogmania 130212d
♻️ Refactor: onError 메서드 suspend로 변경
dogmania 357719e
✨ Feat: GoalRepository Koin 모듈 등록
dogmania 1f2d5be
✨ Feat: fromApi 메서드 구현
dogmania 84a796a
✨ Feat: 목표 조회 비즈니스 로직 연결 및 상태 처리
dogmania 868967e
🍱 Chore: string 리소스 추가
dogmania 8d2b98d
♻️ Refactor: DTO icon을 GoalIconType으로 변환
dogmania 1cc01d8
✨ Feat: GoalIconType.toRes 확장 메서드 구현
dogmania 17d4af2
♻️ Refactor: :core:design-system의 toRes를 사용하도록 변경
dogmania 4603db3
🍱 Chore: 아이콘 추가
dogmania 82cfeb7
🔥 Remove: 불필요한 주석 제거
dogmania 0b10ada
🐛 Fix: conflict 해결
dogmania d5fe299
♻️ Refactor: api/v1/ 추가
dogmania e5f4de6
♻️ Refactor: import 알바펫 순으로 정렬
dogmania dc4e6f8
♻️ Refactor: ktlint 적용
dogmania 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
16 changes: 16 additions & 0 deletions
16
core/design-system/src/main/java/com/twix/designsystem/extension/GoalIconType.kt
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,16 @@ | ||
| package com.twix.designsystem.extension | ||
|
|
||
| import com.twix.designsystem.R | ||
| import com.twix.domain.model.enums.GoalIconType | ||
|
|
||
| fun GoalIconType.toRes(): Int = | ||
| when (this) { | ||
| GoalIconType.DEFAULT -> R.drawable.ic_default | ||
| GoalIconType.CLEAN -> R.drawable.ic_clean | ||
| GoalIconType.EXERCISE -> R.drawable.ic_exercise | ||
| GoalIconType.BOOK -> R.drawable.ic_book | ||
| GoalIconType.PENCIL -> R.drawable.ic_pencil | ||
| GoalIconType.HEALTH -> R.drawable.ic_health | ||
| GoalIconType.HEART -> R.drawable.ic_heart | ||
| GoalIconType.LAPTOP -> R.drawable.ic_laptop | ||
| } |
18 changes: 18 additions & 0 deletions
18
core/design-system/src/main/res/drawable/ic_checked_me.xml
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,18 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="28dp" | ||
| android:height="28dp" | ||
| android:viewportWidth="28" | ||
| android:viewportHeight="28"> | ||
| <path | ||
| android:strokeWidth="1" | ||
| android:pathData="M14,14m-11.5,0a11.5,11.5 0,1 1,23 0a11.5,11.5 0,1 1,-23 0" | ||
| android:fillColor="#171717" | ||
| android:strokeColor="#171717"/> | ||
| <path | ||
| android:pathData="M9,12.947L13.167,18L19,10" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="1.2" | ||
| android:fillColor="#00000000" | ||
| android:strokeColor="#ffffff" | ||
| android:strokeLineCap="round"/> | ||
| </vector> |
27 changes: 27 additions & 0 deletions
27
core/design-system/src/main/res/drawable/ic_checked_you.xml
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,27 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="28dp" | ||
| android:height="28dp" | ||
| android:viewportWidth="28" | ||
| android:viewportHeight="28"> | ||
| <group> | ||
| <clip-path | ||
| android:pathData="M0,0h28v28h-28z"/> | ||
| <path | ||
| android:pathData="M14,14m-12.7,0a12.7,12.7 0,1 1,25.4 0a12.7,12.7 0,1 1,-25.4 0" | ||
| android:strokeWidth="1.4" | ||
| android:fillColor="#00000000" | ||
| android:strokeColor="#ffffff"/> | ||
| <path | ||
| android:strokeWidth="1" | ||
| android:pathData="M14,14m-11.5,0a11.5,11.5 0,1 1,23 0a11.5,11.5 0,1 1,-23 0" | ||
| android:fillColor="#171717" | ||
| android:strokeColor="#171717"/> | ||
| <path | ||
| android:pathData="M9,12.947L13.167,18L19,10" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="1.2" | ||
| android:fillColor="#00000000" | ||
| android:strokeColor="#ffffff" | ||
| android:strokeLineCap="round"/> | ||
| </group> | ||
| </vector> |
27 changes: 27 additions & 0 deletions
27
core/design-system/src/main/res/drawable/ic_unchecked_me.xml
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,27 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="28dp" | ||
| android:height="28dp" | ||
| android:viewportWidth="28" | ||
| android:viewportHeight="28"> | ||
| <group> | ||
| <clip-path | ||
| android:pathData="M0,0h28v28h-28z"/> | ||
| <path | ||
| android:pathData="M14,14m-12.7,0a12.7,12.7 0,1 1,25.4 0a12.7,12.7 0,1 1,-25.4 0" | ||
| android:strokeWidth="1.4" | ||
| android:fillColor="#00000000" | ||
| android:strokeColor="#ffffff"/> | ||
| <path | ||
| android:strokeWidth="1" | ||
| android:pathData="M14,14m-11.5,0a11.5,11.5 0,1 1,23 0a11.5,11.5 0,1 1,-23 0" | ||
| android:fillColor="#ffffff" | ||
| android:strokeColor="#171717"/> | ||
| <path | ||
| android:pathData="M9,12.947L13.167,18L19,10" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="1.2" | ||
| android:fillColor="#00000000" | ||
| android:strokeColor="#ffffff" | ||
| android:strokeLineCap="round"/> | ||
| </group> | ||
| </vector> |
18 changes: 18 additions & 0 deletions
18
core/design-system/src/main/res/drawable/ic_unchecked_you.xml
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,18 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="28dp" | ||
| android:height="28dp" | ||
| android:viewportWidth="28" | ||
| android:viewportHeight="28"> | ||
| <path | ||
| android:strokeWidth="1" | ||
| android:pathData="M14,14m-11.5,0a11.5,11.5 0,1 1,23 0a11.5,11.5 0,1 1,-23 0" | ||
| android:fillColor="#ffffff" | ||
| android:strokeColor="#C6C6C6"/> | ||
| <path | ||
| android:pathData="M9,12.947L13.167,18L19,10" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="1.2" | ||
| android:fillColor="#00000000" | ||
| android:strokeColor="#ffffff" | ||
| android:strokeLineCap="round"/> | ||
| </vector> |
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
38 changes: 38 additions & 0 deletions
38
core/network/src/main/java/com/twix/network/model/response/goal/mapper/GoalMapper.kt
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,38 @@ | ||
| package com.twix.network.model.response.goal.mapper | ||
|
|
||
| import com.twix.domain.model.enums.GoalIconType | ||
| import com.twix.domain.model.enums.RepeatCycle | ||
| import com.twix.domain.model.goal.Goal | ||
| import com.twix.domain.model.goal.GoalList | ||
| import com.twix.domain.model.goal.GoalVerification | ||
| import com.twix.network.model.response.goal.model.GoalListResponse | ||
| import com.twix.network.model.response.goal.model.GoalResponse | ||
| import com.twix.network.model.response.goal.model.VerificationResponse | ||
|
|
||
| fun GoalListResponse.toDomain(): GoalList = | ||
| GoalList( | ||
| completedCount = completedCount, | ||
| totalCount = totalCount, | ||
| goals = goals.map { it.toDomain() }, | ||
| ) | ||
|
|
||
| fun GoalResponse.toDomain(): Goal = | ||
| Goal( | ||
| goalId = goalId, | ||
| name = name, | ||
| icon = GoalIconType.fromApi(icon), | ||
| repeatCycle = RepeatCycle.fromApi(repeatCycle), | ||
| myCompleted = myCompleted, | ||
| partnerCompleted = partnerCompleted, | ||
| myVerification = myVerification?.toDomainOrNull(), | ||
| partnerVerification = partnerVerification?.toDomainOrNull(), | ||
| ) | ||
|
|
||
| fun VerificationResponse.toDomainOrNull(): GoalVerification? = | ||
| GoalVerification( | ||
| photologId = photologId, | ||
| imageUrl = imageUrl, | ||
| comment = comment, | ||
| reaction = reaction, | ||
| uploadedAt = uploadedAt, | ||
| ) |
11 changes: 11 additions & 0 deletions
11
core/network/src/main/java/com/twix/network/model/response/goal/model/GoalListResponse.kt
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,11 @@ | ||
| package com.twix.network.model.response.goal.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class GoalListResponse( | ||
| @SerialName("completedCount") val completedCount: Int, | ||
| @SerialName("totalCount") val totalCount: Int, | ||
| @SerialName("goals") val goals: List<GoalResponse>, | ||
| ) |
16 changes: 16 additions & 0 deletions
16
core/network/src/main/java/com/twix/network/model/response/goal/model/GoalResponse.kt
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,16 @@ | ||
| package com.twix.network.model.response.goal.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class GoalResponse( | ||
| @SerialName("goalId") val goalId: Long, | ||
| @SerialName("name") val name: String, | ||
| @SerialName("icon") val icon: String, | ||
| @SerialName("repeatCycle") val repeatCycle: String, | ||
| @SerialName("myCompleted") val myCompleted: Boolean, | ||
| @SerialName("partnerCompleted") val partnerCompleted: Boolean, | ||
| @SerialName("myVerification") val myVerification: VerificationResponse? = null, | ||
| @SerialName("partnerVerification") val partnerVerification: VerificationResponse? = null, | ||
| ) |
13 changes: 13 additions & 0 deletions
13
.../network/src/main/java/com/twix/network/model/response/goal/model/VerificationResponse.kt
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,13 @@ | ||
| package com.twix.network.model.response.goal.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class VerificationResponse( | ||
| @SerialName("photologId") val photologId: Long, | ||
| @SerialName("imageUrl") val imageUrl: String, | ||
| @SerialName("comment") val comment: String? = null, | ||
| @SerialName("reaction") val reaction: String? = null, | ||
| @SerialName("uploadedAt") val uploadedAt: String, // yyyy-mm-dd | ||
| ) | ||
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
12 changes: 12 additions & 0 deletions
12
core/network/src/main/java/com/twix/network/service/GoalService.kt
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,12 @@ | ||
| package com.twix.network.service | ||
|
|
||
| import com.twix.network.model.response.goal.model.GoalListResponse | ||
| import de.jensklingenberg.ktorfit.http.GET | ||
| import de.jensklingenberg.ktorfit.http.Query | ||
|
|
||
| interface GoalService { | ||
| @GET("api/v1/goals") | ||
| suspend fun fetchGoals( | ||
| @Query("date") date: String, | ||
| ): GoalListResponse | ||
| } |
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,7 +1,3 @@ | ||
| plugins { | ||
| alias(libs.plugins.twix.android.library) | ||
| } | ||
|
|
||
| android { | ||
| namespace = "com.twix.result" | ||
| alias(libs.plugins.twix.java.library) | ||
| } |
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
14 changes: 14 additions & 0 deletions
14
data/src/main/java/com/twix/data/repository/DefaultGoalRepository.kt
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,14 @@ | ||
| package com.twix.data.repository | ||
|
|
||
| import com.twix.domain.model.goal.GoalList | ||
| import com.twix.domain.repository.GoalRepository | ||
| import com.twix.network.execute.safeApiCall | ||
| import com.twix.network.model.response.goal.mapper.toDomain | ||
| import com.twix.network.service.GoalService | ||
| import com.twix.result.AppResult | ||
|
|
||
| class DefaultGoalRepository( | ||
| private val service: GoalService, | ||
| ) : GoalRepository { | ||
| override suspend fun fetchGoalList(date: String): AppResult<GoalList> = safeApiCall { service.fetchGoals(date).toDomain() } | ||
| } |
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,3 +1,7 @@ | ||
| plugins { | ||
| alias(libs.plugins.twix.java.library) | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation(projects.core.result) | ||
| } |
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
12 changes: 12 additions & 0 deletions
12
domain/src/main/java/com/twix/domain/model/enums/RepeatCycle.kt
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,12 @@ | ||
| package com.twix.domain.model.enums | ||
|
|
||
| enum class RepeatCycle { | ||
| DAILY, | ||
| WEEKLY, | ||
| MONTHLY, | ||
| ; | ||
|
|
||
| companion object { | ||
| fun fromApi(value: String): RepeatCycle = runCatching { valueOf(value) }.getOrElse { DAILY } | ||
| } | ||
| } |
7 changes: 0 additions & 7 deletions
7
domain/src/main/java/com/twix/domain/model/enums/RepeatType.kt
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
| package com.twix.domain.model.goal | ||
|
|
||
| import com.twix.domain.model.enums.GoalIconType | ||
| import com.twix.domain.model.enums.RepeatCycle | ||
|
|
||
| data class Goal( | ||
| val goalId: Long, | ||
| val name: String, | ||
| val icon: GoalIconType, | ||
| val repeatCycle: RepeatCycle, | ||
| val myCompleted: Boolean, | ||
| val partnerCompleted: Boolean, | ||
| val myVerification: GoalVerification?, | ||
| val partnerVerification: GoalVerification?, | ||
| ) |
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,7 @@ | ||
| package com.twix.domain.model.goal | ||
|
|
||
| data class GoalList( | ||
| val completedCount: Int = 0, | ||
| val totalCount: Int = 0, | ||
| val goals: List<Goal> = emptyList(), | ||
| ) |
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.
Uh oh!
There was an error while loading. Please reload this page.