Skip to content

Commit

Permalink
[Feature] UseCase 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
ajou4095 committed Feb 4, 2024
1 parent bef11b8 commit 0905964
Show file tree
Hide file tree
Showing 35 changed files with 504 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -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<Long> {
return groupRepository.addGroup(
name = name
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Unit> {
return groupRepository.deleteGroup(
id = id
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Unit> {
return groupRepository.editGroup(
id = id,
name = name
)
}
}
Original file line number Diff line number Diff line change
@@ -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<List<Group>> {
return groupRepository.getGroupList()
}
}
Original file line number Diff line number Diff line change
@@ -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<String>
): Result<Long> {
return heartRepository.addHeart(
relationId = relationId,
give = give,
money = money,
day = day,
event = event,
memo = memo,
tags = tags
)
}
}
Original file line number Diff line number Diff line change
@@ -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<String>
): Result<Long> {
return heartRepository.addUnrecordedHeart(
scheduleId = scheduleId,
money = money,
tags = tags
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Unit> {
return heartRepository.deleteHeart(
id = id
)
}
}
Original file line number Diff line number Diff line change
@@ -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<String>
): Result<Unit> {
return heartRepository.editHeart(
id = id,
money = money,
day = day,
event = event,
memo = memo,
tags = tags
)
}
}
Original file line number Diff line number Diff line change
@@ -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<List<Heart>> {
return heartRepository.getHeartList(
sort = sort,
name = name
)
}
}
Original file line number Diff line number Diff line change
@@ -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<List<RelatedHeart>> {
return heartRepository.getRelatedHeartList(
id = id,
sort = sort
)
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Unit> {
return memberRepository.editProfile(
profileImageUrl = profileImageUrl,
nickname = nickname,
gender = gender,
birth = birth
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Long> {
return relationRepository.addRelation(
groupId = groupId,
name = name,
imageUrl = imageUrl,
memo = memo
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Unit> {
return relationRepository.deleteRelation(
id = id
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Unit> {
return relationRepository.editRelation(
id = id,
groupId = groupId,
name = name,
imageUrl = imageUrl,
memo = memo
)
}
}
Original file line number Diff line number Diff line change
@@ -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<List<RelationSimple>> {
return relationRepository.getRelationList(
name = name
)
}
}
Original file line number Diff line number Diff line change
@@ -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<RelationDetail> {
return relationRepository.getRelation(
id = id
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Long> {
return scheduleRepository.addSchedule(
relationId = relationId,
day = day,
event = event,
repeatType = repeatType,
repeatFinish = repeatFinish,
alarm = alarm,
time = time,
link = link,
location = location,
memo = memo
)
}
}
Original file line number Diff line number Diff line change
@@ -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<Unit> {
return scheduleRepository.deleteSchedule(
id = id
)
}
}
Loading

0 comments on commit 0905964

Please sign in to comment.