-
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.
Browse files
Browse the repository at this point in the history
[Feat/#59] user info update api
- Loading branch information
Showing
26 changed files
with
392 additions
and
70 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
app/src/main/java/org/memento/data/datasource/UserInfoDataSource.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 org.memento.data.datasource | ||
|
||
import org.memento.data.dto.BaseResponse | ||
import org.memento.data.dto.request.RequestUserInfoUpdateDto | ||
|
||
interface UserInfoDataSource { | ||
suspend fun fetchUserInfo(requestUserInfo: RequestUserInfoUpdateDto): BaseResponse<Unit> | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/org/memento/data/datasourceimpl/UserDataSourceImpl.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 org.memento.data.datasourceimpl | ||
|
||
import org.memento.data.datasource.UserInfoDataSource | ||
import org.memento.data.dto.BaseResponse | ||
import org.memento.data.dto.request.RequestUserInfoUpdateDto | ||
import org.memento.data.service.UserInfoUpdateService | ||
import javax.inject.Inject | ||
|
||
class UserDataSourceImpl | ||
@Inject | ||
constructor( | ||
private val userService: UserInfoUpdateService, | ||
) : UserInfoDataSource { | ||
override suspend fun fetchUserInfo(requestUserInfo: RequestUserInfoUpdateDto): BaseResponse<Unit> = userService.fetchUserInfo(requestUserInfo) | ||
} |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/org/memento/data/dto/request/RequestUserInfoUpdateDto.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 org.memento.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RequestUserInfoUpdateDto( | ||
@SerialName("wakeUpTime") | ||
val wakeUpTime: String, | ||
@SerialName("windDownTime") | ||
val windDownTime: String, | ||
@SerialName("job") | ||
val job: String, | ||
@SerialName("jobOtherDetail") | ||
val jobOtherDetail: String? = null, | ||
@SerialName("isStressedUnorganizedSchedule") | ||
val isStressedUnorganizedSchedule: Boolean, | ||
@SerialName("isForgetImportantThings") | ||
val isForgetImportantThings: Boolean, | ||
@SerialName("isPreferReminder") | ||
val isPreferReminder: Boolean, | ||
@SerialName("isImportantBreaks") | ||
val isImportantBreaks: Boolean, | ||
) |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/memento/data/mapper/toData/RequestUserInfoMapper.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 org.memento.data.mapper.toData | ||
|
||
import org.memento.data.dto.request.RequestUserInfoUpdateDto | ||
import org.memento.domain.entity.UserInfo | ||
|
||
fun UserInfo.toData(): RequestUserInfoUpdateDto = | ||
RequestUserInfoUpdateDto( | ||
wakeUpTime = wakeUpTime, | ||
windDownTime = windDownTime, | ||
job = job, | ||
jobOtherDetail = jobOtherDetail, | ||
isStressedUnorganizedSchedule = isStressedUnorganizedSchedule, | ||
isForgetImportantThings = isForgetImportantThings, | ||
isPreferReminder = isPreferReminder, | ||
isImportantBreaks = isImportantBreaks, | ||
) |
6 changes: 3 additions & 3 deletions
6
app/src/main/java/org/memento/data/mapper/toDomain/ResponseLoginMapper.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
21 changes: 21 additions & 0 deletions
21
app/src/main/java/org/memento/data/repositoryimpl/UserInfoUpdateRepositoryImpl.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,21 @@ | ||
package org.memento.data.repositoryimpl | ||
|
||
import org.memento.data.datasource.UserInfoDataSource | ||
import org.memento.data.mapper.toData.toData | ||
import org.memento.domain.entity.UserInfo | ||
import org.memento.domain.repository.UserInfoUpdateRepository | ||
import javax.inject.Inject | ||
|
||
class UserInfoUpdateRepositoryImpl | ||
@Inject | ||
constructor( | ||
private val userInfoDataSource: UserInfoDataSource, | ||
) : UserInfoUpdateRepository { | ||
override suspend fun fetchUserInfo(userInfo: UserInfo): Result<Unit> { | ||
return runCatching { | ||
userInfoDataSource.fetchUserInfo( | ||
requestUserInfo = userInfo.toData(), | ||
) | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/memento/data/service/UserInfoUpdateService.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 org.memento.data.service | ||
|
||
import org.memento.data.dto.BaseResponse | ||
import org.memento.data.dto.request.RequestUserInfoUpdateDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.PATCH | ||
|
||
interface UserInfoUpdateService { | ||
@PATCH("/api/v1/members/personal-info") | ||
suspend fun fetchUserInfo( | ||
@Body requestUserInfo: RequestUserInfoUpdateDto, | ||
): BaseResponse<Unit> | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.memento.domain.entity | ||
|
||
data class UserInfo( | ||
val wakeUpTime: String, | ||
val windDownTime: String, | ||
val job: String, | ||
val jobOtherDetail: String? = null, | ||
val isStressedUnorganizedSchedule: Boolean, | ||
val isForgetImportantThings: Boolean, | ||
val isPreferReminder: Boolean, | ||
val isImportantBreaks: Boolean, | ||
) |
4 changes: 2 additions & 2 deletions
4
app/src/main/java/org/memento/domain/repository/LoginRepository.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,8 +1,8 @@ | ||
package org.memento.domain.repository | ||
|
||
import org.memento.domain.entity.Login | ||
import org.memento.domain.entity.UserInfo | ||
import org.memento.domain.entity.LoginInfo | ||
|
||
interface LoginRepository { | ||
suspend fun postLogin(login: Login): Result<UserInfo> | ||
suspend fun postLogin(login: Login): Result<LoginInfo> | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/memento/domain/repository/UserInfoUpdateRepository.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,9 @@ | ||
package org.memento.domain.repository | ||
|
||
import org.memento.domain.entity.UserInfo | ||
|
||
interface UserInfoUpdateRepository { | ||
suspend fun fetchUserInfo( | ||
userInfo: UserInfo, | ||
): Result<Unit> | ||
} |
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.