From 42d29e1f4b27bde96c19417549c9029d4691e67f Mon Sep 17 00:00:00 2001 From: Ray Jang <48707913+ajou4095@users.noreply.github.com> Date: Sun, 4 Feb 2024 13:43:09 +0900 Subject: [PATCH] =?UTF-8?q?[Feature]=20UseCase=20=EC=97=B0=EA=B2=B0=20(#39?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/feature/group/AddGroupUseCase.kt | 16 ++++++++ .../feature/group/DeleteGroupUseCase.kt | 16 ++++++++ .../usecase/feature/group/EditGroupUseCase.kt | 18 +++++++++ .../feature/group/GetGroupListUseCase.kt | 13 +++++++ .../usecase/feature/heart/AddHeartUseCase.kt | 29 ++++++++++++++ .../heart/AddUnrecordedHeartUseCase.kt | 20 ++++++++++ .../feature/heart/DeleteHeartUseCase.kt | 16 ++++++++ .../usecase/feature/heart/EditHeartUseCase.kt | 27 +++++++++++++ .../feature/heart/GetHeartListUseCase.kt | 19 +++++++++ .../heart/GetRelatedHeartListUseCase.kt | 19 +++++++++ .../member/CheckNicknameUseCase.kt | 2 +- .../feature/member/EditProfileUseCase.kt | 23 +++++++++++ .../feature/relation/AddRelationUseCase.kt | 22 +++++++++++ .../feature/relation/DeleteRelationUseCase.kt | 16 ++++++++ .../feature/relation/EditRelationUseCase.kt | 24 ++++++++++++ .../relation/GetRelationListUseCase.kt | 17 ++++++++ .../feature/relation/GetRelationUseCase.kt | 17 ++++++++ .../feature/schedule/AddScheduleUseCase.kt | 37 ++++++++++++++++++ .../feature/schedule/DeleteScheduleUseCase.kt | 16 ++++++++ .../feature/schedule/EditScheduleUseCase.kt | 39 +++++++++++++++++++ .../GetUnrecordedScheduleListUseCase.kt | 17 ++++++++ .../statistics/GetGroupStatisticsUseCase.kt | 19 +++++++++ .../statistics/GetMyStatisticsUseCase.kt | 19 +++++++++ .../usecase/file/GetPreSignedUrlUseCase.kt | 17 ++++++++ .../domain/usecase/file/UploadImageUseCase.kt | 18 +++++++++ .../{member => legacy}/GetGroupListUseCase.kt | 2 +- .../GetHistoryGroupListUseCase.kt | 2 +- .../GetHistoryInfoUseCase.kt | 2 +- .../domain/usecase/member/AddGroupUseCase.kt | 15 ------- .../usecase/relation/GetRelationUseCase.kt | 27 ------------- .../event/common/group/AddGroupViewModel.kt | 2 +- .../relation/SearchRelationViewModel.kt | 4 +- .../ui/main/home/history/HistoryViewModel.kt | 2 +- .../main/detail/HistoryDetailViewModel.kt | 2 +- .../main/RegistrationMainViewModel.kt | 2 +- 35 files changed, 504 insertions(+), 52 deletions(-) create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/AddGroupUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/DeleteGroupUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/EditGroupUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/GetGroupListUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddHeartUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddUnrecordedHeartUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/DeleteHeartUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/EditHeartUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetHeartListUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetRelatedHeartListUseCase.kt rename domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/{ => feature}/member/CheckNicknameUseCase.kt (85%) create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/member/EditProfileUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/AddRelationUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/DeleteRelationUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/EditRelationUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationListUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/AddScheduleUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/DeleteScheduleUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/EditScheduleUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/GetUnrecordedScheduleListUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetGroupStatisticsUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetMyStatisticsUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/GetPreSignedUrlUseCase.kt create mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/UploadImageUseCase.kt rename domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/{member => legacy}/GetGroupListUseCase.kt (97%) rename domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/{history => legacy}/GetHistoryGroupListUseCase.kt (99%) rename domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/{history => legacy}/GetHistoryInfoUseCase.kt (88%) delete mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/AddGroupUseCase.kt delete mode 100644 domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/AddGroupUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/AddGroupUseCase.kt new file mode 100644 index 00000000..d264d3b3 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/AddGroupUseCase.kt @@ -0,0 +1,16 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.group + +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import javax.inject.Inject + +class AddGroupUseCase @Inject constructor( + private val groupRepository: GroupRepository +) { + suspend operator fun invoke( + name: String + ): Result { + return groupRepository.addGroup( + name = name + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/DeleteGroupUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/DeleteGroupUseCase.kt new file mode 100644 index 00000000..ecff14dd --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/DeleteGroupUseCase.kt @@ -0,0 +1,16 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.group + +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import javax.inject.Inject + +class DeleteGroupUseCase @Inject constructor( + private val groupRepository: GroupRepository +) { + suspend operator fun invoke( + id: Long, + ): Result { + return groupRepository.deleteGroup( + id = id + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/EditGroupUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/EditGroupUseCase.kt new file mode 100644 index 00000000..948d6495 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/EditGroupUseCase.kt @@ -0,0 +1,18 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.group + +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import javax.inject.Inject + +class EditGroupUseCase @Inject constructor( + private val groupRepository: GroupRepository +) { + suspend operator fun invoke( + id: Long, + name: String + ): Result { + return groupRepository.editGroup( + id = id, + name = name + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/GetGroupListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/GetGroupListUseCase.kt new file mode 100644 index 00000000..29b90b3d --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/group/GetGroupListUseCase.kt @@ -0,0 +1,13 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.group + +import ac.dnd.bookkeeping.android.domain.model.group.Group +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import javax.inject.Inject + +class GetGroupListUseCase @Inject constructor( + private val groupRepository: GroupRepository +) { + suspend operator fun invoke(): Result> { + return groupRepository.getGroupList() + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddHeartUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddHeartUseCase.kt new file mode 100644 index 00000000..4f8fda0c --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddHeartUseCase.kt @@ -0,0 +1,29 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.heart + +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import kotlinx.datetime.LocalDate +import javax.inject.Inject + +class AddHeartUseCase @Inject constructor( + private val heartRepository: HeartRepository +) { + suspend operator fun invoke( + relationId: Long, + give: Boolean, + money: Long, + day: LocalDate, + event: String, + memo: String, + tags: List + ): Result { + return heartRepository.addHeart( + relationId = relationId, + give = give, + money = money, + day = day, + event = event, + memo = memo, + tags = tags + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddUnrecordedHeartUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddUnrecordedHeartUseCase.kt new file mode 100644 index 00000000..ddbd1f6a --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/AddUnrecordedHeartUseCase.kt @@ -0,0 +1,20 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.heart + +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import javax.inject.Inject + +class AddUnrecordedHeartUseCase @Inject constructor( + private val heartRepository: HeartRepository +) { + suspend operator fun invoke( + scheduleId: Long, + money: Long, + tags: List + ): Result { + return heartRepository.addUnrecordedHeart( + scheduleId = scheduleId, + money = money, + tags = tags + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/DeleteHeartUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/DeleteHeartUseCase.kt new file mode 100644 index 00000000..42881a8c --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/DeleteHeartUseCase.kt @@ -0,0 +1,16 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.heart + +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import javax.inject.Inject + +class DeleteHeartUseCase @Inject constructor( + private val heartRepository: HeartRepository +) { + suspend operator fun invoke( + id: Long, + ): Result { + return heartRepository.deleteHeart( + id = id + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/EditHeartUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/EditHeartUseCase.kt new file mode 100644 index 00000000..3a23664f --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/EditHeartUseCase.kt @@ -0,0 +1,27 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.heart + +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import kotlinx.datetime.LocalDate +import javax.inject.Inject + +class EditHeartUseCase @Inject constructor( + private val heartRepository: HeartRepository +) { + suspend operator fun invoke( + id: Long, + money: Long, + day: LocalDate, + event: String, + memo: String, + tags: List + ): Result { + return heartRepository.editHeart( + id = id, + money = money, + day = day, + event = event, + memo = memo, + tags = tags + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetHeartListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetHeartListUseCase.kt new file mode 100644 index 00000000..ccc6b306 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetHeartListUseCase.kt @@ -0,0 +1,19 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.heart + +import ac.dnd.bookkeeping.android.domain.model.heart.Heart +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import javax.inject.Inject + +class GetHeartListUseCase @Inject constructor( + private val heartRepository: HeartRepository +) { + suspend operator fun invoke( + sort: String, + name: String + ): Result> { + return heartRepository.getHeartList( + sort = sort, + name = name + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetRelatedHeartListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetRelatedHeartListUseCase.kt new file mode 100644 index 00000000..500c02f6 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/heart/GetRelatedHeartListUseCase.kt @@ -0,0 +1,19 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.heart + +import ac.dnd.bookkeeping.android.domain.model.heart.RelatedHeart +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import javax.inject.Inject + +class GetRelatedHeartListUseCase @Inject constructor( + private val heartRepository: HeartRepository +) { + suspend operator fun invoke( + id: Long, + sort: String + ): Result> { + return heartRepository.getRelatedHeartList( + id = id, + sort = sort + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/CheckNicknameUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/member/CheckNicknameUseCase.kt similarity index 85% rename from domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/CheckNicknameUseCase.kt rename to domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/member/CheckNicknameUseCase.kt index 20cf8484..7273e056 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/CheckNicknameUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/member/CheckNicknameUseCase.kt @@ -1,4 +1,4 @@ -package ac.dnd.bookkeeping.android.domain.usecase.member +package ac.dnd.bookkeeping.android.domain.usecase.feature.member import ac.dnd.bookkeeping.android.domain.repository.MemberRepository import javax.inject.Inject diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/member/EditProfileUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/member/EditProfileUseCase.kt new file mode 100644 index 00000000..563241da --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/member/EditProfileUseCase.kt @@ -0,0 +1,23 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.member + +import ac.dnd.bookkeeping.android.domain.repository.MemberRepository +import kotlinx.datetime.LocalDate +import javax.inject.Inject + +class EditProfileUseCase @Inject constructor( + private val memberRepository: MemberRepository +) { + suspend operator fun invoke( + profileImageUrl: String, + nickname: String, + gender: String, + birth: LocalDate + ): Result { + return memberRepository.editProfile( + profileImageUrl = profileImageUrl, + nickname = nickname, + gender = gender, + birth = birth + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/AddRelationUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/AddRelationUseCase.kt new file mode 100644 index 00000000..dbdffa04 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/AddRelationUseCase.kt @@ -0,0 +1,22 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.relation + +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import javax.inject.Inject + +class AddRelationUseCase @Inject constructor( + private val relationRepository: RelationRepository +) { + suspend operator fun invoke( + groupId: Long, + name: String, + imageUrl: String, + memo: String + ): Result { + return relationRepository.addRelation( + groupId = groupId, + name = name, + imageUrl = imageUrl, + memo = memo + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/DeleteRelationUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/DeleteRelationUseCase.kt new file mode 100644 index 00000000..70f8e796 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/DeleteRelationUseCase.kt @@ -0,0 +1,16 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.relation + +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import javax.inject.Inject + +class DeleteRelationUseCase @Inject constructor( + private val relationRepository: RelationRepository +) { + suspend operator fun invoke( + id: Long + ): Result { + return relationRepository.deleteRelation( + id = id + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/EditRelationUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/EditRelationUseCase.kt new file mode 100644 index 00000000..6f3d60db --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/EditRelationUseCase.kt @@ -0,0 +1,24 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.relation + +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import javax.inject.Inject + +class EditRelationUseCase @Inject constructor( + private val relationRepository: RelationRepository +) { + suspend operator fun invoke( + id: Long, + groupId: Long, + name: String, + imageUrl: String, + memo: String + ): Result { + return relationRepository.editRelation( + id = id, + groupId = groupId, + name = name, + imageUrl = imageUrl, + memo = memo + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationListUseCase.kt new file mode 100644 index 00000000..ab6412aa --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationListUseCase.kt @@ -0,0 +1,17 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.relation + +import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimple +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import javax.inject.Inject + +class GetRelationListUseCase @Inject constructor( + private val relationRepository: RelationRepository +) { + suspend operator fun invoke( + name: String + ): Result> { + return relationRepository.getRelationList( + name = name + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationUseCase.kt new file mode 100644 index 00000000..a1fa00c8 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/relation/GetRelationUseCase.kt @@ -0,0 +1,17 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.relation + +import ac.dnd.bookkeeping.android.domain.model.relation.RelationDetail +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import javax.inject.Inject + +class GetRelationUseCase @Inject constructor( + private val relationRepository: RelationRepository +) { + suspend operator fun invoke( + id: Long + ): Result { + return relationRepository.getRelation( + id = id + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/AddScheduleUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/AddScheduleUseCase.kt new file mode 100644 index 00000000..00dd5a4f --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/AddScheduleUseCase.kt @@ -0,0 +1,37 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.schedule + +import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository +import kotlinx.datetime.LocalDate +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.LocalTime +import javax.inject.Inject + +class AddScheduleUseCase @Inject constructor( + private val scheduleRepository: ScheduleRepository +) { + suspend operator fun invoke( + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String + ): Result { + return scheduleRepository.addSchedule( + relationId = relationId, + day = day, + event = event, + repeatType = repeatType, + repeatFinish = repeatFinish, + alarm = alarm, + time = time, + link = link, + location = location, + memo = memo + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/DeleteScheduleUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/DeleteScheduleUseCase.kt new file mode 100644 index 00000000..8256e8d8 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/DeleteScheduleUseCase.kt @@ -0,0 +1,16 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.schedule + +import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository +import javax.inject.Inject + +class DeleteScheduleUseCase @Inject constructor( + private val scheduleRepository: ScheduleRepository +) { + suspend operator fun invoke( + id: Long + ): Result { + return scheduleRepository.deleteSchedule( + id = id + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/EditScheduleUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/EditScheduleUseCase.kt new file mode 100644 index 00000000..c9d3482a --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/EditScheduleUseCase.kt @@ -0,0 +1,39 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.schedule + +import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository +import kotlinx.datetime.LocalDate +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.LocalTime +import javax.inject.Inject + +class EditScheduleUseCase @Inject constructor( + private val scheduleRepository: ScheduleRepository +) { + suspend operator fun invoke( + id: Long, + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String + ): Result { + return scheduleRepository.editSchedule( + id = id, + relationId = relationId, + day = day, + event = event, + repeatType = repeatType, + repeatFinish = repeatFinish, + alarm = alarm, + time = time, + link = link, + location = location, + memo = memo + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/GetUnrecordedScheduleListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/GetUnrecordedScheduleListUseCase.kt new file mode 100644 index 00000000..d46540a9 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/schedule/GetUnrecordedScheduleListUseCase.kt @@ -0,0 +1,17 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.schedule + +import ac.dnd.bookkeeping.android.domain.model.schedule.UnrecordedSchedule +import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository +import javax.inject.Inject + +class GetUnrecordedScheduleListUseCase @Inject constructor( + private val scheduleRepository: ScheduleRepository +) { + suspend operator fun invoke( + name: String + ): Result> { + return scheduleRepository.getUnrecordedScheduleList( + name = name + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetGroupStatisticsUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetGroupStatisticsUseCase.kt new file mode 100644 index 00000000..fdc65bba --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetGroupStatisticsUseCase.kt @@ -0,0 +1,19 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.statistics + +import ac.dnd.bookkeeping.android.domain.model.statistics.GroupStatistics +import ac.dnd.bookkeeping.android.domain.repository.StatisticsRepository +import javax.inject.Inject + +class GetGroupStatisticsUseCase @Inject constructor( + private val statisticsRepository: StatisticsRepository +) { + suspend operator fun invoke( + gender: String, + range: Int + ): Result { + return statisticsRepository.getGroupStatistics( + gender = gender, + range = range + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetMyStatisticsUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetMyStatisticsUseCase.kt new file mode 100644 index 00000000..485cd0f8 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/feature/statistics/GetMyStatisticsUseCase.kt @@ -0,0 +1,19 @@ +package ac.dnd.bookkeeping.android.domain.usecase.feature.statistics + +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatistics +import ac.dnd.bookkeeping.android.domain.repository.StatisticsRepository +import javax.inject.Inject + +class GetMyStatisticsUseCase @Inject constructor( + private val statisticsRepository: StatisticsRepository +) { + suspend operator fun invoke( + year: Int, + month: Int + ): Result { + return statisticsRepository.getMyStatistics( + year = year, + month = month + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/GetPreSignedUrlUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/GetPreSignedUrlUseCase.kt new file mode 100644 index 00000000..194aa774 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/GetPreSignedUrlUseCase.kt @@ -0,0 +1,17 @@ +package ac.dnd.bookkeeping.android.domain.usecase.file + +import ac.dnd.bookkeeping.android.domain.model.file.PreSignedUrl +import ac.dnd.bookkeeping.android.domain.repository.FileRepository +import javax.inject.Inject + +class GetPreSignedUrlUseCase @Inject constructor( + private val fileRepository: FileRepository +) { + suspend operator fun invoke( + fileName: String + ): Result { + return fileRepository.getPreSignedUrl( + fileName = fileName + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/UploadImageUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/UploadImageUseCase.kt new file mode 100644 index 00000000..d3fe27d6 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/file/UploadImageUseCase.kt @@ -0,0 +1,18 @@ +package ac.dnd.bookkeeping.android.domain.usecase.file + +import ac.dnd.bookkeeping.android.domain.repository.FileRepository +import javax.inject.Inject + +class UploadImageUseCase @Inject constructor( + private val fileRepository: FileRepository +) { + suspend operator fun invoke( + preSignedUrl: String, + imageUri: String + ): Result { + return fileRepository.upload( + preSignedUrl = preSignedUrl, + imageUri = imageUri + ) + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/GetGroupListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetGroupListUseCase.kt similarity index 97% rename from domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/GetGroupListUseCase.kt rename to domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetGroupListUseCase.kt index d798b000..4d73d938 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/GetGroupListUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetGroupListUseCase.kt @@ -1,4 +1,4 @@ -package ac.dnd.bookkeeping.android.domain.usecase.member +package ac.dnd.bookkeeping.android.domain.usecase.legacy import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryGroupListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetHistoryGroupListUseCase.kt similarity index 99% rename from domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryGroupListUseCase.kt rename to domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetHistoryGroupListUseCase.kt index a60c5c1b..19f1fe94 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryGroupListUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetHistoryGroupListUseCase.kt @@ -1,4 +1,4 @@ -package ac.dnd.bookkeeping.android.domain.usecase.history +package ac.dnd.bookkeeping.android.domain.usecase.legacy import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryInfoUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetHistoryInfoUseCase.kt similarity index 88% rename from domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryInfoUseCase.kt rename to domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetHistoryInfoUseCase.kt index 29686f4e..ef557fe0 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryInfoUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/legacy/GetHistoryInfoUseCase.kt @@ -1,4 +1,4 @@ -package ac.dnd.bookkeeping.android.domain.usecase.history +package ac.dnd.bookkeeping.android.domain.usecase.legacy import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy import javax.inject.Inject diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/AddGroupUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/AddGroupUseCase.kt deleted file mode 100644 index 9e29e0d6..00000000 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/AddGroupUseCase.kt +++ /dev/null @@ -1,15 +0,0 @@ -package ac.dnd.bookkeeping.android.domain.usecase.member - -import ac.dnd.bookkeeping.android.domain.repository.MemberRepository -import javax.inject.Inject - -class AddGroupUseCase @Inject constructor( - private val memberRepository: MemberRepository -) { - suspend operator fun invoke( - name: String - ): Result { - // TODO - return Result.success(Unit) - } -} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt deleted file mode 100644 index 97622226..00000000 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt +++ /dev/null @@ -1,27 +0,0 @@ -package ac.dnd.bookkeeping.android.domain.usecase.relation - -import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy -import ac.dnd.bookkeeping.android.domain.model.legacy.RelationGroupLegacy -import javax.inject.Inject - -class GetRelationUseCase @Inject constructor( - -) { - suspend operator fun invoke( - id: Long - ): Result { - // TODO - return Result.success( - RelationLegacy( - id = 6710, - name = "Harrison House", - group = RelationGroupLegacy( - id = 5104, - name = "Casandra Reynolds" - ), - giveMoney = 5892, - takeMoney = 5706 - ) - ) - } -} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/group/AddGroupViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/group/AddGroupViewModel.kt index 55b6792c..07437871 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/group/AddGroupViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/group/AddGroupViewModel.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.group import ac.dnd.bookkeeping.android.domain.model.error.ServerException -import ac.dnd.bookkeeping.android.domain.usecase.member.AddGroupUseCase +import ac.dnd.bookkeeping.android.domain.usecase.feature.group.AddGroupUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.EventFlow import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.MutableEventFlow diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt index 01136454..368c9425 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt @@ -2,8 +2,8 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.relati import ac.dnd.bookkeeping.android.domain.model.error.ServerException import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy -import ac.dnd.bookkeeping.android.domain.usecase.member.CheckNicknameUseCase -import ac.dnd.bookkeeping.android.domain.usecase.member.GetGroupListUseCase +import ac.dnd.bookkeeping.android.domain.usecase.feature.member.CheckNicknameUseCase +import ac.dnd.bookkeeping.android.domain.usecase.legacy.GetGroupListUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.EventFlow import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.MutableEventFlow diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt index 3f563b1d..ac5cadb0 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt @@ -2,7 +2,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history import ac.dnd.bookkeeping.android.domain.model.error.ServerException import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy -import ac.dnd.bookkeeping.android.domain.usecase.history.GetHistoryInfoUseCase +import ac.dnd.bookkeeping.android.domain.usecase.legacy.GetHistoryInfoUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.EventFlow import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.MutableEventFlow diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt index 855a9d64..97fb3010 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt @@ -2,7 +2,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main.detail import ac.dnd.bookkeeping.android.domain.model.error.ServerException import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy -import ac.dnd.bookkeeping.android.domain.usecase.history.GetHistoryGroupListUseCase +import ac.dnd.bookkeeping.android.domain.usecase.legacy.GetHistoryGroupListUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.EventFlow import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.MutableEventFlow diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/registration/main/RegistrationMainViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/registration/main/RegistrationMainViewModel.kt index f85c3f05..b7479ba7 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/registration/main/RegistrationMainViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/registration/main/RegistrationMainViewModel.kt @@ -2,7 +2,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.registration.main import ac.dnd.bookkeeping.android.domain.model.error.ServerException import ac.dnd.bookkeeping.android.domain.usecase.authentication.RegistrationUseCase -import ac.dnd.bookkeeping.android.domain.usecase.member.CheckNicknameUseCase +import ac.dnd.bookkeeping.android.domain.usecase.feature.member.CheckNicknameUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.EventFlow import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.MutableEventFlow