From 9100e6fe4b5578b0b428a44e04e26d6dd0ec6b3f Mon Sep 17 00:00:00 2001 From: 8954sood <8954sood@naver.com> Date: Fri, 19 Apr 2024 14:47:11 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=C2=A0::=20fix=20localdatetime?= =?UTF-8?q?=20mapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kr/hs/dgsw/smartschool/data/utils/LocalDateUtils.kt | 5 +++-- .../hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt | 6 ++++-- .../hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt | 5 +++-- .../hs/dgsw/smartschool/remote/mapper/OutResponseMapper.kt | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/data/src/main/java/kr/hs/dgsw/smartschool/data/utils/LocalDateUtils.kt b/data/src/main/java/kr/hs/dgsw/smartschool/data/utils/LocalDateUtils.kt index 71226891..b93c94bd 100644 --- a/data/src/main/java/kr/hs/dgsw/smartschool/data/utils/LocalDateUtils.kt +++ b/data/src/main/java/kr/hs/dgsw/smartschool/data/utils/LocalDateUtils.kt @@ -14,7 +14,7 @@ fun String?.yearDateTimeToLocalDate(): LocalDateTime { try { if (this != null) { val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") - return LocalDateTime.parse(this, formatter) + return LocalDateTime.parse(this.split(".")[0], formatter) } } catch (e: Exception) { e.printStackTrace() @@ -23,7 +23,8 @@ fun String?.yearDateTimeToLocalDate(): LocalDateTime { } fun String.yearDateTimeToLocalDateT(): LocalDateTime { val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") - return LocalDateTime.parse(this, formatter) + val time = if (length == 16) "$this:00" else this + return LocalDateTime.parse(time.split(".")[0], formatter) } fun String.yearDateTimeHourToLocalDate(): LocalDateTime { diff --git a/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt b/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt index ce37481e..81022805 100644 --- a/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt +++ b/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt @@ -1,6 +1,8 @@ package kr.hs.dgsw.smartschool.local.mapper +import kr.hs.dgsw.smartschool.data.utils.yearDateTimeMinToLocalDate import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate +import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT import kr.hs.dgsw.smartschool.domain.model.member.Member import kr.hs.dgsw.smartschool.domain.model.member.MemberRole import kr.hs.dgsw.smartschool.domain.model.member.MemberStatus @@ -56,8 +58,8 @@ internal fun Member.toEntity(): MemberEntity { status = status.name.toMemberStatus(), teacher = teacher, student = student, - createdAt = createdAt.yearDateTimeToLocalDate().toString(), - modifiedAt = modifiedAt.yearDateTimeToLocalDate().toString(), + createdAt = createdAt.yearDateTimeToLocalDateT().toString(), + modifiedAt = modifiedAt.yearDateTimeToLocalDateT().toString(), phone = phone ) } diff --git a/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt b/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt index 7a4904cb..637c1b6a 100644 --- a/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt +++ b/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt @@ -2,6 +2,7 @@ package kr.hs.dgsw.smartschool.remote.mapper import kr.hs.dgsw.smartschool.data.data.auth.LoginData import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate +import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT import kr.hs.dgsw.smartschool.domain.model.member.Member import kr.hs.dgsw.smartschool.domain.model.member.MemberRole import kr.hs.dgsw.smartschool.domain.model.member.MemberStatus @@ -28,8 +29,8 @@ internal fun MemberResponse.toMember(): Member = phone = phone, student = student?.toModel(), teacher = teacher?.toModel(), - createdAt = createdAt?.yearDateTimeToLocalDate().toString(), - modifiedAt = modifiedAt?.yearDateTimeToLocalDate().toString(), + createdAt = createdAt?.yearDateTimeToLocalDateT().toString(), + modifiedAt = modifiedAt?.yearDateTimeToLocalDateT().toString(), ) internal fun MemberResponseRole.toMemberRole(): MemberRole = diff --git a/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/OutResponseMapper.kt b/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/OutResponseMapper.kt index d811345c..0627d7a1 100644 --- a/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/OutResponseMapper.kt +++ b/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/OutResponseMapper.kt @@ -1,6 +1,7 @@ package kr.hs.dgsw.smartschool.remote.mapper import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate +import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT import kr.hs.dgsw.smartschool.domain.model.out.Out import kr.hs.dgsw.smartschool.domain.model.out.OutItem import kr.hs.dgsw.smartschool.domain.model.out.OutStatus @@ -22,9 +23,9 @@ internal fun OutResponse.toOut(): Out { rejectReason = rejectReason ?: "", startOutDate = startOutDate, endOutDate = endOutDate, - createdAt = createdAt.yearDateTimeToLocalDate().toString(), + createdAt = createdAt.yearDateTimeToLocalDateT().toString(), - modifiedAt = modifiedAt.yearDateTimeToLocalDate().toString() + modifiedAt = modifiedAt.yearDateTimeToLocalDateT().toString() ) } From c8a7a82208a2e0de0a484d097c2f2536aec3c9d8 Mon Sep 17 00:00:00 2001 From: 8954sood <8954sood@naver.com> Date: Fri, 19 Apr 2024 15:25:14 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=C2=A0::=20fix=20refresh=20with?= =?UTF-8?q?=20out,=20out=20sleeping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../local/mapper/MemberEntityMapper.kt | 1 - .../features/main/out/screen/OutScreen.kt | 6 +++- .../features/main/out/vm/OutViewModel.kt | 31 +++++++++++++++++-- .../features/out/vm/CurrentOutViewModel.kt | 22 ++++++++----- 4 files changed, 48 insertions(+), 12 deletions(-) diff --git a/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt b/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt index 81022805..f760f061 100644 --- a/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt +++ b/local/src/main/java/kr/hs/dgsw/smartschool/local/mapper/MemberEntityMapper.kt @@ -1,6 +1,5 @@ package kr.hs.dgsw.smartschool.local.mapper -import kr.hs.dgsw.smartschool.data.utils.yearDateTimeMinToLocalDate import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT import kr.hs.dgsw.smartschool.domain.model.member.Member diff --git a/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/screen/OutScreen.kt b/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/screen/OutScreen.kt index 21178632..7a823275 100644 --- a/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/screen/OutScreen.kt +++ b/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/screen/OutScreen.kt @@ -131,7 +131,11 @@ fun OutScreen( val refreshState = rememberPullRefreshState( refreshing = state.refreshing, onRefresh = { - outViewModel.getOutsRefresh() + if (state.currentOutType == 0) { + outViewModel.getOutsRefresh() + } else { + outViewModel.getOutSleepingRefresh() + } } ) diff --git a/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/vm/OutViewModel.kt b/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/vm/OutViewModel.kt index 64973b4d..8c050121 100644 --- a/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/vm/OutViewModel.kt +++ b/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/main/out/vm/OutViewModel.kt @@ -116,8 +116,35 @@ class OutViewModel @Inject constructor( reduce { state.copy( refreshing = false, - outGoings = it, - outSleepings = it, + outGoings = it.filter { it.status == OutStatus.PENDING }, + ) + } + }.onFailure { + reduce { + state.copy( + refreshing = false, + ) + } + postSideEffect(OutSideEffect.ShowException(it)) + } + } + + fun getOutSleepingRefresh() = intent { + reduce { + state.copy( + refreshing = true, + ) + } + + getOutsByDateRemoteUseCase.getOutSleeping( + GetOutsByDateRemoteUseCase.Param( + date = LocalDate.now().toString() + ) + ).onSuccess { + reduce { + state.copy( + refreshing = false, + outSleepings = it.filter { it.status == OutStatus.PENDING }, ) } }.onFailure { diff --git a/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/out/vm/CurrentOutViewModel.kt b/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/out/vm/CurrentOutViewModel.kt index 4777c5d1..4fb94c83 100644 --- a/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/out/vm/CurrentOutViewModel.kt +++ b/presentation/src/main/java/kr/hs/dgsw/smartschool/dodamdodam_teacher/features/out/vm/CurrentOutViewModel.kt @@ -98,20 +98,26 @@ class CurrentOutViewModel @Inject constructor( refreshing = true, ) } + val param = GetOutsByDateRemoteUseCase.Param( + LocalDate.now().toString() + ) - getOutsByDateRemoteUseCase( - GetOutsByDateRemoteUseCase.Param( - LocalDate.now().toString() - ) - ).onSuccess { outGoing -> - getOutsByDateRemoteUseCase.getOutSleepingValid().onSuccess { outSleeping -> + getOutsByDateRemoteUseCase(param).onSuccess { outGoing -> + getOutsByDateRemoteUseCase.getOutSleeping(param).onSuccess { outSleeping -> + reduce { + state.copy( + refreshing = false, + outGoings = outGoing.filter { it.status == OutStatus.ALLOWED }, + outSleepings = outSleeping.filter { it.status == OutStatus.ALLOWED }, + ) + } + }.onFailure { reduce { state.copy( refreshing = false, - outGoings = outGoing, - outSleepings = outSleeping, ) } + postSideEffect(CurrentOutSideEffect.ShowException(it)) } }.onFailure { reduce { From 80c034d3889ae507cb2cc7444499a5569613f8f0 Mon Sep 17 00:00:00 2001 From: 8954sood <8954sood@naver.com> Date: Fri, 19 Apr 2024 15:35:48 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20version=20up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/java/ProjectProperties.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/ProjectProperties.kt b/buildSrc/src/main/java/ProjectProperties.kt index 6ff65007..8204f7d8 100644 --- a/buildSrc/src/main/java/ProjectProperties.kt +++ b/buildSrc/src/main/java/ProjectProperties.kt @@ -1,8 +1,8 @@ import org.gradle.api.JavaVersion object ProjectProperties { - const val VERSION_CODE = 32 - const val VERSION_NAME = "2.2.1" + const val VERSION_CODE = 33 + const val VERSION_NAME = "2.2.2" const val APPLICATION_ID = "kr.hs.dgsw.smartschool.dodamdodam_teacher" const val NAME_SPACE_DOMAIN = "kr.hs.dgsw.smartschool.domain" From 9e539cc63ec6a25995fcf1424269a6b8bc17da51 Mon Sep 17 00:00:00 2001 From: 8954sood <8954sood@naver.com> Date: Fri, 19 Apr 2024 15:41:58 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8E=A8=20::=20apply=20style=20lint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/repository/StudentRepository.kt | 12 ------------ .../smartschool/remote/mapper/AuthResponseMapper.kt | 1 - 2 files changed, 13 deletions(-) delete mode 100644 domain/src/main/java/kr/hs/dgsw/smartschool/domain/repository/StudentRepository.kt diff --git a/domain/src/main/java/kr/hs/dgsw/smartschool/domain/repository/StudentRepository.kt b/domain/src/main/java/kr/hs/dgsw/smartschool/domain/repository/StudentRepository.kt deleted file mode 100644 index e98c4f70..00000000 --- a/domain/src/main/java/kr/hs/dgsw/smartschool/domain/repository/StudentRepository.kt +++ /dev/null @@ -1,12 +0,0 @@ -package kr.hs.dgsw.smartschool.domain.repository - -interface StudentRepository { - -// suspend fun setStudents(): List -// -// suspend fun getStudents(): List -// -// suspend fun getStudentById(id: Int): Student - -// suspend fun getStudentByMemberId(id: String): Student -} diff --git a/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt b/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt index 637c1b6a..a5a510f8 100644 --- a/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt +++ b/remote/src/main/java/kr/hs/dgsw/smartschool/remote/mapper/AuthResponseMapper.kt @@ -1,7 +1,6 @@ package kr.hs.dgsw.smartschool.remote.mapper import kr.hs.dgsw.smartschool.data.data.auth.LoginData -import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT import kr.hs.dgsw.smartschool.domain.model.member.Member import kr.hs.dgsw.smartschool.domain.model.member.MemberRole