Skip to content

Commit

Permalink
[FEATURE] #32 : 매니저 조회 로직 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Oct 21, 2023
1 parent a268621 commit ac6b183
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
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>
}
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)
}
}
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>
}
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()
}
}
}

0 comments on commit ac6b183

Please sign in to comment.