-
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.
Browse files
Browse the repository at this point in the history
Feature/jaino/#59
- Loading branch information
Showing
34 changed files
with
1,043 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
core/data/src/main/java/com/wap/wapp/core/data/repository/survey/SurveyRepository.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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
package com.wap.wapp.core.data.repository.survey | ||
|
||
import com.wap.wapp.core.model.survey.Survey | ||
import com.wap.wapp.core.model.survey.SurveyForm | ||
|
||
interface SurveyRepository { | ||
suspend fun getSurveyList(): Result<List<Survey>> | ||
|
||
suspend fun getSurvey(surveyId: String): Result<Survey> | ||
|
||
suspend fun getSurveyFormList(): Result<List<SurveyForm>> | ||
|
||
suspend fun getSurveyForm(eventId: Int): Result<SurveyForm> | ||
} |
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
10 changes: 10 additions & 0 deletions
10
.../domain/src/main/java/com/wap/wapp/core/domain/usecase/survey/GetSurveyFormListUseCase.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,10 @@ | ||
package com.wap.wapp.core.domain.usecase.survey | ||
|
||
import com.wap.wapp.core.data.repository.survey.SurveyRepository | ||
import javax.inject.Inject | ||
|
||
class GetSurveyFormListUseCase @Inject constructor( | ||
private val surveyRepository: SurveyRepository, | ||
) { | ||
suspend operator fun invoke() = surveyRepository.getSurveyFormList() | ||
} |
10 changes: 10 additions & 0 deletions
10
core/domain/src/main/java/com/wap/wapp/core/domain/usecase/survey/GetSurveyFormUseCase.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,10 @@ | ||
package com.wap.wapp.core.domain.usecase.survey | ||
|
||
import com.wap.wapp.core.data.repository.survey.SurveyRepository | ||
import javax.inject.Inject | ||
|
||
class GetSurveyFormUseCase @Inject constructor( | ||
private val surveyRepository: SurveyRepository, | ||
) { | ||
suspend operator fun invoke(eventId: Int) = surveyRepository.getSurveyForm(eventId) | ||
} |
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
3 changes: 1 addition & 2 deletions
3
core/network/src/main/java/com/wap/wapp/core/network/model/event/EventResponse.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
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
31 changes: 31 additions & 0 deletions
31
core/network/src/main/java/com/wap/wapp/core/network/model/survey/SurveyFormResponse.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,31 @@ | ||
package com.wap.wapp.core.network.model.survey | ||
|
||
import com.wap.wapp.core.model.survey.SurveyForm | ||
import java.time.LocalDateTime | ||
import java.time.format.DateTimeFormatter | ||
|
||
data class SurveyFormResponse( | ||
val eventId: Int, | ||
val userId: String, | ||
val title: String, | ||
val content: String, | ||
val surveyQuestionList: List<SurveyQuestionResponse>, | ||
val deadline: String, | ||
) { | ||
constructor() : this( | ||
-1, | ||
"", | ||
"", | ||
"", | ||
emptyList<SurveyQuestionResponse>(), | ||
"", | ||
) | ||
|
||
fun toDomain(): SurveyForm = SurveyForm( | ||
eventId = eventId, | ||
title = title, | ||
content = content, | ||
surveyQuestionList = surveyQuestionList.map { it.toDomain() }, | ||
deadline = LocalDateTime.parse(deadline, DateTimeFormatter.ISO_LOCAL_DATE_TIME), | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
core/network/src/main/java/com/wap/wapp/core/network/model/survey/SurveyQuestionResponse.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,17 @@ | ||
package com.wap.wapp.core.network.model.survey | ||
|
||
import com.wap.wapp.core.model.survey.SurveyQuestion | ||
|
||
data class SurveyQuestionResponse( | ||
val questionTitle: String, | ||
val questionType: QuestionTypeResponse, | ||
) { | ||
constructor() : this( | ||
"", | ||
QuestionTypeResponse.SUBJECTIVE, | ||
) | ||
fun toDomain() = SurveyQuestion( | ||
questionTitle = questionTitle, | ||
questionType = questionType.toDomain(), | ||
) | ||
} |
5 changes: 5 additions & 0 deletions
5
core/network/src/main/java/com/wap/wapp/core/network/source/survey/SurveyDataSource.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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
package com.wap.wapp.core.network.source.survey | ||
|
||
import com.wap.wapp.core.network.model.survey.SurveyFormResponse | ||
import com.wap.wapp.core.network.model.survey.SurveyResponse | ||
|
||
interface SurveyDataSource { | ||
suspend fun getSurveyList(): Result<List<SurveyResponse>> | ||
|
||
suspend fun getSurvey(surveyId: String): Result<SurveyResponse> | ||
|
||
suspend fun getSurveyFormList(): Result<List<SurveyFormResponse>> | ||
|
||
suspend fun getSurveyForm(eventId: Int): Result<SurveyFormResponse> | ||
} |
Oops, something went wrong.