Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT/#230] 여행 조회, 여행 수정, 여행 나가기 뷰 / 서버통신 구현 #241

Merged
merged 23 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
728690a
[FEAT/#230] 모듈 수정
crownjoe Mar 5, 2024
c794a44
[FEAT/#230] datasource 구현
crownjoe Mar 5, 2024
cf00a9b
[FEAT/#230] repository 구현
crownjoe Mar 5, 2024
1062ce9
[FEAT/#230] Dto, Model 구현
crownjoe Mar 5, 2024
f35e81d
[FEAT/#230] 여행 수정 초기 뷰, 여행 수정 뷰 ui 수정
crownjoe Mar 5, 2024
f237268
[FEAT/#230] 충돌 수정
crownjoe Mar 6, 2024
83962dc
[FEAT/#230] 머지 후 충돌 수정
crownjoe Mar 6, 2024
aa464bd
[FEAT/#230] 여행 디테일 조회 뷰 Model 구현
crownjoe Mar 7, 2024
4de23c3
[FEAT/#230] 여행 디테일 조회 뷰 DataSource 구
crownjoe Mar 7, 2024
1ae947b
[FEAT/#230] 여행 디테일 조회 뷰 Repository 구현
crownjoe Mar 7, 2024
ce5548a
[FEAT/#230] 여행 디테일 조회 뷰 서버통신 구현
crownjoe Mar 7, 2024
32a5776
[FEAT/#230] 여행 디테일 조회 뷰 서버통신 구현
crownjoe Mar 7, 2024
e40579a
[FEAT/#230] 여행 디테일 조회 뷰 서버통신 구현
crownjoe Mar 7, 2024
1adaa2f
[FEAT/#230] 여행 수정 뷰 서버통신 구현
crownjoe Mar 7, 2024
255a142
[FEAT/#230] 컨플릭 해결
crownjoe Mar 7, 2024
c7ae49c
[FEAT/#230] 여행 수정 뷰 서버통신 구현
crownjoe Mar 9, 2024
257cd3f
[FEAT/#230] 여행 수정 뷰 서버통신 로직 구현
crownjoe Mar 9, 2024
15fe072
[FEAT/#230] 여행 수정 뷰 로직 수정
crownjoe Mar 9, 2024
f0b6e81
[FEAT/#230] 여행 나가기 뷰 서버통신 구현
crownjoe Mar 9, 2024
e8e0314
[FEAT/#230] 컨플릭 해결
crownjoe Mar 9, 2024
b24abe3
[FEAT/#230] 오류 수정
crownjoe Mar 9, 2024
460c2b9
[CHORE/#230] 코리 반영 수정
crownjoe Mar 10, 2024
08862e3
[CHORE/#230] 컨플릭 해결
crownjoe Mar 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@
android:screenOrientation="portrait" />

<activity
android:name="com.going.presentation.todo.editinfo.EditTripInfoActivity"
android:name="com.going.presentation.todo.edittrip.info.EditTripInfoActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name="com.going.presentation.todo.edittrip.edit.EditTripActivity"
android:exported="false"
android:screenOrientation="portrait" />

Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/going/doorip/di/DataSourceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.going.doorip.di

import com.going.data.datasource.AuthDataSource
import com.going.data.datasource.DashBoardDataSource
import com.going.data.datasource.EditTripDataSource
import com.going.data.datasource.EnterTripDataSource
import com.going.data.datasource.ProfileDataSource
import com.going.data.datasource.SettingDataSource
Expand All @@ -10,6 +11,7 @@ import com.going.data.datasource.TodoDataSource
import com.going.data.datasource.TokenReissueDataSource
import com.going.data.datasourceImpl.AuthDataSourceImpl
import com.going.data.datasourceImpl.DashBoardDataSourceImpl
import com.going.data.datasourceImpl.EditTripDataSourceImpl
import com.going.data.datasourceImpl.EnterTripDataSourceImpl
import com.going.data.datasourceImpl.ProfileDataSourceImpl
import com.going.data.datasourceImpl.SettingDataSourceImpl
Expand Down Expand Up @@ -65,4 +67,9 @@ object DataSourceModule {
@Singleton
fun provideTokenReissueDataSource(tokenReissueDataSourceImpl: TokenReissueDataSourceImpl): TokenReissueDataSource =
tokenReissueDataSourceImpl

@Provides
@Singleton
fun provideEditTripDataSource(editTripDataSourceImpl: EditTripDataSourceImpl): EditTripDataSource =
editTripDataSourceImpl
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/going/doorip/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.going.doorip.di

import com.going.data.repositoryImpl.AuthRepositoryImpl
import com.going.data.repositoryImpl.DashBoardRepositoryImpl
import com.going.data.repositoryImpl.EditTripRepositoryImpl
import com.going.data.repositoryImpl.EnterTripRepositoryImpl
import com.going.data.repositoryImpl.ProfileRepositoryImpl
import com.going.data.repositoryImpl.SettingRepositoryImpl
Expand All @@ -11,6 +12,7 @@ import com.going.data.repositoryImpl.TokenReissueRepositoryImpl
import com.going.data.repositoryImpl.TokenRepositoryImpl
import com.going.domain.repository.AuthRepository
import com.going.domain.repository.DashBoardRepository
import com.going.domain.repository.EditTripRepository
import com.going.domain.repository.EnterTripRepository
import com.going.domain.repository.ProfileRepository
import com.going.domain.repository.SettingRepository
Expand Down Expand Up @@ -72,4 +74,9 @@ object RepositoryModule {
@Singleton
fun provideTokenReissueRepository(tokenReissueRepositoryImpl: TokenReissueRepositoryImpl): TokenReissueRepository =
tokenReissueRepositoryImpl

@Provides
@Singleton
fun provideEditTripRepository(editTripRepositoryImpl: EditTripRepositoryImpl): EditTripRepository =
editTripRepositoryImpl
}
6 changes: 6 additions & 0 deletions app/src/main/java/com/going/doorip/di/ServiceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.going.doorip.di

import com.going.data.service.AuthService
import com.going.data.service.DashBoardService
import com.going.data.service.EditTripService
import com.going.data.service.EnterTripService
import com.going.data.service.ProfileService
import com.going.data.service.SettingService
Expand Down Expand Up @@ -60,4 +61,9 @@ object ServiceModule {
@Singleton
fun provideTokenReissueService(@REISSUE retrofit: Retrofit): TokenReissueService =
retrofit.create(TokenReissueService::class.java)

@Provides
@Singleton
fun provideEditTripService(@JWT retrofit: Retrofit): EditTripService =
retrofit.create(EditTripService::class.java)
}
22 changes: 22 additions & 0 deletions data/src/main/java/com/going/data/datasource/EditTripDataSource.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.going.data.datasource

import com.going.data.dto.BaseResponse
import com.going.data.dto.NonDataBaseResponse
import com.going.data.dto.request.EditTripInfoRequestDto
import com.going.data.dto.response.TripInfoResponseDto

interface EditTripDataSource {
suspend fun getTripInfo(
tripId: Long
): BaseResponse<TripInfoResponseDto>

suspend fun patchEditTripInfo(
tripId: Long,
request: EditTripInfoRequestDto
): NonDataBaseResponse

suspend fun patchQuitTrip(
tripId: Long
): NonDataBaseResponse

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.going.data.datasourceImpl

import com.going.data.datasource.EditTripDataSource
import com.going.data.dto.BaseResponse
import com.going.data.dto.NonDataBaseResponse
import com.going.data.dto.request.EditTripInfoRequestDto
import com.going.data.dto.response.TripInfoResponseDto
import com.going.data.service.EditTripService
import javax.inject.Inject

class EditTripDataSourceImpl @Inject constructor(
private val editTripService: EditTripService,
) : EditTripDataSource {

override suspend fun getTripInfo(
tripId: Long
): BaseResponse<TripInfoResponseDto> =
editTripService.getTripInfo(tripId)

override suspend fun patchEditTripInfo(
tripId: Long,
request: EditTripInfoRequestDto
): NonDataBaseResponse = editTripService.patchEditTripInfo(
tripId, request
)

override suspend fun patchQuitTrip(
tripId: Long
): NonDataBaseResponse = editTripService.patchQuitTrip(
tripId
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.going.data.dto.request

import com.going.domain.entity.request.EditTripRequestModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
class EditTripInfoRequestDto(
@SerialName("title")
val title: String,
@SerialName("startDate")
val startDate: String,
@SerialName("endDate")
val endDate: String,
)

fun EditTripRequestModel.toEditTrioRequestDto(): EditTripInfoRequestDto =
EditTripInfoRequestDto(title, startDate, endDate)

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.going.data.dto.response

import com.going.domain.entity.response.TripInfoModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class TripInfoResponseDto(
@SerialName("tripId")
val tripId: Long,
@SerialName("title")
val title: String,
@SerialName("startDate")
val startDate: String,
@SerialName("endDate")
val endDate: String,
) {
fun toTripInfoModel(): TripInfoModel
= TripInfoModel(tripId, title, startDate, endDate)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.going.data.repositoryImpl

import com.going.data.datasource.EditTripDataSource
import com.going.data.dto.request.toEditTrioRequestDto
import com.going.domain.entity.request.EditTripRequestModel
import com.going.domain.entity.response.TripInfoModel
import com.going.domain.repository.EditTripRepository
import javax.inject.Inject

class EditTripRepositoryImpl @Inject constructor(
private val editTripDataSource: EditTripDataSource,
) : EditTripRepository {
override suspend fun getTripInfo(
tripId: Long
): Result<TripInfoModel> =
runCatching {
editTripDataSource.getTripInfo(tripId).data.toTripInfoModel()
}

override suspend fun patchEditTripInfo(
tripId: Long, request: EditTripRequestModel
): Result<Unit> =
runCatching {
editTripDataSource.patchEditTripInfo(
tripId, request.toEditTrioRequestDto()
)
}

override suspend fun patchQuitTrip(
tripId: Long
): Result<Unit> =
runCatching {
editTripDataSource.patchQuitTrip(
tripId
)
}
}
30 changes: 30 additions & 0 deletions data/src/main/java/com/going/data/service/EditTripService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.going.data.service

import com.going.data.dto.BaseResponse
import com.going.data.dto.NonDataBaseResponse
import com.going.data.dto.request.EditTripInfoRequestDto
import com.going.data.dto.response.TripInfoResponseDto
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.PATCH
import retrofit2.http.Path

interface EditTripService {

@GET("api/trips/{tripId}")
suspend fun getTripInfo(
@Path("tripId") tripId: Long
): BaseResponse<TripInfoResponseDto>

@PATCH("api/trips/{tripId}")
suspend fun patchEditTripInfo(
@Path("tripId") tripId: Long,
@Body request: EditTripInfoRequestDto,
): NonDataBaseResponse

@PATCH("api/trips/{tripId}/leave")
suspend fun patchQuitTrip(
@Path("tripId") tripId: Long,
): NonDataBaseResponse

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.going.domain.entity.request

data class EditTripRequestModel(
val title: String,
val startDate: String,
val endDate: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.going.domain.entity.request

data class TripInfoRequestModel(
val tripId: Long,
val title: String,
val startDate : String,
val endDate : String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.going.domain.entity.response

data class QuitTripModel(
val tripId: Long,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.going.domain.entity.response

data class TripInfoModel(
val tripId: Long,
val title: String,
val startDate: String,
val endDate: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.going.domain.repository

import com.going.domain.entity.request.EditTripRequestModel
import com.going.domain.entity.response.TripInfoModel

interface EditTripRepository {

suspend fun getTripInfo(
tripId: Long
): Result<TripInfoModel>
suspend fun patchEditTripInfo(
tripId: Long,
request: EditTripRequestModel
): Result<Unit>
suspend fun patchQuitTrip(
tripId: Long
): Result<Unit>
}
Comment on lines +6 to +18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

한번에 서버통신 3개 처리해버리는 그녀... 실력 말안됨

Copy link
Member

@leeeyubin leeeyubin Mar 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

속도 미쳐따,,,

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class InviteFinishActivity :
startDate: String,
endDate: String,
day: Int,
): Intent = Intent(context, EnterTripActivity::class.java).apply {
): Intent = Intent(context, InviteFinishActivity::class.java).apply {
putExtra(TRIP_ID, tripId)
putExtra(TITLE, title)
putExtra(START, startDate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.activity.OnBackPressedCallback
import androidx.activity.viewModels
import androidx.core.view.isVisible
import androidx.core.widget.doAfterTextChanged
Expand All @@ -15,7 +14,6 @@ import com.going.presentation.R
import com.going.presentation.databinding.ActivityTodoChangeBinding
import com.going.presentation.todo.create.TodoCreateActivity.Companion.MAX_MEMO_LEN
import com.going.presentation.todo.create.TodoCreateActivity.Companion.MAX_TODO_LEN
import com.going.presentation.todo.detail.TodoDetailActivity
import com.going.ui.base.BaseActivity
import com.going.ui.extension.setOnSingleClickListener
import com.going.ui.extension.toast
Expand Down
Loading
Loading