Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions Prezel/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ dependencies {
implementation(projects.featureHomeImpl)
implementation(projects.featureHistoryApi)
implementation(projects.featureHistoryImpl)
implementation(projects.featureFeedbackApi)
implementation(projects.featureFeedbackImpl)
implementation(projects.featureMyApi)
implementation(projects.featureMyImpl)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ private fun ServerErrorCode.toDomainError(): AppError =

ServerErrorCode.TERMS_NOT_FOUND,
ServerErrorCode.PRESENTATION_NOT_FOUND,
ServerErrorCode.PRESENTATION_REVIEW_NOT_FOUND,
ServerErrorCode.ANALYSIS_RESULT_NOT_FOUND,
-> AppError.NOT_FOUND

ServerErrorCode.DUPLICATE_NICKNAME -> AppError.DUPLICATE
ServerErrorCode.DUPLICATE_NICKNAME,
ServerErrorCode.SELF_FEEDBACK_ALREADY_WRITTEN,
-> AppError.DUPLICATE

ServerErrorCode.UNAUTHORIZED,
ServerErrorCode.FORBIDDEN,
ServerErrorCode.PRESENTATION_REVIEW_FORBIDDEN,
ServerErrorCode.INVALID_TOKEN,
ServerErrorCode.TOKEN_STOLEN,
ServerErrorCode.USER_NOT_FOUND,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal fun PresentationSummaryResponse.toDomain(): PresentationAnalysisSummary
spellErrorCount = spellErrorCount,
grammarErrorCount = grammarErrorCount,
totalErrorCount = totalErrorCount,
growth = growthGraph.map { item -> item.toDomain() },
growth = growthGraph?.map { item -> item.toDomain() }.orEmpty(),
expectedQuestions = expectedQuestions.map { item -> item.toDomain() },
selfFeedback = reviewContent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,15 @@ internal class PresentationRepositoryImpl @Inject constructor(
}.mapCatching { response ->
response.map(GetMainDataResponse::toDomain)
}.mapDomainFailure()

override suspend fun writeSelfFeedback(
presentationId: Long,
content: String,
): Result<Unit> =
runCatching {
presentationRemoteDataSource.writeSelfFeedback(
presentationId = presentationId,
content = content,
)
}.mapDomainFailure()
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ interface PresentationRepository {
suspend fun getPracticeRecords(presentationId: Long): Result<PracticeRecords>

suspend fun getMainData(): Result<List<MainData>>

suspend fun writeSelfFeedback(
presentationId: Long,
content: String,
): Result<Unit>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.team.prezel.core.domain.usecase.presentation

import com.team.prezel.core.domain.repository.presentation.PresentationRepository
import javax.inject.Inject

class WriteSelfFeedbackUseCase @Inject constructor(
private val presentationRepository: PresentationRepository,
) {
suspend operator fun invoke(
presentationId: Long,
content: String,
): Result<Unit> =
presentationRepository.writeSelfFeedback(
presentationId = presentationId,
content = content,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ interface PresentationRemoteDataSource {
suspend fun getPracticeRecords(presentationId: Long): GetPracticeRecordsResponse

suspend fun getMainData(): List<GetMainDataResponse>

suspend fun writeSelfFeedback(
presentationId: Long,
content: String,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package com.team.prezel.core.network.datasource

import com.team.prezel.core.network.model.presentation.GetMainDataResponse
import com.team.prezel.core.network.model.presentation.GetPracticeRecordsResponse
import com.team.prezel.core.network.model.presentation.GetPresentationDetailResponse
import com.team.prezel.core.network.model.presentation.GetPresentationsResponse
import com.team.prezel.core.network.model.presentation.PresentationScriptDetailResponse
import com.team.prezel.core.network.model.presentation.PresentationSummaryResponse
import com.team.prezel.core.network.model.presentation.PresentationWordDetailResponse
import com.team.prezel.core.network.model.presentation.review.SelfFeedbackRequest
import com.team.prezel.core.network.model.requireData
import com.team.prezel.core.network.model.requireSuccess
import com.team.prezel.core.network.service.PresentationService
Expand Down Expand Up @@ -96,15 +98,26 @@ internal class PresentationRemoteDataSourceImpl @Inject constructor(
override suspend fun getPastPresentations(): List<GetPresentationsResponse> = presentationService.getPastPresentations().requireData()

override suspend fun getUpcomingPresentationDetail(presentationId: Long): PresentationSummaryResponse =
presentationService.getUpcomingPresentationDetail(presentationId = presentationId).requireData().analysisResult
presentationService.getUpcomingPresentationDetail(presentationId = presentationId).requireData().toPresentationSummaryResponse()

override suspend fun getPastPresentationDetail(presentationId: Long): PresentationSummaryResponse =
presentationService.getPastPresentationDetail(presentationId = presentationId).requireData().analysisResult
presentationService.getPastPresentationDetail(presentationId = presentationId).requireData().toPresentationSummaryResponse()

override suspend fun getPracticeRecords(presentationId: Long): GetPracticeRecordsResponse =
presentationService.getPracticeRecords(presentationId = presentationId).requireData()

override suspend fun getMainData(): List<GetMainDataResponse> = presentationService.getMainData().requireData()

override suspend fun writeSelfFeedback(
presentationId: Long,
content: String,
) {
presentationService
.writeSelfFeedback(
presentationId = presentationId,
request = SelfFeedbackRequest(content = content),
).requireSuccess()
}
}

private fun FormBuilder.appendAudioPart(audioFilePath: String) {
Expand All @@ -119,6 +132,11 @@ private fun FormBuilder.appendAudioPart(audioFilePath: String) {
)
}

private fun GetPresentationDetailResponse.toPresentationSummaryResponse(): PresentationSummaryResponse =
analysisResult.copy(
reviewContent = reviewContent ?: analysisResult.reviewContent,
)

private fun FormBuilder.appendScriptPart(scriptFilePath: String) {
val file = File(scriptFilePath)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ enum class ServerErrorCode(
INVALID_ID_TOKEN("T003"),
TERMS_NOT_FOUND("TR001"),
REQUIRED_TERMS_DISAGREED("TR002"),
SELF_FEEDBACK_ALREADY_WRITTEN("R002"),
FILE_IS_EMPTY("F001"),
FILE_UPLOAD_FAILED("F002"),
UNSUPPORTED_FILE_FORMAT("F004"),
PRESENTATION_REVIEW_NOT_FOUND("PR001"),
PRESENTATION_REVIEW_FORBIDDEN("PR002"),
PRESENTATION_NOT_FOUND("P001"),
ANALYSIS_RESULT_NOT_FOUND("A001"),
SENTENCE_NOT_FOUND("S001"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ import kotlinx.serialization.Serializable
data class GetPresentationDetailResponse(
@SerialName("analysisResult")
val analysisResult: PresentationSummaryResponse,
@SerialName("reviewContent")
val reviewContent: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data class PresentationSummaryResponse(
@SerialName("totalErrorCount")
val totalErrorCount: Int,
@SerialName("growthGraph")
val growthGraph: List<PresentationGrowthResponse>,
val growthGraph: List<PresentationGrowthResponse>? = null,
@SerialName("expectedQuestions")
val expectedQuestions: List<PresentationExpectedQuestionResponse>,
@SerialName("reviewContent")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.team.prezel.core.network.model.presentation.review

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class SelfFeedbackRequest(
@SerialName("content")
val content: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.team.prezel.core.network.model.presentation.GetPresentationsResponse
import com.team.prezel.core.network.model.presentation.PresentationScriptDetailResponse
import com.team.prezel.core.network.model.presentation.PresentationSummaryResponse
import com.team.prezel.core.network.model.presentation.PresentationWordDetailResponse
import com.team.prezel.core.network.model.presentation.review.SelfFeedbackRequest
import de.jensklingenberg.ktorfit.http.Body
import de.jensklingenberg.ktorfit.http.DELETE
import de.jensklingenberg.ktorfit.http.GET
Expand Down Expand Up @@ -65,4 +66,10 @@ interface PresentationService {

@GET("main")
suspend fun getMainData(): BaseResponse<List<GetMainDataResponse>>

@POST("recording/{presentationId}/review")
suspend fun writeSelfFeedback(
@Path("presentationId") presentationId: Long,
@Body request: SelfFeedbackRequest,
): BaseResponse<Unit>
}
2 changes: 1 addition & 1 deletion Prezel/detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ complexity:
active: true
thresholdInFiles: 20
thresholdInClasses: 15
thresholdInInterfaces: 12
thresholdInInterfaces: 15
thresholdInObjects: 20
thresholdInEnums: 10
ignoreAnnotatedFunctions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityRetainedComponent
import dagger.multibindings.IntoSet
import java.util.UUID

internal fun EntryProviderScope<NavKey>.featureAnalysisEntryBuilder() {
analysisEntry<AnalysisNavKey.Schedule> { key -> key.enterStep(AnalysisFlowStep.PRESENTATION_SCHEDULE) }
Expand Down Expand Up @@ -84,7 +83,6 @@ private fun AnalysisRoute(
navigator.navigate(
key = ReportNavKey(
presentationId = presentationId,
refreshKey = newReportRefreshKey(),
),
clearStack = true,
)
Expand Down Expand Up @@ -127,5 +125,3 @@ object FeatureAnalysisModule {
featureAnalysisEntryBuilder()
}
}

private fun newReportRefreshKey(): String = UUID.randomUUID().toString()
7 changes: 7 additions & 0 deletions Prezel/feature/feedback/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
alias(libs.plugins.prezel.android.feature.api)
}

android {
namespace = "com.team.prezel.feature.feedback.api"
}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.team.prezel.feature.feedback.api

import androidx.navigation3.runtime.NavKey
import kotlinx.serialization.Serializable

@Serializable
data class FeedbackNavKey(
val presentationId: Long,
val title: String,
val isPast: Boolean = false,
) : NavKey
2 changes: 2 additions & 0 deletions Prezel/feature/feedback/api/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources />
15 changes: 15 additions & 0 deletions Prezel/feature/feedback/impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
alias(libs.plugins.prezel.android.feature.impl)
}

android {
namespace = "com.team.prezel.feature.feedback.impl"
}

dependencies {
implementation(projects.coreCommon)
implementation(projects.coreModel)
implementation(projects.coreDomain)

implementation(projects.featureFeedbackApi)
}
Empty file.
Empty file.
Loading