-
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
[Fix] Change DTO #246
Merged
Merged
[Fix] Change DTO #246
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package com.eatssu.android.data.dto.response | ||
|
||
import android.util.Log | ||
import com.eatssu.android.domain.model.Menu | ||
import com.google.gson.annotations.SerializedName | ||
import timber.log.Timber | ||
|
||
|
||
data class GetFixedMenuResponse( | ||
|
@@ -14,7 +14,7 @@ data class GetFixedMenuResponse( | |
data class CategoryMenuListCollection( | ||
|
||
@SerializedName("category") var category: String? = null, | ||
@SerializedName("menuInformationList") var menuInformationList: ArrayList<MenuInformationList> = arrayListOf(), | ||
@SerializedName("menus") var menus: ArrayList<MenuInformationList> = arrayListOf(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion DTO 필드명이 백엔드 변경사항과 일치하도록 수정되었습니다.
하지만 다음과 같이 변수명도 일관성 있게 변경하는 것을 추천드립니다: - @SerializedName("rating") var mainRating: Double? = null,
+ @SerializedName("rating") var rating: Double? = null, Also applies to: 26-26 |
||
|
||
) | ||
|
||
|
@@ -23,38 +23,27 @@ data class MenuInformationList( | |
@SerializedName("menuId") var menuId: Long? = null, | ||
@SerializedName("name") var name: String? = null, | ||
@SerializedName("price") var price: Int? = null, | ||
@SerializedName("mainRating") var mainRating: Double? = null, | ||
@SerializedName("rating") var rating: Double? = null, | ||
|
||
) | ||
|
||
//fun GetFixedMenuResponse.mapFixedMenuResponseToMenu(): List<Menu> { | ||
// return this.map { fixMenuInfo -> | ||
// Menu( | ||
// id = fixMenuInfo.menuId ?: 0, | ||
// name = fixMenuInfo.name ?: "", | ||
// price = fixMenuInfo.price ?: 0, | ||
// rate = fixMenuInfo.mainRating ?: 0.0 | ||
// ) | ||
// } | ||
//} | ||
|
||
|
||
fun GetFixedMenuResponse.mapFixedMenuResponseToMenu(): List<Menu> { | ||
val menus = mutableListOf<Menu>() | ||
|
||
categoryMenuListCollection.forEach { categoryMenuList -> | ||
val categoryName = categoryMenuList.category ?: "" | ||
categoryMenuList.menuInformationList.forEach { menuInfo -> | ||
categoryMenuList.menus.forEach { menuInfo -> | ||
val menu = Menu( | ||
id = menuInfo.menuId ?: 0, | ||
name = menuInfo.name ?: "", | ||
price = menuInfo.price ?: 0, | ||
rate = menuInfo.mainRating ?: 0.0 | ||
rate = menuInfo.rating ?: 0.0 | ||
) | ||
menus.add(menu) | ||
} | ||
} | ||
Log.d("mapFixedMenuResponseToMenu", menus.toString()) | ||
Timber.d(menus.toString()) | ||
|
||
return menus | ||
} |
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
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.
💡 Codebase verification
속성명 변경에 따른 일관성 문제가 발견되었습니다.
검색 결과를 통해 다음과 같은 불일치 사항이 확인되었습니다:
MealResponse.kt
에서mainRating
이rating
으로 변경되었으나, 다른 Response 클래스들(MenuReviewInfoResponse
,MealReviewInfoResponse
,ReviewListResponse
등)에서는 여전히mainRating
을 사용 중입니다.MenuResponse.kt
에서는@SerializedName("rating")
을 사용하면서도 변수명은mainRating
을 유지하고 있어 일관성이 없습니다.briefMenus
속성은MenuOfMealResponse
와MealResponse
에서 서로 다른 타입(MenusInformation
과MenusInformationList
)을 사용하고 있습니다.이러한 불일치는 API 응답 처리 시 혼란을 야기할 수 있으며, 향후 유지보수에 어려움을 줄 수 있습니다.
🔗 Analysis chain
백엔드 API 스펙과 일치하는지 확인이 필요합니다.
속성 이름이 변경되었습니다:
mainRating
→rating
menusInformationList
→briefMenus
이러한 변경사항이 최신 백엔드 API 문서와 일치하는지 확인해주세요.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 5624