-
Notifications
You must be signed in to change notification settings - Fork 2
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: 레시피 추천 Response 객체 정의 * feat: 레시피와 식재료 객체를 분리한다 * feat: 변경된 레시피 객체에 맞게 저장소를 재정의한다 * refactor: 필요없는 이전 레시피 추천 객체를 삭제한다 * feat: 레시피가 아닌 레시피 추천 객체를 요청한다 * feat: 레시피 추천, 상세 화면에 레시피 추천 객체를 전달한다 * feat: model 은 kotlin Serializable 로 직렬화 * feat: 레시피 추천 화면 디자인 시스템 추가 * feat(Stars): 별의 크기를 조절할 수 있다 * feat(IngredientResponse): 재료 이미지 응답값은 nullable 이다 * feat: 레시피 추천의 레시피 컴포넌트를 그린다 * feat: 스크린은 바텀 네비게이션만큼 띄우고 화면을 구성한다 * refactor: recipe 재사용 component 패키지 묶기 * feat(LikableHeart): 좋아요 가능한 하트 구성 * feat(FakeRecipeRepository): 가짜 레시피 저장소 아이템 개수 증가 * feat: 레시피 추천 새로고침 적용
- Loading branch information
1 parent
3b6c362
commit 980997a
Showing
33 changed files
with
673 additions
and
471 deletions.
There are no files selected for viewing
7 changes: 3 additions & 4 deletions
7
...api/src/main/java/com/sundaegukbap/banchango/core/data/repository/api/RecipeRepository.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
11 changes: 6 additions & 5 deletions
11
Android/core/data/src/main/java/com/sundaegukbap/banchango/core/data/api/RecipeApi.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 |
---|---|---|
@@ -1,19 +1,20 @@ | ||
package com.sundaegukbap.banchango.core.data.api | ||
|
||
import com.sundaegukbap.banchango.core.data.api.model.RecipeRecommendResponse | ||
import com.sundaegukbap.banchango.core.data.api.model.RecommendedRecipeResponse | ||
import com.sundaegukbap.banchango.core.data.api.model.RecommendedRecipesResponse | ||
import retrofit2.Response | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
|
||
internal interface RecipeApi { | ||
@GET("api/recipe/recommand/{userId}") | ||
suspend fun getRecipeRecommendation( | ||
@Path("userId") userId: Long | ||
): Response<List<RecipeRecommendResponse>> | ||
@Path("userId") userId: Long, | ||
): Response<RecommendedRecipesResponse> | ||
|
||
@GET("api/recipe/{userId}/{recipeId}") | ||
suspend fun getRecipeDetail( | ||
@Path("userId") userId: Long, | ||
@Path("recipeId") recipeId: Long | ||
): Response<RecipeRecommendResponse> | ||
@Path("recipeId") recipeId: Long, | ||
): Response<RecommendedRecipeResponse> | ||
} |
10 changes: 10 additions & 0 deletions
10
...id/core/data/src/main/java/com/sundaegukbap/banchango/core/data/api/model/HaveResponse.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,10 @@ | ||
package com.sundaegukbap.banchango.core.data.api.model | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class HaveResponse( | ||
@SerialName("ingredientDtos") | ||
val ingredients: List<IngredientResponse>, | ||
) |
11 changes: 11 additions & 0 deletions
11
...e/data/src/main/java/com/sundaegukbap/banchango/core/data/api/model/IngredientResponse.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,11 @@ | ||
package com.sundaegukbap.banchango.core.data.api.model | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class IngredientResponse( | ||
val id: Long, | ||
val name: String, | ||
val kind: String, | ||
val image: String?, | ||
) |
10 changes: 10 additions & 0 deletions
10
...id/core/data/src/main/java/com/sundaegukbap/banchango/core/data/api/model/NeedResponse.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,10 @@ | ||
package com.sundaegukbap.banchango.core.data.api.model | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class NeedResponse( | ||
@SerialName("ingredientDtos") | ||
val ingredients: List<IngredientResponse>, | ||
) |
8 changes: 0 additions & 8 deletions
8
...a/src/main/java/com/sundaegukbap/banchango/core/data/api/model/RecipeRecommendResponse.kt
This file was deleted.
Oops, something went wrong.
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
10 changes: 10 additions & 0 deletions
10
...src/main/java/com/sundaegukbap/banchango/core/data/api/model/RecommendedRecipeResponse.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,10 @@ | ||
package com.sundaegukbap.banchango.core.data.api.model | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RecommendedRecipeResponse( | ||
val recipe: RecipeResponse, | ||
val have: HaveResponse, | ||
val need: NeedResponse, | ||
) |
10 changes: 10 additions & 0 deletions
10
...rc/main/java/com/sundaegukbap/banchango/core/data/api/model/RecommendedRecipesResponse.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,10 @@ | ||
package com.sundaegukbap.banchango.core.data.api.model | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RecommendedRecipesResponse( | ||
@SerialName("recommandedRecipeResponses") | ||
val recommendedRecipeResponses: List<RecommendedRecipeResponse>, | ||
) |
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
60 changes: 44 additions & 16 deletions
60
Android/core/data/src/main/java/com/sundaegukbap/banchango/core/data/mapper/RecipeMapper.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 |
---|---|---|
@@ -1,30 +1,58 @@ | ||
package com.sundaegukbap.banchango.core.data.mapper | ||
|
||
import com.sundaegukbap.banchango.Ingredient | ||
import com.sundaegukbap.banchango.IngredientKind | ||
import com.sundaegukbap.banchango.Recipe | ||
import com.sundaegukbap.banchango.RecipeDifficulty | ||
import com.sundaegukbap.banchango.core.data.api.model.RecipeRecommendResponse | ||
import com.sundaegukbap.banchango.RecommendedRecipe | ||
import com.sundaegukbap.banchango.core.data.api.model.IngredientResponse | ||
import com.sundaegukbap.banchango.core.data.api.model.RecipeResponse | ||
import com.sundaegukbap.banchango.core.data.api.model.RecommendedRecipeResponse | ||
import com.sundaegukbap.banchango.core.data.api.model.RecommendedRecipesResponse | ||
|
||
internal fun List<RecipeRecommendResponse>.toData(): List<Recipe> = map { it.toData() } | ||
|
||
internal fun RecipeRecommendResponse.toData(): Recipe { | ||
val difficulty = when (difficulty) { | ||
"아무나" -> RecipeDifficulty.ANYONE | ||
"초보" -> RecipeDifficulty.BEGINNER | ||
"중급" -> RecipeDifficulty.INTERMEDIATE | ||
"고급" -> RecipeDifficulty.ADVANCED | ||
"신의경지" -> RecipeDifficulty.GODLIKE | ||
else -> RecipeDifficulty.ANYONE | ||
internal fun List<IngredientResponse>.toData() = | ||
map { | ||
Ingredient( | ||
id = it.id, | ||
name = it.name, | ||
image = it.image ?: "", | ||
kind = | ||
when (it.kind) { | ||
"육류" -> IngredientKind.MEAT | ||
"해산물" -> IngredientKind.SEAFOOD | ||
"채소" -> IngredientKind.VEGETABLE | ||
"과일" -> IngredientKind.FRUIT | ||
"기타" -> IngredientKind.ETC | ||
else -> IngredientKind.ETC | ||
}, | ||
) | ||
} | ||
return Recipe( | ||
|
||
internal fun RecommendedRecipesResponse.toData() = recommendedRecipeResponses.map { it.toData() } | ||
|
||
internal fun RecommendedRecipeResponse.toData() = | ||
RecommendedRecipe( | ||
recipe = recipe.toData(), | ||
hadIngredients = have.ingredients.toData(), | ||
neededIngredients = need.ingredients.toData(), | ||
) | ||
|
||
internal fun RecipeResponse.toData() = | ||
Recipe( | ||
id = id, | ||
name = name, | ||
introduction = introduction, | ||
image = image, | ||
link = link, | ||
have = have, | ||
need = need, | ||
servings = servings, | ||
cookingTime = cookingTime, | ||
difficulty = difficulty, | ||
difficulty = | ||
when (difficulty) { | ||
"아무나" -> RecipeDifficulty.ANYONE | ||
"초보" -> RecipeDifficulty.BEGINNER | ||
"중급" -> RecipeDifficulty.INTERMEDIATE | ||
"고급" -> RecipeDifficulty.ADVANCED | ||
"신의경지" -> RecipeDifficulty.GODLIKE | ||
else -> RecipeDifficulty.ANYONE | ||
}, | ||
) | ||
} |
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
72 changes: 36 additions & 36 deletions
72
...ata/src/main/java/com/sundaegukbap/banchango/core/data/repository/FakeRecipeRepository.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
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
Android/core/model/src/main/java/com/sundaegukbap/banchango/Ingredient.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 com.sundaegukbap.banchango | ||
|
||
data class Ingredient( | ||
val id: Long, | ||
val name: String, | ||
val kind: IngredientKind, | ||
val image: String, | ||
) |
10 changes: 10 additions & 0 deletions
10
Android/core/model/src/main/java/com/sundaegukbap/banchango/IngredientKind.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,10 @@ | ||
package com.sundaegukbap.banchango | ||
|
||
enum class IngredientKind { | ||
MEAT, | ||
VEGETABLE, | ||
FRUIT, | ||
SEAFOOD, | ||
SAUCE, | ||
ETC, | ||
} |
2 changes: 1 addition & 1 deletion
2
Android/core/model/src/main/java/com/sundaegukbap/banchango/LikableRecipe.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.sundaegukbap.banchango | ||
|
||
data class LikableRecipe( | ||
val recipe: Recipe, | ||
val recommendedRecipe: RecommendedRecipe, | ||
val isLiked: Boolean, | ||
) |
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
7 changes: 7 additions & 0 deletions
7
Android/core/model/src/main/java/com/sundaegukbap/banchango/RecommendedRecipe.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,7 @@ | ||
package com.sundaegukbap.banchango | ||
|
||
data class RecommendedRecipe( | ||
val recipe: Recipe, | ||
val hadIngredients: List<Ingredient>, | ||
val neededIngredients: List<Ingredient>, | ||
) |
Oops, something went wrong.