-
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.
#76 [feat] 행복루틴 추가 API 연결 및 뷰페이저 subRoutineId 옵저빙
- Loading branch information
Showing
12 changed files
with
171 additions
and
16 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopetit/softie/data/entity/request/PostMemberHappyRoutineRequest.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.sopetit.softie.data.entity.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PostMemberHappyRoutineRequest( | ||
@SerialName("subRoutineId") | ||
val subRoutineId: Int | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopetit/softie/data/entity/response/MemberHappyRoutinePostResponse.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.sopetit.softie.data.entity.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MemberHappyRoutinePostResponse( | ||
@SerialName("routineId") | ||
val routineId: Int | ||
) |
15 changes: 15 additions & 0 deletions
15
.../main/java/com/sopetit/softie/data/repositoryImpl/MemberHappinessRoutineRepositoryImpl.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,15 @@ | ||
package com.sopetit.softie.data.repositoryImpl | ||
|
||
import com.sopetit.softie.data.entity.request.PostMemberHappyRoutineRequest | ||
import com.sopetit.softie.data.source.MemberHappinessRoutineDataSource | ||
import com.sopetit.softie.domain.repository.MemberHappinessRoutineRepository | ||
import javax.inject.Inject | ||
|
||
class MemberHappinessRoutineRepositoryImpl @Inject constructor( | ||
private val memberHappinessRoutineDataSource: MemberHappinessRoutineDataSource | ||
) : MemberHappinessRoutineRepository { | ||
override suspend fun postMemberHappinessRoutine(request: PostMemberHappyRoutineRequest): Result<Int> = | ||
runCatching { memberHappinessRoutineDataSource.postMemberHappyRoutine(request) }.map { | ||
requireNotNull(it.data).routineId | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/sopetit/softie/data/service/MemberHappinessRoutineService.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.sopetit.softie.data.service | ||
|
||
import com.sopetit.softie.data.entity.BaseResponse | ||
import com.sopetit.softie.data.entity.request.PostMemberHappyRoutineRequest | ||
import com.sopetit.softie.data.entity.response.MemberHappyRoutinePostResponse | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface MemberHappinessRoutineService { | ||
@POST("api/v1/routines/happiness/member") | ||
suspend fun postMemberHappyRoutine(@Body request: PostMemberHappyRoutineRequest): BaseResponse<MemberHappyRoutinePostResponse> | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/sopetit/softie/data/source/MemberHappinessRoutineDataSource.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,14 @@ | ||
package com.sopetit.softie.data.source | ||
|
||
import com.sopetit.softie.data.entity.BaseResponse | ||
import com.sopetit.softie.data.entity.request.PostMemberHappyRoutineRequest | ||
import com.sopetit.softie.data.entity.response.MemberHappyRoutinePostResponse | ||
import com.sopetit.softie.data.service.MemberHappinessRoutineService | ||
import javax.inject.Inject | ||
|
||
class MemberHappinessRoutineDataSource @Inject constructor( | ||
private val memberHappinessRoutineService: MemberHappinessRoutineService | ||
) { | ||
suspend fun postMemberHappyRoutine(request: PostMemberHappyRoutineRequest): BaseResponse<MemberHappyRoutinePostResponse> = | ||
memberHappinessRoutineService.postMemberHappyRoutine(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
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
app/src/main/java/com/sopetit/softie/domain/repository/MemberHappinessRoutineRepository.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.sopetit.softie.domain.repository | ||
|
||
import com.sopetit.softie.data.entity.request.PostMemberHappyRoutineRequest | ||
|
||
interface MemberHappinessRoutineRepository { | ||
suspend fun postMemberHappinessRoutine(request: PostMemberHappyRoutineRequest): Result<Int> | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/sopetit/softie/domain/usecase/PostMemberHappyRoutineUseCase.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.sopetit.softie.domain.usecase | ||
|
||
import com.sopetit.softie.data.entity.request.PostMemberHappyRoutineRequest | ||
import com.sopetit.softie.domain.repository.MemberHappinessRoutineRepository | ||
import javax.inject.Inject | ||
|
||
class PostMemberHappyRoutineUseCase @Inject constructor( | ||
private val memberHappinessRoutineRepository: MemberHappinessRoutineRepository | ||
) { | ||
suspend operator fun invoke(request: PostMemberHappyRoutineRequest) = | ||
memberHappinessRoutineRepository.postMemberHappinessRoutine(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
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