-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from dahyun1226/feature/baepo1
배포 업데이트 1
- Loading branch information
Showing
10 changed files
with
101 additions
and
53 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
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
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
27 changes: 27 additions & 0 deletions
27
domain/src/main/java/com/mashup/damgledamgle/domain/usecase/user/GetMyIdUseCase.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,27 @@ | ||
package com.mashup.damgledamgle.domain.usecase.user | ||
|
||
import com.mashup.damgledamgle.domain.entity.base.Result | ||
import com.mashup.damgledamgle.domain.repository.DataStoreRepository | ||
import com.mashup.damgledamgle.domain.repository.UserRepository | ||
import javax.inject.Inject | ||
|
||
class GetMyIdUseCase @Inject constructor( | ||
private val dataStoreRepository: DataStoreRepository, | ||
private val userRepository: UserRepository | ||
) { | ||
suspend operator fun invoke(): Result<Int> { | ||
val id = dataStoreRepository.getId() | ||
return if (id != -1) { | ||
Result.Success(id) | ||
} else { | ||
val result = userRepository.getUserProfile() | ||
|
||
return if (result is Result.Success) { | ||
dataStoreRepository.setId(result.data.userNo) | ||
Result.Success(result.data.userNo) | ||
} else { | ||
result as Result.Error | ||
} | ||
} | ||
} | ||
} |