-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUD-50] refactor : buddy DTO,ViewModel 구분 적용(#34)
- Loading branch information
Showing
18 changed files
with
474 additions
and
75 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
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
13 changes: 13 additions & 0 deletions
13
buddy/src/main/java/com/nocapstone/buddyvet/buddy/BuddyUtil.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,13 @@ | ||
package com.nocapstone.buddyvet.buddy | ||
|
||
object BuddyDtoToLocal { | ||
fun transformKind(kind: String): String = if (kind == "D") "강아지" else "고양이" | ||
fun transformGender(gender: String): String = if (gender == "M") "남자" else "여자" | ||
fun transformNeutered(neutered : Boolean) : String = if (neutered) "예" else "아니요" | ||
} | ||
|
||
object BuddyLocalToDto { | ||
fun transformKind(kind: String): String = if (kind == "강아지") "D" else "C" | ||
fun transformGender(gender: String): String = if (gender == "남자") "M" else "F" | ||
fun transformNeutered(neutered : String?) : Boolean = neutered == "예" | ||
} |
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
39 changes: 39 additions & 0 deletions
39
buddy/src/main/java/com/nocapstone/buddyvet/buddy/domain/entity/BuddyDataLocal.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,39 @@ | ||
package com.nocapstone.buddyvet.buddy.domain.entity | ||
|
||
import com.nocapstone.buddyvet.buddy.BuddyLocalToDto | ||
|
||
// BuddyDetailDataLocal를 BuddyRequest로 변환 | ||
// BuddyResponse를 BuddyDataLocal로 변환 | ||
|
||
data class BuddyDetailDataLocal( | ||
val kind: String, | ||
var name: String? = null, | ||
var gender: String? = null, | ||
var profile: String? = null, | ||
var neutered: String? = null, | ||
var adoptDay: String? = null, | ||
var birthday: String? = null | ||
) { | ||
fun replaceForDto() = BuddyRequest( | ||
BuddyLocalToDto.transformKind(kind), | ||
name, | ||
birthday, | ||
adoptDay, | ||
BuddyLocalToDto.transformNeutered(neutered), | ||
gender | ||
) | ||
} | ||
|
||
|
||
data class BuddyDataLocal( | ||
val id: Long, | ||
val kind: String, | ||
val name: String, | ||
val gender: String, | ||
val profile: String, | ||
val age: String, | ||
var isSelect: Boolean = false | ||
) | ||
|
||
|
||
|
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.