-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baac204
commit a73e1e1
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
core/data/src/main/java/com/wap/wapp/core/data/repository/manage/ManageRepository.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,5 @@ | ||
package com.wap.wapp.core.data.repository.manage | ||
|
||
interface ManageRepository { | ||
suspend fun getManager(userId: String): Result<Unit> | ||
} |
12 changes: 12 additions & 0 deletions
12
core/data/src/main/java/com/wap/wapp/core/data/repository/manage/ManageRepositoryImpl.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.wap.wapp.core.data.repository.manage | ||
|
||
import com.wap.wapp.core.network.source.manage.ManageDataSource | ||
import javax.inject.Inject | ||
|
||
class ManageRepositoryImpl @Inject constructor( | ||
private val manageDataSource: ManageDataSource, | ||
) : ManageRepository { | ||
override suspend fun getManager(userId: String): Result<Unit> { | ||
return manageDataSource.getManager(userId) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
core/network/src/main/java/com/wap/wapp/core/network/source/manage/ManageDataSource.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,5 @@ | ||
package com.wap.wapp.core.network.source.manage | ||
|
||
interface ManageDataSource { | ||
suspend fun getManager(userId: String): Result<Unit> | ||
} |
19 changes: 19 additions & 0 deletions
19
core/network/src/main/java/com/wap/wapp/core/network/source/manage/ManageDataSourceImpl.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.wap.wapp.core.network.source.manage | ||
|
||
import com.google.firebase.firestore.FirebaseFirestore | ||
import com.wap.wapp.core.network.constant.MANAGER_COLLECTION | ||
import com.wap.wapp.core.network.utils.await | ||
import javax.inject.Inject | ||
|
||
class ManageDataSourceImpl @Inject constructor( | ||
private val firebaseFirestore: FirebaseFirestore, | ||
) : ManageDataSource { | ||
override suspend fun getManager(userId: String): Result<Unit> { | ||
return runCatching { | ||
firebaseFirestore.collection(MANAGER_COLLECTION) | ||
.document(userId) | ||
.get() | ||
.await() | ||
} | ||
} | ||
} |