File tree Expand file tree Collapse file tree 6 files changed +34
-0
lines changed
data/src/main/java/com/threegap/bitnagil/data/routine
domain/src/main/java/com/threegap/bitnagil/domain/routine Expand file tree Collapse file tree 6 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 11package com.threegap.bitnagil.data.routine.datasource
22
3+ import com.threegap.bitnagil.data.routine.model.request.RoutineByDayDeletionRequestDto
34import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto
45import com.threegap.bitnagil.data.routine.model.response.RoutinesResponseDto
56
67interface RoutineRemoteDataSource {
78 suspend fun fetchWeeklyRoutines (startDate : String , endDate : String ): Result <RoutinesResponseDto >
89 suspend fun syncRoutineCompletion (routineCompletionRequestDto : RoutineCompletionRequestDto ): Result <Unit >
910 suspend fun deleteRoutine (routineId : String ): Result <Unit >
11+ suspend fun deleteRoutineByDay (routineByDayDeletionRequestDto : RoutineByDayDeletionRequestDto ): Result <Unit >
1012}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.threegap.bitnagil.data.routine.datasourceImpl
33import com.threegap.bitnagil.data.common.safeApiCall
44import com.threegap.bitnagil.data.common.safeUnitApiCall
55import com.threegap.bitnagil.data.routine.datasource.RoutineRemoteDataSource
6+ import com.threegap.bitnagil.data.routine.model.request.RoutineByDayDeletionRequestDto
67import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto
78import com.threegap.bitnagil.data.routine.model.response.RoutinesResponseDto
89import com.threegap.bitnagil.data.routine.service.RoutineService
@@ -25,4 +26,9 @@ class RoutineRemoteDataSourceImpl @Inject constructor(
2526 safeUnitApiCall {
2627 routineService.deleteRoutine(routineId)
2728 }
29+
30+ override suspend fun deleteRoutineByDay (routineByDayDeletionRequestDto : RoutineByDayDeletionRequestDto ): Result <Unit > =
31+ safeUnitApiCall {
32+ routineService.deleteRoutineByDay(routineByDayDeletionRequestDto)
33+ }
2834}
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ package com.threegap.bitnagil.data.routine.repositoryImpl
33import com.threegap.bitnagil.data.routine.datasource.RoutineRemoteDataSource
44import com.threegap.bitnagil.data.routine.mapper.toDomain
55import com.threegap.bitnagil.data.routine.mapper.toDto
6+ import com.threegap.bitnagil.data.routine.model.request.toDto
7+ import com.threegap.bitnagil.domain.routine.model.RoutineByDayDeletion
68import com.threegap.bitnagil.domain.routine.model.RoutineCompletion
79import com.threegap.bitnagil.domain.routine.model.Routines
810import com.threegap.bitnagil.domain.routine.repository.RoutineRepository
@@ -20,4 +22,7 @@ class RoutineRepositoryImpl @Inject constructor(
2022
2123 override suspend fun deleteRoutine (routineId : String ): Result <Unit > =
2224 routineRemoteDataSource.deleteRoutine(routineId)
25+
26+ override suspend fun deleteRoutineByDay (routineByDayDeletion : RoutineByDayDeletion ): Result <Unit > =
27+ routineRemoteDataSource.deleteRoutineByDay(routineByDayDeletion.toDto())
2328}
Original file line number Diff line number Diff line change 11package com.threegap.bitnagil.data.routine.service
22
3+ import com.threegap.bitnagil.data.routine.model.request.RoutineByDayDeletionRequestDto
34import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto
45import com.threegap.bitnagil.data.routine.model.response.RoutinesResponseDto
56import com.threegap.bitnagil.network.model.BaseResponse
67import retrofit2.http.Body
78import retrofit2.http.DELETE
89import retrofit2.http.GET
10+ import retrofit2.http.HTTP
911import retrofit2.http.POST
1012import retrofit2.http.Path
1113import retrofit2.http.Query
@@ -26,4 +28,9 @@ interface RoutineService {
2628 suspend fun deleteRoutine (
2729 @Path(" routineId" ) routineId : String ,
2830 ): BaseResponse <Unit >
31+
32+ @HTTP(method = " DELETE" , path = " /api/v1/routines/day" , hasBody = true )
33+ suspend fun deleteRoutineByDay (
34+ @Body request : RoutineByDayDeletionRequestDto ,
35+ ): BaseResponse <Unit >
2936}
Original file line number Diff line number Diff line change 11package com.threegap.bitnagil.domain.routine.repository
22
3+ import com.threegap.bitnagil.domain.routine.model.RoutineByDayDeletion
34import com.threegap.bitnagil.domain.routine.model.RoutineCompletion
45import com.threegap.bitnagil.domain.routine.model.Routines
56
67interface RoutineRepository {
78 suspend fun fetchWeeklyRoutines (startDate : String , endDate : String ): Result <Routines >
89 suspend fun syncRoutineCompletion (routineCompletion : RoutineCompletion ): Result <Unit >
910 suspend fun deleteRoutine (routineId : String ): Result <Unit >
11+ suspend fun deleteRoutineByDay (routineByDayDeletion : RoutineByDayDeletion ): Result <Unit >
1012}
Original file line number Diff line number Diff line change 1+ package com.threegap.bitnagil.domain.routine.usecase
2+
3+ import com.threegap.bitnagil.domain.routine.model.RoutineByDayDeletion
4+ import com.threegap.bitnagil.domain.routine.repository.RoutineRepository
5+ import javax.inject.Inject
6+
7+ class DeleteRoutineByDayUseCase @Inject constructor(
8+ private val routineRepository : RoutineRepository ,
9+ ) {
10+ suspend operator fun invoke (routineByDayDeletion : RoutineByDayDeletion ) =
11+ routineRepository.deleteRoutineByDay(routineByDayDeletion)
12+ }
You can’t perform that action at this time.
0 commit comments