Skip to content
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/#93 #96

Merged
merged 22 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a6b4a18
[CHORE] #93 : SurveyForm Entity ์ˆ˜์ • add SurveyFormId
jeongjaino Jan 8, 2024
c4e2146
[CHORE] #93 : ์„ค๋ฌธ ํ˜•์‹ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ / EventId -> SurveyFormId๋กœ ์ธ์ž ๋ณ€๊ฒฝ
jeongjaino Jan 8, 2024
56477cc
[CHORE] #93 : ์„ค๋ฌธ ํ˜•์‹(SurveyForm) ์ €์žฅ ๋กœ์ง ์ˆ˜์ •
jeongjaino Jan 8, 2024
008dae6
[CHORE] #93 : ์„ค๋ฌธ ํ˜•์‹(SurveyForm) ์ €์žฅ ๋กœ์ง ์ˆ˜์ •
jeongjaino Jan 8, 2024
3c9b0c1
[CHORE] #93 : ์„ค๋ฌธ (Survey) Entity ์ˆ˜์ • / + SurveyFormId
jeongjaino Jan 8, 2024
407dcdd
[CHORE] #93 : ์„ค๋ฌธ (Survey) Entity ์ˆ˜์ • / + SurveyFormId
jeongjaino Jan 8, 2024
3071c63
[CHORE] #93 : EventId๋ฅผ ํ†ตํ•ด ์กฐํšŒ -> SurveyFormID๋กœ ์ˆ˜์ •
jeongjaino Jan 8, 2024
6bdd67a
[CHORE] #93 : Indicator ์ปดํฌ๋„ŒํŠธ ๋ถˆ๋ฆฌ
jeongjaino Jan 8, 2024
3959e78
[UI] #93 : Bottom Button ํ•˜๋‹จ padding ์ ์šฉ
jeongjaino Jan 8, 2024
bca1af2
[FEATURE] #93 : SurveyForm ์—…๋ฐ์ดํŠธ ๋กœ์ง ๊ตฌํ˜„
jeongjaino Jan 9, 2024
21a3633
[FEATURE] #93 : SurveyForm ์—…๋ฐ์ดํŠธ ์œ ์Šค์ผ€์ด์Šค ๊ตฌํ˜„
jeongjaino Jan 9, 2024
f9765ac
[FEATURE] #93 : ์„ค๋ฌธ ํ˜•์‹ ์ˆ˜์ • Screen ๋ฐ ViewModel ๊ตฌํ˜„
jeongjaino Jan 9, 2024
5ff4718
[FEATURE] #93 : Management - Survey Navigation ๊ตฌํ˜„ SurveyForm (Registrโ€ฆ
jeongjaino Jan 9, 2024
e082dd5
[FEATURE] #93 : ๊ด€๋ฆฌ ํƒญ์—์„œ ์„ค๋ฌธ ํด๋ฆญ์‹œ / ์ž‘์„ฑ๋œ ์„ค๋ฌธ -> ์„ค๋ฌธํ˜•์‹ ์ˆ˜์ • ์œผ๋กœ ๋ณ€๊ฒฝ
jeongjaino Jan 9, 2024
bff7d87
[CHORE] #93 : management-survey/registration -> management-survey๋กœ paโ€ฆ
jeongjaino Jan 9, 2024
4a31f18
[CHORE] #93 : ๊ธฐ์กด survey -> surveyForm์œผ๋กœ ์ด๋ฆ„ ๋ณ€๊ฒฝ
jeongjaino Jan 9, 2024
11be809
[STYLE] #93 : ์ฝ”๋“œ ํฌ๋งทํŒ… ์ˆ˜์ •
jeongjaino Jan 9, 2024
2401d21
[FIX] #93 : LazyColumn ๊ฐ ์•„์ดํ…œ ๊ณ ์œ  ํ‚ค ๊ฐ’ eventid -> surveyFormId๋กœ ๋ณ€๊ฒฝ
jeongjaino Jan 9, 2024
2d48103
[CHORE] #93 : String Resource ์ถ”๊ฐ€
jeongjaino Jan 9, 2024
0aca95c
Merge branch 'develop' of https://github.com/pknu-wap/WAPP into featuโ€ฆ
jeongjaino Jan 9, 2024
e7cfa84
[STYLE] #93 : ๋ฆฐํŠธ Formatting ์ˆ˜์ •
jeongjaino Jan 9, 2024
a8072cb
[FEATURE] #93 : setSurveyRegistrationState ํ•จ์ˆ˜ ์„ธ๋ถ„ํ™”
jeongjaino Jan 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/main/java/com/wap/wapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.wap.wapp.core.domain.usecase.auth.SignInUseCase
import com.wap.wapp.feature.auth.signin.navigation.signInNavigationRoute
import com.wap.wapp.feature.auth.signup.navigation.signUpNavigationRoute
import com.wap.wapp.feature.management.registration.event.navigation.eventRegistrationNavigationRoute
import com.wap.wapp.feature.management.survey.registration.navigation.surveyRegistrationNavigationRoute
import com.wap.wapp.feature.management.survey.navigation.ManagementSurveyRoute
import com.wap.wapp.feature.profile.profilesetting.navigation.profileSettingNavigationRoute
import com.wap.wapp.feature.splash.navigation.splashNavigationRoute
import com.wap.wapp.navigation.TopLevelDestination
Expand Down Expand Up @@ -105,7 +105,7 @@ private fun handleBottomBarState(
signUpNavigationRoute -> setBottomBarState(false)
splashNavigationRoute -> setBottomBarState(false)
profileSettingNavigationRoute -> setBottomBarState(false)
surveyRegistrationNavigationRoute -> setBottomBarState(false)
ManagementSurveyRoute.surveyFormRegistrationRoute -> setBottomBarState(false)
eventRegistrationNavigationRoute -> setBottomBarState(false)
else -> setBottomBarState(true)
}
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import com.wap.wapp.feature.management.navigation.managementScreen
import com.wap.wapp.feature.management.navigation.navigateToManagement
import com.wap.wapp.feature.management.registration.event.navigation.eventRegistrationScreen
import com.wap.wapp.feature.management.registration.event.navigation.navigateToEventRegistration
import com.wap.wapp.feature.management.survey.registration.navigation.navigateToSurveyRegistration
import com.wap.wapp.feature.management.survey.registration.navigation.surveyRegistrationScreen
import com.wap.wapp.feature.management.survey.navigation.navigateToSurveyFormEdit
import com.wap.wapp.feature.management.survey.navigation.navigateToSurveyFormRegistration
import com.wap.wapp.feature.management.survey.navigation.managementSurveyNavGraph
import com.wap.wapp.feature.notice.navigation.navigateToNotice
import com.wap.wapp.feature.notice.navigation.noticeScreen
import com.wap.wapp.feature.profile.navigation.navigateToProfile
Expand All @@ -30,7 +31,6 @@ import com.wap.wapp.feature.profile.profilesetting.navigation.profileSettingNavi
import com.wap.wapp.feature.profile.profilesetting.navigation.profileSettingScreen
import com.wap.wapp.feature.splash.navigation.splashNavigationRoute
import com.wap.wapp.feature.splash.navigation.splashScreen
import com.wap.wapp.feature.survey.check.navigation.navigateToSurveyCheck
import com.wap.wapp.feature.survey.check.navigation.surveyCheckScreen
import com.wap.wapp.feature.survey.navigation.navigateToSurvey
import com.wap.wapp.feature.survey.navigation.navigateToSurveyAnswer
Expand Down Expand Up @@ -75,7 +75,7 @@ fun WappNavHost(
surveyCheckScreen(
navigateToManagement = navController::navigateToManagement,
)
surveyRegistrationScreen(
managementSurveyNavGraph(
navigateToManagement = navController::navigateToManagement,
)
eventRegistrationScreen(
Expand Down Expand Up @@ -104,10 +104,10 @@ fun WappNavHost(
},
)
managementScreen(
navigateToSurveyRegistration = navController::navigateToSurveyRegistration,
navigateToSurveyRegistration = navController::navigateToSurveyFormRegistration,
navigateToEventRegistration = navController::navigateToEventRegistration,
navigateToEventEdit = navController::navigateToEventEdit,
navigateToSurveyCheck = navController::navigateToSurveyCheck,
navigateToSurveyFormEdit = navController::navigateToSurveyFormEdit,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package com.wap.wapp.core.data.repository.survey

import com.wap.wapp.core.model.survey.SurveyForm
import com.wap.wapp.core.model.survey.SurveyQuestion
import java.time.LocalDateTime

interface SurveyFormRepository {
suspend fun getSurveyForm(eventId: String): Result<SurveyForm>
suspend fun getSurveyForm(surveyFormId: String): Result<SurveyForm>

suspend fun getSurveyFormList(): Result<List<SurveyForm>>

suspend fun postSurveyForm(surveyForm: SurveyForm): Result<Unit>
suspend fun postSurveyForm(
eventId: String,
title: String,
content: String,
surveyQuestionList: List<SurveyQuestion>,
deadline: LocalDateTime,
): Result<Unit>

suspend fun updateSurveyForm(surveyForm: SurveyForm): Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ package com.wap.wapp.core.data.repository.survey

import com.wap.wapp.core.data.utils.toISOLocalDateTimeString
import com.wap.wapp.core.model.survey.SurveyForm
import com.wap.wapp.core.model.survey.SurveyQuestion
import com.wap.wapp.core.network.model.survey.form.SurveyFormRequest
import com.wap.wapp.core.network.source.survey.SurveyFormDataSource
import java.time.LocalDateTime
import javax.inject.Inject

class SurveyFormRepositoryImpl @Inject constructor(
private val surveyFormDataSource: SurveyFormDataSource,
) : SurveyFormRepository {
override suspend fun getSurveyForm(eventId: String): Result<SurveyForm> =
surveyFormDataSource.getSurveyForm(eventId).mapCatching { surveyFormResponse ->
override suspend fun getSurveyForm(surveyFormId: String): Result<SurveyForm> =
surveyFormDataSource.getSurveyForm(surveyFormId).mapCatching { surveyFormResponse ->
surveyFormResponse.toDomain()
}

Expand All @@ -21,9 +23,24 @@ class SurveyFormRepositoryImpl @Inject constructor(
}
}

override suspend fun postSurveyForm(surveyForm: SurveyForm): Result<Unit> =
surveyFormDataSource.postSurveyForm(
override suspend fun postSurveyForm(
eventId: String,
title: String,
content: String,
surveyQuestionList: List<SurveyQuestion>,
deadline: LocalDateTime,
): Result<Unit> = surveyFormDataSource.postSurveyForm(
eventId = eventId,
title = title,
content = content,
surveyQuestionList = surveyQuestionList,
deadline = deadline.toISOLocalDateTimeString(),
)

override suspend fun updateSurveyForm(surveyForm: SurveyForm): Result<Unit> =
surveyFormDataSource.updateSurveyForm(
surveyFormRequest = SurveyFormRequest(
surveyFormId = surveyForm.surveyFormId,
eventId = surveyForm.eventId,
title = surveyForm.title,
content = surveyForm.content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface SurveyRepository {
suspend fun getSurvey(surveyId: String): Result<Survey>

suspend fun postSurvey(
surveyFormId: String,
eventId: String,
userId: String,
title: String,
Expand All @@ -18,5 +19,5 @@ interface SurveyRepository {
surveyedAt: LocalDateTime,
): Result<Unit>

suspend fun isSubmittedSurvey(eventId: String, userId: String): Result<Boolean>
suspend fun isSubmittedSurvey(surveyFormId: String, userId: String): Result<Boolean>
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ class SurveyRepositoryImpl @Inject constructor(
}

override suspend fun postSurvey(
surveyFormId: String,
eventId: String,
userId: String,
title: String,
content: String,
surveyAnswerList: List<SurveyAnswer>,
surveyedAt: LocalDateTime,
): Result<Unit> = surveyDataSource.postSurvey(
surveyFormId = surveyFormId,
eventId = eventId,
userId = userId,
title = title,
Expand All @@ -58,8 +60,8 @@ class SurveyRepositoryImpl @Inject constructor(
surveyedAt = surveyedAt.toISOLocalDateTimeString(),
)

override suspend fun isSubmittedSurvey(eventId: String, userId: String): Result<Boolean> =
surveyDataSource.isSubmittedSurvey(eventId, userId)
override suspend fun isSubmittedSurvey(surveyFormId: String, userId: String): Result<Boolean> =
surveyDataSource.isSubmittedSurvey(surveyFormId, userId)

private val noticeNameResponse: Result<String> = Result.success("notice datasource dummy data")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import javax.inject.Inject
class GetSurveyFormUseCase @Inject constructor(
private val surveyFormRepository: SurveyFormRepository,
) {
suspend operator fun invoke(eventId: String) = surveyFormRepository.getSurveyForm(eventId)
suspend operator fun invoke(surveyFormId: String) =
surveyFormRepository.getSurveyForm(surveyFormId)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ class IsSubmittedSurveyUseCase @Inject constructor(
private val userRepository: UserRepository,
private val surveyRepository: SurveyRepository,
) {
suspend operator fun invoke(eventId: String): Result<Boolean> = runCatching {
suspend operator fun invoke(surveyFormId: String): Result<Boolean> = runCatching {
val userId = userRepository.getUserId().getOrThrow()

surveyRepository.isSubmittedSurvey(userId = userId, eventId = eventId).getOrThrow()
surveyRepository.isSubmittedSurvey(
userId = userId,
surveyFormId = surveyFormId,
).getOrThrow()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package com.wap.wapp.core.domain.usecase.survey

import com.wap.wapp.core.data.repository.survey.SurveyFormRepository
import com.wap.wapp.core.model.event.Event
import com.wap.wapp.core.model.survey.SurveyForm
import com.wap.wapp.core.model.survey.SurveyQuestion
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import javax.inject.Inject

class RegisterSurveyUseCase @Inject constructor(
class PostSurveyFormUseCase @Inject constructor(
private val surveyFormRepository: SurveyFormRepository,
) {
suspend operator fun invoke(
Expand All @@ -21,13 +20,11 @@ class RegisterSurveyUseCase @Inject constructor(
deadlineTime: LocalTime,
): Result<Unit> = runCatching {
surveyFormRepository.postSurveyForm(
SurveyForm(
eventId = event.eventId,
title = title,
content = content,
surveyQuestionList = surveyQuestionList,
deadline = LocalDateTime.of(deadlineDate, deadlineTime),
),
eventId = event.eventId,
title = title,
content = content,
surveyQuestionList = surveyQuestionList,
deadline = LocalDateTime.of(deadlineDate, deadlineTime),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class PostSurveyUseCase @Inject constructor(
private val surveyRepository: SurveyRepository,
) {
suspend operator fun invoke(
surveyFormId: String,
eventId: String,
title: String,
content: String,
Expand All @@ -19,6 +20,7 @@ class PostSurveyUseCase @Inject constructor(
val userId = userRepository.getUserId().getOrThrow()

surveyRepository.postSurvey(
surveyFormId = surveyFormId,
userId = userId,
eventId = eventId,
title = title,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.wap.wapp.core.domain.usecase.survey

import com.wap.wapp.core.data.repository.survey.SurveyFormRepository
import com.wap.wapp.core.model.survey.SurveyForm
import javax.inject.Inject

class UpdateSurveyFormUseCase @Inject constructor(
private val surveyFormRepository: SurveyFormRepository,
) {
suspend operator fun invoke(surveyForm: SurveyForm): Result<Unit> = runCatching {
surveyFormRepository.updateSurveyForm(surveyForm)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import java.time.LocalDateTime

data class Survey(
val surveyId: String,
val surveyFormId: String,
val eventName: String,
val userName: String,
val title: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.time.format.DateTimeFormatter

// ์šด์˜์ง„์ด ๋“ฑ๋กํ•˜๋Š” ์„ค๋ฌธ ๋ชจ๋ธ
data class SurveyForm(
val surveyFormId: String,
val eventId: String,
val title: String,
val content: String,
Expand All @@ -17,6 +18,7 @@ data class SurveyForm(
"",
"",
"",
"",
emptyList(),
LocalDateTime.MIN,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ณ„ ๊ฑด์•„๋‹Œ๋ฐ,

ํŒŒ์ด์–ด๋ฒ ์ด์Šค ์‚ฌ์šฉํ•  ๋•Œ default value์ฃผ๋Š” ๊ฑฐ๋ž‘ ๋ถ€ ์ƒ์„ฑ์ž๋กœ ์„ ์–ธํ•˜๋Š” ๊ฑฐ๋ž‘ ์ฐจ์ด์ ์ด ์žˆ๋‚˜์š” ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ •ํ™•ํžˆ ๋‚ด๋ถ€์ ์œผ๋กœ๋Š” ์–ด๋–ป๊ฒŒ ์ฐจ์ด์ ์ด ์žˆ๋Š”์ง€๋Š” ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค ใ… .ใ… 

์ œ๊ฐ€ Default๊ฐ€ ์•„๋‹Œ ๋”ฐ๋กœ ์ƒ์„ฑ์ž๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ ๋Š”

๋‹จ์ˆœํžˆ ๋””ํดํŠธ๋ณด๋‹ค ๋ถ€ ์ƒ์„ฑ์ž๊ฐ€ ์ฝ”๋“œ์ƒ ๊น”๋”ํ•ด๋ณด์—ฌ์„œ, ๋งค๋ฒˆ ์ด๋ ‡๊ฒŒ ์ž‘์„ฑํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค .. !

์ฝ”๋“œ ๋Ÿ‰์œผ๋กœ ๋ดค์„ ๋–„๋Š” ๋””ํดํŠธ๊ฐ€ ๋” ์ ๊ฒŒ ์ž‘์„ฑ๋˜๊ธด ํ•˜๊ฒ ๋„ค์šฉ ํ•˜ํ•˜

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ทธ๋ž˜๋„ ์•„๋งˆ ์ฝ”ํ‹€๋ฆฐ์—์„œ ๋ถ€ ์ƒ์„ฑ์ž๊ฐ€ ๋””ํดํŠธ ๊ฐ’์˜ ์—ญํ• ๋„ ํ•˜๊ธฐ ๋•Œ๋ฌธ์—,

๋‚ด๋ถ€์ ์œผ๋กœ๋Š” ์•„๋งˆ ๊ฐ™๊ฒŒ ๋™์ž‘ํ•˜์ง€ ์•Š์„๊นŒ์š” ?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.wap.wapp.core.model.survey.SurveyAnswer

data class SurveyRequest(
val surveyId: String,
val surveyFormId: String,
val eventId: String,
val userId: String,
val title: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.wap.wapp.core.network.utils.toISOLocalDateTime

data class SurveyResponse(
val surveyId: String,
val surveyFormId: String,
val eventId: String,
val userId: String,
val title: String,
Expand All @@ -18,12 +19,14 @@ data class SurveyResponse(
"",
"",
"",
"",
emptyList<SurveyAnswerResponse>(),
"",
)

fun toDomain(eventName: String, userName: String): Survey = Survey(
surveyId = surveyId,
surveyFormId = surveyFormId,
eventName = eventName,
userName = userName,
title = this.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wap.wapp.core.network.model.survey.form
import com.wap.wapp.core.model.survey.SurveyQuestion

data class SurveyFormRequest(
val surveyFormId: String,
val eventId: String,
val title: String,
val content: String,
Expand All @@ -13,6 +14,7 @@ data class SurveyFormRequest(
"",
"",
"",
"",
emptyList(),
"",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.wap.wapp.core.model.survey.SurveyForm
import com.wap.wapp.core.network.utils.toISOLocalDateTime

data class SurveyFormResponse(
val surveyFormId: String,
val eventId: String,
val userId: String,
val title: String,
Expand All @@ -16,11 +17,13 @@ data class SurveyFormResponse(
"",
"",
"",
"",
emptyList<SurveyQuestionResponse>(),
"",
)

fun toDomain(): SurveyForm = SurveyForm(
surveyFormId = surveyFormId,
eventId = eventId,
title = title,
content = content,
Expand Down
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
Loading