-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/jaino/#67 #68
Merged
Merged
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
622c893
[REFACTOR] #65 : SurveyFormDataSource ꡬν λ° μ€λ¬Έμ‘°μ¬ νμ νΌ μ μ₯ λ° λΆλ¬μ€λ λ‘μ§ λͺ¨λ β¦
jeongjaino 6b720a2
[REFACTOR] #65 : SurveyFormRepository ꡬν λ° μ€λ¬Έμ‘°μ¬ νμ νΌ μ μ₯ λ° λΆλ¬μ€λ λ‘μ§ Migβ¦
jeongjaino 2f5aaed
[CHORE] #65 : managementRepository, surveyRepository -> surveyFormRepβ¦
jeongjaino e26381a
[CHORE] #65 : surveyForm network model move to survey/form
jeongjaino 2786891
[CHORE] #65 : surveyResponse field answerList to surveyAnswerList
jeongjaino 2a42c2e
[FEATURE] #65 : Survey DTO ꡬν
jeongjaino 826ee5f
[FEATURE] #65 : SurveyDataSource μ€λ¬Έ μ‘°μ¬ μλ΅ λ‘μ§ κ΅¬ν
jeongjaino 7cd3aab
[FEATURE] #65 : SurveyDataRepository μ€λ¬Έ μ‘°μ¬ μλ΅ λͺ¨λΈ DTO λ³κ²½ λ‘μ§ κ΅¬ν
jeongjaino bd8c446
[FEATURE] #65 : μ€λ¬Έ μλ΅ λ±λ‘ μ μ€μΌμ΄μ€ ꡬν
jeongjaino 944ad02
[FEATURE] #65 : μ€λ¬Έ νμΈ νλ©΄ NavArgument λ±λ‘
jeongjaino cfce195
[FEATURE] #65 : μ€λ¬Έ νμΈ νλ©΄ NavArgument λ±λ‘
jeongjaino cf67be9
[FEATURE] #65 : κ΄λ¦¬νλ©΄μμ μ€λ¬Έ νμΈ νλ©΄μΌλ‘ μ ν ꡬν
jeongjaino a2eb2e9
[CHORE] #65 : μ¬μ©νμ§ μλ ν΄λμ€ μκ±°
jeongjaino 0b63a55
[FEATURE] #66 : μ μΆν μ€λ¬ΈμΈμ§ νλ¨νλ λ‘μ§ κ΅¬ν
jeongjaino e1848f3
[FEATURE] #66 : μ μΆν μ€λ¬ΈμΈμ§ νμΈνλ μ μ€μΌμ΄μ€ ꡬν
jeongjaino 7ca9e3f
[FEATURE] #66 : μ μΆ κΈ°λ‘μ λ°λΌ, μμ±νλ©΄μΌλ‘ μ ν λ‘μ§ κ΅¬ν
jeongjaino e15c559
[FEATURE] #66 : μ μΆ κΈ°λ‘μ λ°λΌ, μμ±νλ©΄μΌλ‘ μ ν λ‘μ§ κ΅¬ν
jeongjaino 964db3e
[FEATURE] #66 : μ£Όκ΄μ μλ΅μ΄ 10κΈμ μ΄μμΌ κ²½μ°, λ²νΌμ΄ νμ±ν λλλ‘ κ΅¬ν
jeongjaino f2477ec
[CHORE] #67 : Survey Check Route Object to const val
jeongjaino 9dfc6d6
[STYLE] #67 : λ¨μΌλ¬Έ ν¨μ block to equalλ‘ λ³κ²½
jeongjaino ce29f57
[REFACTOR] #67 : λ€μ μ§λ¬Έ λκΈ°λ λ‘μ§ ViewModel to Viewλ‘ μ ν
jeongjaino 690a3d3
[CHORE] #67 : String to LocalDateTime λ³ν μ νΈλ¦¬ν° ꡬν
jeongjaino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
4 changes: 0 additions & 4 deletions
4
core/data/src/main/java/com/wap/wapp/core/data/repository/management/ManagementRepository.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,13 +1,9 @@ | ||
package com.wap.wapp.core.data.repository.management | ||
|
||
import com.wap.wapp.core.model.survey.SurveyForm | ||
|
||
interface ManagementRepository { | ||
suspend fun getManager(userId: String): Result<Boolean> | ||
|
||
suspend fun postManager(userId: String): Result<Unit> | ||
|
||
suspend fun getManagementCode(code: String): Result<Boolean> | ||
|
||
suspend fun postSurveyForm(surveyForm: SurveyForm): Result<Unit> | ||
} |
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
11 changes: 11 additions & 0 deletions
11
core/data/src/main/java/com/wap/wapp/core/data/repository/survey/SurveyFormRepository.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,11 @@ | ||
package com.wap.wapp.core.data.repository.survey | ||
|
||
import com.wap.wapp.core.model.survey.SurveyForm | ||
|
||
interface SurveyFormRepository { | ||
suspend fun getSurveyForm(eventId: Int): Result<SurveyForm> | ||
|
||
suspend fun getSurveyFormList(): Result<List<SurveyForm>> | ||
|
||
suspend fun postSurveyForm(surveyForm: SurveyForm): Result<Unit> | ||
} |
37 changes: 37 additions & 0 deletions
37
core/data/src/main/java/com/wap/wapp/core/data/repository/survey/SurveyFormRepositoryImpl.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,37 @@ | ||
package com.wap.wapp.core.data.repository.survey | ||
|
||
import com.wap.wapp.core.model.survey.SurveyForm | ||
import com.wap.wapp.core.network.model.survey.form.SurveyFormRequest | ||
import com.wap.wapp.core.network.source.survey.SurveyFormDataSource | ||
import java.time.format.DateTimeFormatter | ||
import javax.inject.Inject | ||
|
||
class SurveyFormRepositoryImpl @Inject constructor( | ||
private val surveyFormDataSource: SurveyFormDataSource, | ||
) : SurveyFormRepository { | ||
override suspend fun getSurveyForm(eventId: Int): Result<SurveyForm> { | ||
return surveyFormDataSource.getSurveyForm(eventId).mapCatching { surveyFormResponse -> | ||
surveyFormResponse.toDomain() | ||
} | ||
} | ||
|
||
override suspend fun getSurveyFormList(): Result<List<SurveyForm>> { | ||
return surveyFormDataSource.getSurveyFormList().mapCatching { surveyFormResponseList -> | ||
surveyFormResponseList.map { surveyFormResponse -> | ||
surveyFormResponse.toDomain() | ||
} | ||
} | ||
} | ||
|
||
override suspend fun postSurveyForm(surveyForm: SurveyForm): Result<Unit> { | ||
return surveyFormDataSource.postSurveyForm( | ||
surveyFormRequest = SurveyFormRequest( | ||
eventId = surveyForm.eventId, | ||
title = surveyForm.title, | ||
content = surveyForm.content, | ||
surveyQuestionList = surveyForm.surveyQuestionList, | ||
deadline = surveyForm.deadline.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), | ||
), | ||
) | ||
} | ||
} |
14 changes: 11 additions & 3 deletions
14
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,14 +1,22 @@ | ||
package com.wap.wapp.core.data.repository.survey | ||
|
||
import com.wap.wapp.core.model.survey.Survey | ||
import com.wap.wapp.core.model.survey.SurveyForm | ||
import com.wap.wapp.core.model.survey.SurveyAnswer | ||
import java.time.LocalDateTime | ||
|
||
interface SurveyRepository { | ||
suspend fun getSurveyList(): Result<List<Survey>> | ||
|
||
suspend fun getSurvey(surveyId: String): Result<Survey> | ||
|
||
suspend fun getSurveyFormList(): Result<List<SurveyForm>> | ||
suspend fun postSurvey( | ||
eventId: Int, | ||
userId: String, | ||
title: String, | ||
content: String, | ||
surveyAnswerList: List<SurveyAnswer>, | ||
surveyedAt: LocalDateTime, | ||
): Result<Unit> | ||
|
||
suspend fun getSurveyForm(eventId: Int): Result<SurveyForm> | ||
suspend fun isSubmittedSurvey(eventId: Int, userId: String): Result<Boolean> | ||
} |
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
6 changes: 3 additions & 3 deletions
6
.../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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.wap.wapp.core.domain.usecase.survey | ||
|
||
import com.wap.wapp.core.data.repository.survey.SurveyRepository | ||
import com.wap.wapp.core.data.repository.survey.SurveyFormRepository | ||
import javax.inject.Inject | ||
|
||
class GetSurveyFormListUseCase @Inject constructor( | ||
private val surveyRepository: SurveyRepository, | ||
private val surveyFormRepository: SurveyFormRepository, | ||
) { | ||
suspend operator fun invoke() = surveyRepository.getSurveyFormList() | ||
suspend operator fun invoke() = surveyFormRepository.getSurveyFormList() | ||
} |
6 changes: 3 additions & 3 deletions
6
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.wap.wapp.core.domain.usecase.survey | ||
|
||
import com.wap.wapp.core.data.repository.survey.SurveyRepository | ||
import com.wap.wapp.core.data.repository.survey.SurveyFormRepository | ||
import javax.inject.Inject | ||
|
||
class GetSurveyFormUseCase @Inject constructor( | ||
private val surveyRepository: SurveyRepository, | ||
private val surveyFormRepository: SurveyFormRepository, | ||
) { | ||
suspend operator fun invoke(eventId: Int) = surveyRepository.getSurveyForm(eventId) | ||
suspend operator fun invoke(eventId: Int) = surveyFormRepository.getSurveyForm(eventId) | ||
} |
21 changes: 21 additions & 0 deletions
21
.../domain/src/main/java/com/wap/wapp/core/domain/usecase/survey/IsSubmittedSurveyUseCase.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,21 @@ | ||
package com.wap.wapp.core.domain.usecase.survey | ||
|
||
import com.wap.wapp.core.data.repository.survey.SurveyRepository | ||
import com.wap.wapp.core.data.repository.user.UserRepository | ||
import javax.inject.Inject | ||
|
||
class IsSubmittedSurveyUseCase @Inject constructor( | ||
private val userRepository: UserRepository, | ||
private val surveyRepository: SurveyRepository, | ||
) { | ||
suspend operator fun invoke(eventId: Int): Result<Boolean> { | ||
return runCatching { | ||
val userId = userRepository.getUserId().getOrThrow() | ||
|
||
surveyRepository.isSubmittedSurvey( | ||
userId = userId, | ||
eventId = eventId, | ||
).getOrThrow() | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
core/domain/src/main/java/com/wap/wapp/core/domain/usecase/survey/PostSurveyUseCase.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,32 @@ | ||
package com.wap.wapp.core.domain.usecase.survey | ||
|
||
import com.wap.wapp.core.data.repository.survey.SurveyRepository | ||
import com.wap.wapp.core.data.repository.user.UserRepository | ||
import com.wap.wapp.core.model.survey.SurveyAnswer | ||
import java.time.LocalDateTime | ||
import javax.inject.Inject | ||
|
||
class PostSurveyUseCase @Inject constructor( | ||
private val userRepository: UserRepository, | ||
private val surveyRepository: SurveyRepository, | ||
) { | ||
suspend operator fun invoke( | ||
eventId: Int, | ||
title: String, | ||
content: String, | ||
surveyAnswerList: List<SurveyAnswer>, | ||
): Result<Unit> { | ||
return runCatching { | ||
val userId = userRepository.getUserId().getOrThrow() | ||
|
||
surveyRepository.postSurvey( | ||
userId = userId, | ||
eventId = eventId, | ||
title = title, | ||
content = content, | ||
surveyAnswerList = surveyAnswerList, | ||
surveyedAt = LocalDateTime.now(), | ||
) | ||
} | ||
} | ||
} |
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
13 changes: 0 additions & 13 deletions
13
core/network/src/main/java/com/wap/wapp/core/network/model/survey/RatingResponse.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
core/network/src/main/java/com/wap/wapp/core/network/model/survey/SurveyRequest.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,13 @@ | ||
package com.wap.wapp.core.network.model.survey | ||
|
||
import com.wap.wapp.core.model.survey.SurveyAnswer | ||
|
||
data class SurveyRequest( | ||
val surveyId: String, | ||
val eventId: Int, | ||
val userId: String, | ||
val title: String, | ||
val content: String, | ||
val surveyAnswerList: List<SurveyAnswer>, | ||
val surveyedAt: String, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ€μ΄λ° μμ£Ό μ’μμ !