From 660e80c9db8d0f18b45687715b1e516350edd92a Mon Sep 17 00:00:00 2001 From: SeongHoonC <108349655+SeongHoonC@users.noreply.github.com> Date: Tue, 17 Oct 2023 11:52:46 +0900 Subject: [PATCH] =?UTF-8?q?[AN/USER]=20feat:=20=ED=95=99=EC=83=9D=20?= =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=ED=99=94=EB=A9=B4=20=ED=95=99=EA=B5=90=20?= =?UTF-8?q?=EB=8F=84=EB=A9=94=EC=9D=B8=20=EB=94=94=ED=8F=B4=ED=8A=B8=20?= =?UTF-8?q?=EA=B0=92=20=EC=A0=9C=EA=B1=B0=20(#550)=20(#558)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/repository/SchoolDefaultRepository.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/android/festago/app/src/main/java/com/festago/festago/data/repository/SchoolDefaultRepository.kt b/android/festago/app/src/main/java/com/festago/festago/data/repository/SchoolDefaultRepository.kt index fdca87e05..8f482c3c8 100644 --- a/android/festago/app/src/main/java/com/festago/festago/data/repository/SchoolDefaultRepository.kt +++ b/android/festago/app/src/main/java/com/festago/festago/data/repository/SchoolDefaultRepository.kt @@ -16,7 +16,14 @@ class SchoolDefaultRepository @Inject constructor( .onSuccessOrCatch { it.toDomain() } override suspend fun loadSchoolEmail(schoolId: Long): Result { - // TODO: API 연동 작업 필요 - return Result.success("festago.com") + return runCatchingResponse { schoolRetrofitService.getSchools() } + .onSuccessOrCatch { + val school = it.schools.find { school -> school.id.toLong() == schoolId } + school?.domain ?: throw IllegalArgumentException(MATCH_SCHOOL_NOT_FOUND) + } + } + + companion object { + private const val MATCH_SCHOOL_NOT_FOUND = "MATCH_SCHOOL_NOT_FOUND" } }