-
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.
[FEAT/#96] μ¬ν μμ± λ·° / μλ² ν΅μ ꡬν
- Loading branch information
Showing
31 changed files
with
410 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,4 +157,4 @@ | |
|
||
</application> | ||
|
||
</manifest> | ||
</manifest> |
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
13 changes: 13 additions & 0 deletions
13
data/src/main/java/com/going/data/datasource/EnterPreferenceDataSource.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.going.data.datasource | ||
|
||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.EnterPreferenceRequestDto | ||
import com.going.data.dto.response.EnterPreferenceResponseDto | ||
import retrofit2.http.Body | ||
|
||
interface EnterPreferenceDataSource { | ||
suspend fun postTripInfo( | ||
@Body request: EnterPreferenceRequestDto | ||
): BaseResponse<EnterPreferenceResponseDto> | ||
|
||
} |
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
19 changes: 19 additions & 0 deletions
19
data/src/main/java/com/going/data/datasourceImpl/EnterPreferenceDataSourceImpl.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,19 @@ | ||
package com.going.data.datasourceImpl | ||
|
||
import com.going.data.datasource.EnterPreferenceDataSource | ||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.EnterPreferenceRequestDto | ||
import com.going.data.dto.response.EnterPreferenceResponseDto | ||
import com.going.data.service.EnterPreferenceService | ||
import javax.inject.Inject | ||
|
||
class EnterPreferenceDataSourceImpl @Inject constructor( | ||
private val enterPreferenceService: EnterPreferenceService | ||
) : EnterPreferenceDataSource { | ||
|
||
override suspend fun postTripInfo( | ||
request: EnterPreferenceRequestDto | ||
): BaseResponse<EnterPreferenceResponseDto> = | ||
enterPreferenceService.postTripInfoFromServer(request) | ||
|
||
} |
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
28 changes: 28 additions & 0 deletions
28
data/src/main/java/com/going/data/dto/request/EnterPreferenceRequestDto.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,28 @@ | ||
package com.going.data.dto.request | ||
|
||
import com.going.domain.entity.request.EnterPreferenceRequestModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class EnterPreferenceRequestDto( | ||
@SerialName("title") | ||
val title: String, | ||
@SerialName("startDate") | ||
val startDate: String, | ||
@SerialName("endDate") | ||
val endDate: String, | ||
@SerialName("styleA") | ||
val styleA: Int, | ||
@SerialName("styleB") | ||
val styleB: Int, | ||
@SerialName("styleC") | ||
val styleC: Int, | ||
@SerialName("styleD") | ||
val styleD: Int, | ||
@SerialName("styleE") | ||
val styleE: Int | ||
) | ||
|
||
fun EnterPreferenceRequestModel.toEnterPreferenceRequestDto(): EnterPreferenceRequestDto = | ||
EnterPreferenceRequestDto(title, startDate, endDate, styleA, styleB, styleC, styleD, styleE) |
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/src/main/java/com/going/data/dto/response/EnterPreferenceResponseDto.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 com.going.data.dto.response | ||
|
||
import com.going.domain.entity.response.EnterPreferenceModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class EnterPreferenceResponseDto( | ||
@SerialName("tripId") | ||
val tripId: Long, | ||
@SerialName("title") | ||
val title: String, | ||
@SerialName("startDate") | ||
val startDate: String, | ||
@SerialName("endDate") | ||
val endDate: String, | ||
@SerialName("code") | ||
val code: String, | ||
@SerialName("day") | ||
val day: Int, | ||
) { | ||
fun toEnterPreferenceModel() = | ||
EnterPreferenceModel(tripId, title, startDate, endDate, code, day) | ||
} |
23 changes: 23 additions & 0 deletions
23
data/src/main/java/com/going/data/repositoryImpl/EnterPreferenceRepositoryImpl.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,23 @@ | ||
package com.going.data.repositoryImpl | ||
|
||
import com.going.data.datasource.EnterPreferenceDataSource | ||
import com.going.data.dto.request.toEnterPreferenceRequestDto | ||
import com.going.domain.entity.request.EnterPreferenceRequestModel | ||
import com.going.domain.entity.response.EnterPreferenceModel | ||
import com.going.domain.repository.EnterPreferenceRepository | ||
import javax.inject.Inject | ||
|
||
class EnterPreferenceRepositoryImpl @Inject constructor( | ||
private val enterPreferenceDataSource: EnterPreferenceDataSource | ||
) : EnterPreferenceRepository { | ||
|
||
override suspend fun postTripInfo( | ||
request: EnterPreferenceRequestModel | ||
): Result<EnterPreferenceModel> = | ||
runCatching { | ||
enterPreferenceDataSource.postTripInfo( | ||
request.toEnterPreferenceRequestDto(), | ||
).data.toEnterPreferenceModel() | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
data/src/main/java/com/going/data/service/EnterPreferenceService.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,16 @@ | ||
package com.going.data.service | ||
|
||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.EnterPreferenceRequestDto | ||
import com.going.data.dto.response.EnterPreferenceResponseDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface EnterPreferenceService { | ||
|
||
@POST("api/trips") | ||
suspend fun postTripInfoFromServer( | ||
@Body request: EnterPreferenceRequestDto, | ||
): BaseResponse<EnterPreferenceResponseDto> | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
domain/src/main/kotlin/com/going/domain/entity/request/EnterPreferenceRequestModel.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,12 @@ | ||
package com.going.domain.entity.request | ||
|
||
data class EnterPreferenceRequestModel( | ||
val title: String, | ||
val startDate: String, | ||
val endDate: String, | ||
val styleA: Int, | ||
val styleB: Int, | ||
val styleC: Int, | ||
val styleD: Int, | ||
val styleE: Int | ||
) |
10 changes: 10 additions & 0 deletions
10
domain/src/main/kotlin/com/going/domain/entity/response/EnterPreferenceModel.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.going.domain.entity.response | ||
|
||
data class EnterPreferenceModel( | ||
val tripId: Long, | ||
val title: String, | ||
val startDate: String, | ||
val endDate: String, | ||
val code: String, | ||
val day: Int | ||
) |
12 changes: 12 additions & 0 deletions
12
domain/src/main/kotlin/com/going/domain/repository/EnterPreferenceRepository.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,12 @@ | ||
package com.going.domain.repository | ||
|
||
import com.going.domain.entity.request.EnterPreferenceRequestModel | ||
import com.going.domain.entity.response.EnterPreferenceModel | ||
|
||
interface EnterPreferenceRepository { | ||
|
||
suspend fun postTripInfo( | ||
request: EnterPreferenceRequestModel | ||
): Result<EnterPreferenceModel> | ||
|
||
} |
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.