Skip to content

Commit

Permalink
[CHORE] #93 : 설문 형식(SurveyForm) 저장 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Jan 8, 2024
1 parent c4e2146 commit 56477cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.wap.wapp.core.network.model.survey.SurveyResponse

interface SurveyDataSource {
suspend fun isSubmittedSurvey(
eventId: String,
surveyFormId: String,
userId: String,
): Result<Boolean>

Expand All @@ -14,6 +14,7 @@ interface SurveyDataSource {
suspend fun getSurvey(surveyId: String): Result<SurveyResponse>

suspend fun postSurvey(
surveyFormId: String,
eventId: String,
userId: String,
title: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SurveyDataSourceImpl @Inject constructor(
}

override suspend fun postSurvey(
surveyFormId: String,
eventId: String,
userId: String,
title: String,
Expand All @@ -51,6 +52,7 @@ class SurveyDataSourceImpl @Inject constructor(

val surveyRequest = SurveyRequest(
surveyId = documentId,
surveyFormId = surveyFormId,
eventId = eventId,
userId = userId,
title = title,
Expand All @@ -67,11 +69,11 @@ class SurveyDataSourceImpl @Inject constructor(
}

override suspend fun isSubmittedSurvey(
eventId: String,
surveyFormId: String,
userId: String,
): Result<Boolean> = runCatching {
val result = firebaseFirestore.collection(SURVEY_COLLECTION)
.whereEqualTo("eventId", eventId)
.whereEqualTo("surveyFormId", surveyFormId)
.whereEqualTo("userId", userId)
.get()
.await()
Expand Down

0 comments on commit 56477cc

Please sign in to comment.