Skip to content

Commit

Permalink
체크리스트 생성 api 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
leesa-l committed Dec 13, 2023
1 parent 6413699 commit 308aecf
Show file tree
Hide file tree
Showing 9 changed files with 284 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package com.dkin.chevit.data.di

import com.dkin.chevit.data.repository.AuthRepositoryImpl
import com.dkin.chevit.data.repository.NotificationRepositoryImpl
import com.dkin.chevit.data.repository.PlanRepositoryImpl
import com.dkin.chevit.data.repository.ServiceRepositoryImpl
import com.dkin.chevit.domain.repository.AuthRepository
import com.dkin.chevit.domain.repository.NotificationRepository
import com.dkin.chevit.domain.repository.PlanRepository
import com.dkin.chevit.domain.repository.ServiceRepository
import dagger.Binds
import dagger.Module
Expand All @@ -28,4 +30,9 @@ internal abstract class RepositoryModule {
abstract fun bindServiceRepository(
impl: ServiceRepositoryImpl
): ServiceRepository

@Binds
abstract fun bindPlanRepository(
impl: PlanRepositoryImpl
): PlanRepository
}
7 changes: 7 additions & 0 deletions data/src/main/java/com/dkin/chevit/data/di/RetrofitModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.dkin.chevit.data.di

import com.dkin.chevit.data.remote.AuthAPI
import com.dkin.chevit.data.remote.NotificationAPI
import com.dkin.chevit.data.remote.PlanAPI
import com.dkin.chevit.data.remote.ServiceAPI
import dagger.Module
import dagger.Provides
Expand Down Expand Up @@ -30,4 +31,10 @@ internal object RetrofitModule {
fun provideServiceAPI(
retrofit: Retrofit
): ServiceAPI = retrofit.create(ServiceAPI::class.java)

@Provides
@Singleton
fun providePlanAPI(
retrofit: Retrofit
): PlanAPI = retrofit.create(PlanAPI::class.java)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,214 @@
package com.dkin.chevit.data.di.usecase

import com.dkin.chevit.domain.base.CoroutineDispatcherProvider
import com.dkin.chevit.domain.repository.AuthRepository
import com.dkin.chevit.domain.repository.PlanRepository
import com.dkin.chevit.domain.usecase.auth.GetUserStateUseCase
import com.dkin.chevit.domain.usecase.plan.CopyTemplateUseCase
import com.dkin.chevit.domain.usecase.plan.DeleteCategoryUseCase
import com.dkin.chevit.domain.usecase.plan.DeleteCheckItemUseCase
import com.dkin.chevit.domain.usecase.plan.DeletePlanUseCase
import com.dkin.chevit.domain.usecase.plan.GetCategoryUseCase
import com.dkin.chevit.domain.usecase.plan.GetMyPlanListUseCase
import com.dkin.chevit.domain.usecase.plan.GetNewsUseCase
import com.dkin.chevit.domain.usecase.plan.GetPlanUseCase
import com.dkin.chevit.domain.usecase.plan.GetTravelKindsListUseCase
import com.dkin.chevit.domain.usecase.plan.GetTravelWithListUseCase
import com.dkin.chevit.domain.usecase.plan.GetWeatherUseCase
import com.dkin.chevit.domain.usecase.plan.PostNewCategoryUseCase
import com.dkin.chevit.domain.usecase.plan.PostNewCheckItemUseCase
import com.dkin.chevit.domain.usecase.plan.PostNewScheduleUseCase
import com.dkin.chevit.domain.usecase.plan.PostNewTemplateUseCase
import com.dkin.chevit.domain.usecase.plan.SearchCountryListUseCase
import com.dkin.chevit.domain.usecase.plan.UpdateCategoryUseCase
import com.dkin.chevit.domain.usecase.plan.UpdateCheckItemCheckedUseCase
import com.dkin.chevit.domain.usecase.plan.UpdateCheckItemUseCase
import com.dkin.chevit.domain.usecase.plan.UpdateTemplateUseCase
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ViewModelComponent

@Module
@InstallIn(ViewModelComponent::class)
internal object PlanUseCaseModule {
@Provides
fun provideCopyTemplateUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = CopyTemplateUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideDeleteCategoryUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = DeleteCategoryUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideDeleteCheckItemUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = DeleteCheckItemUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideDeletePlanUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = DeletePlanUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideGetCategoryUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = GetCategoryUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideGetMyPlanListUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = GetMyPlanListUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideGetNewsUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = GetNewsUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideGetPlanUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = GetPlanUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideGetTravelKindsListUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = GetTravelKindsListUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideGetTravelWithListUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = GetTravelWithListUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideGetWeatherUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = GetWeatherUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun providePostNewCategoryUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = PostNewCategoryUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun providePostNewCheckItemUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = PostNewCheckItemUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun providePostNewScheduleUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = PostNewScheduleUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun providePostNewTemplateUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = PostNewTemplateUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideSearchCountryListUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = SearchCountryListUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideUpdateCategoryUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = UpdateCategoryUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideUpdateCheckItemCheckedUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = UpdateCheckItemCheckedUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideUpdateCheckItemUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = UpdateCheckItemUseCase(
coroutineDispatcherProvider,
planRepository,
)

@Provides
fun provideUpdateTemplateUseCase(
coroutineDispatcherProvider: CoroutineDispatcherProvider,
planRepository: PlanRepository,
) = UpdateTemplateUseCase(
coroutineDispatcherProvider,
planRepository,
)
}
3 changes: 2 additions & 1 deletion data/src/main/java/com/dkin/chevit/data/remote/PlanAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

/**
* 체크리스트 관련 API
Expand All @@ -28,7 +29,7 @@ internal interface PlanAPI {
* 여행 국가 검색
*/
@GET("searchCountry")
suspend fun searchCountryList(query: String): List<LocaleResponse>
suspend fun searchCountryList(@Query("q") query: String): List<LocaleResponse>

/**
* 여행 동반자 목록
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class PostNewScheduleUseCase(
val scheduleEndTime: Long,
val travelWith: List<String>,
val travelKind: List<String>,
val refPlanId: String
val refPlanId: String? = ""
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.dkin.chevit.presentation.step.model.TravelWith
import java.time.LocalDate

sealed interface StepIntent : ViewIntent {
data class SearchCountry(val keyword: String) : StepIntent
}

@Stable
Expand Down
Loading

0 comments on commit 308aecf

Please sign in to comment.