-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from janewaitara/feat_code_cleanup
Feat code cleanup
- Loading branch information
Showing
69 changed files
with
816 additions
and
556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
app/src/main/java/com/mumbicodes/projectie/domain/repository/MilestonesRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 4 additions & 13 deletions
17
.../main/java/com/mumbicodes/projectie/domain/use_case/milestones/GetAllMilestonesUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
package com.mumbicodes.projectie.domain.use_case.milestones | ||
|
||
import com.mumbicodes.projectie.domain.model.DataResult | ||
import com.mumbicodes.projectie.domain.relations.MilestoneWithTasks | ||
import com.mumbicodes.projectie.domain.repository.MilestonesRepository | ||
import com.mumbicodes.projectie.domain.util.AllMilestonesOrder | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
|
||
class GetAllMilestonesUseCase(private val repository: MilestonesRepository) { | ||
|
||
operator fun invoke( | ||
suspend operator fun invoke( | ||
milestonesOrder: AllMilestonesOrder = AllMilestonesOrder.MostUrgent, | ||
): Flow<List<MilestoneWithTasks>> { | ||
return repository.getAllMilestones().map { milestonesWithTasks -> | ||
when (milestonesOrder) { | ||
is AllMilestonesOrder.MostUrgent -> milestonesWithTasks.sortedBy { | ||
it.milestone.milestoneEndDate | ||
} | ||
is AllMilestonesOrder.LeastUrgent -> milestonesWithTasks.sortedByDescending { | ||
it.milestone.milestoneEndDate | ||
} | ||
} | ||
} | ||
): DataResult<Flow<List<MilestoneWithTasks>>> { | ||
return repository.getAllMilestones(milestonesOrder) | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...a/com/mumbicodes/projectie/domain/use_case/milestones/GetMilestoneByIdWithTasksUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package com.mumbicodes.projectie.domain.use_case.milestones | ||
|
||
import com.mumbicodes.projectie.domain.model.DataResult | ||
import com.mumbicodes.projectie.domain.relations.MilestoneWithTasks | ||
import com.mumbicodes.projectie.domain.repository.MilestonesRepository | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
class GetMilestoneByIdWithTasksUseCase( | ||
private val repository: MilestonesRepository | ||
) { | ||
operator fun invoke(milestoneId: Int): Flow<MilestoneWithTasks?> = | ||
suspend operator fun invoke(milestoneId: Int): DataResult<Flow<MilestoneWithTasks?>> = | ||
repository.getMilestoneByIdWithTasks(milestoneId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
app/src/main/java/com/mumbicodes/projectie/domain/use_case/tasks/TransformTasksUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
app/src/main/java/com/mumbicodes/projectie/presentation/allProjects/AllProjectsStates.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.