Skip to content

Commit

Permalink
[FEATURE] #141 : SignUpDataSource
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 27, 2024
1 parent 0fd72ab commit 74409d9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.wap.wapp.core.network.source.auth

interface SignUpDataSource {
suspend fun validationWapCode(code: String): Result<Boolean>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.wap.wapp.core.network.source.auth

import com.google.firebase.firestore.FirebaseFirestore
import com.wap.wapp.core.network.constant.CODES_COLLECTION
import com.wap.wapp.core.network.utils.await
import javax.inject.Inject

class SignUpDataSourceImpl @Inject constructor(
private val firebaseFirestore: FirebaseFirestore,
) : SignUpDataSource {
override suspend fun validationWapCode(code: String): Result<Boolean> = runCatching {
val result = firebaseFirestore.collection(CODES_COLLECTION)
.whereEqualTo("user", code)
.get()
.await()

result.isEmpty.not()
}
}

0 comments on commit 74409d9

Please sign in to comment.