-
Notifications
You must be signed in to change notification settings - Fork 0
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 #363 from apeun-gidaechi/feature/362-rename-task-t…
…o-assignment Refactor/Rename task to assignment
- Loading branch information
Showing
39 changed files
with
200 additions
and
202 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
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions
10
...ava/com/seugi/data/task/TaskRepository.kt → ...i/data/assignment/AssignmentRepository.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,16 +1,16 @@ | ||
package com.seugi.data.task | ||
package com.seugi.data.assignment | ||
|
||
import com.seugi.common.model.Result | ||
import com.seugi.data.task.model.TaskModel | ||
import com.seugi.data.assignment.model.AssignmentModel | ||
import java.time.LocalDateTime | ||
import kotlinx.collections.immutable.ImmutableList | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface TaskRepository { | ||
interface AssignmentRepository { | ||
|
||
suspend fun getWorkspaceTaskAll(workspaceId: String): Flow<Result<ImmutableList<TaskModel>>> | ||
suspend fun getWorkspaceTaskAll(workspaceId: String): Flow<Result<ImmutableList<AssignmentModel>>> | ||
|
||
suspend fun getGoogleTaskAll(): Flow<Result<ImmutableList<TaskModel>>> | ||
suspend fun getGoogleTaskAll(): Flow<Result<ImmutableList<AssignmentModel>>> | ||
|
||
suspend fun createTask(workspaceId: String, title: String, description: String, dueDate: LocalDateTime): Flow<Result<Boolean>> | ||
} |
18 changes: 18 additions & 0 deletions
18
data/assignment/src/main/java/com/seugi/data/assignment/di/RepositoryModule.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.seugi.data.assignment.di | ||
|
||
import com.seugi.data.assignment.AssignmentRepository | ||
import com.seugi.data.assignment.repository.AssignmentRepositoryImpl | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
interface RepositoryModule { | ||
|
||
@Singleton | ||
@Binds | ||
fun bindsAssignmentRepository(taskRepositoryImpl: AssignmentRepositoryImpl): AssignmentRepository | ||
} |
37 changes: 37 additions & 0 deletions
37
data/assignment/src/main/java/com/seugi/data/assignment/mapper/AssignmentMapper.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.seugi.data.assignment.mapper | ||
|
||
import com.seugi.data.assignment.model.AssignmentModel | ||
import com.seugi.data.assignment.model.AssignmentType | ||
import com.seugi.network.assignment.response.AssignmentGoogleResponse | ||
import com.seugi.network.assignment.response.AssignmentResponse | ||
import kotlinx.datetime.toKotlinLocalDateTime | ||
|
||
internal fun AssignmentResponse.toModel() = AssignmentModel( | ||
id = id, | ||
workspaceId = workspaceId, | ||
title = title, | ||
description = description, | ||
dueDate = dueDate?.toKotlinLocalDateTime(), | ||
type = AssignmentType.WORKSPACE, | ||
link = null, | ||
) | ||
|
||
internal fun AssignmentGoogleResponse.toModel() = AssignmentModel( | ||
id = id, | ||
workspaceId = null, | ||
title = title, | ||
description = description, | ||
dueDate = dueDate?.toKotlinLocalDateTime(), | ||
type = AssignmentType.GOOGLE, | ||
link = link, | ||
) | ||
|
||
@JvmName("ListTaskResponseToModels") | ||
internal fun List<AssignmentResponse>.toModels() = this.map { | ||
it.toModel() | ||
} | ||
|
||
@JvmName("ListTaskGoogleResponseToModels") | ||
internal fun List<AssignmentGoogleResponse>.toModels() = this.map { | ||
it.toModel() | ||
} |
6 changes: 3 additions & 3 deletions
6
...va/com/seugi/data/task/model/TaskModel.kt → .../data/assignment/model/AssignmentModel.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
6 changes: 6 additions & 0 deletions
6
data/assignment/src/main/java/com/seugi/data/assignment/model/AssignmentType.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.seugi.data.assignment.model | ||
|
||
enum class AssignmentType { | ||
GOOGLE, | ||
WORKSPACE, | ||
} |
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
18 changes: 0 additions & 18 deletions
18
data/task/src/main/java/com/seugi/data/task/di/RepositoryModule.kt
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
data/task/src/main/java/com/seugi/data/task/mapper/TaskMapper.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
data/task/src/main/java/com/seugi/data/task/model/TaskType.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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
16 changes: 16 additions & 0 deletions
16
feature-main/assignment/src/main/java/com/seugi/assignment/model/AssignmentUiState.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.seugi.assignment.model | ||
|
||
import com.seugi.data.assignment.model.AssignmentModel | ||
import kotlinx.collections.immutable.ImmutableList | ||
|
||
data class AssignmentUiState( | ||
val classroomTaskState: CommonUiState<ImmutableList<AssignmentModel>> = CommonUiState.Loading, | ||
val workspaceTaskState: CommonUiState<ImmutableList<AssignmentModel>> = CommonUiState.Loading, | ||
) | ||
|
||
sealed interface CommonUiState<out T> { | ||
data class Success<out T>(val data: T) : CommonUiState<T> | ||
data object Loading : CommonUiState<Nothing> | ||
data object Error : CommonUiState<Nothing> | ||
data object NotFound : CommonUiState<Nothing> | ||
} |
23 changes: 23 additions & 0 deletions
23
...ure-main/assignment/src/main/java/com/seugi/assignment/navigation/AssignmentNavigation.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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.seugi.assignment.navigation | ||
|
||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.compose.composable | ||
import com.seugi.assignment.AssignmentScreen | ||
import com.seugi.data.core.model.ProfileModel | ||
|
||
const val ASSIGNMENT_ROUTE = "task" | ||
|
||
fun NavController.navigateToAssignment(navOptions: NavOptions? = null) = this.navigate(ASSIGNMENT_ROUTE, navOptions) | ||
|
||
fun NavGraphBuilder.assignmentScreen(popBackStack: () -> Unit, workspaceId: String, profile: ProfileModel, navigateToTaskCreate: () -> Unit) { | ||
composable(ASSIGNMENT_ROUTE) { | ||
AssignmentScreen( | ||
popBackStack = popBackStack, | ||
workspaceId = workspaceId, | ||
profile = profile, | ||
navigateToTaskCreate = navigateToTaskCreate, | ||
) | ||
} | ||
} |
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.