-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,183 additions
and
142 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
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
12 changes: 12 additions & 0 deletions
12
data/src/main/java/com/going/data/datasource/LoginDataSource.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,12 @@ | ||
package com.going.data.datasource | ||
|
||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.RequestLoginDto | ||
import com.going.data.dto.response.LoginResponseDto | ||
|
||
interface LoginDataSource { | ||
suspend fun postLogin( | ||
Authorization: String, | ||
platform: RequestLoginDto, | ||
): BaseResponse<LoginResponseDto> | ||
} |
18 changes: 18 additions & 0 deletions
18
data/src/main/java/com/going/data/datasourceImpl/LoginDataSourceImpl.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.going.data.datasourceImpl | ||
|
||
import com.going.data.datasource.LoginDataSource | ||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.RequestLoginDto | ||
import com.going.data.dto.response.LoginResponseDto | ||
import com.going.data.service.LoginService | ||
import javax.inject.Inject | ||
|
||
class LoginDataSourceImpl @Inject constructor( | ||
private val loginService: LoginService, | ||
) : LoginDataSource { | ||
override suspend fun postLogin( | ||
Authorization: String, | ||
platform: RequestLoginDto, | ||
): BaseResponse<LoginResponseDto> = | ||
loginService.postSignin(Authorization, platform) | ||
} |
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,14 @@ | ||
package com.going.data.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class BaseResponse<T>( | ||
@SerialName("status") | ||
val status: Int, | ||
@SerialName("message") | ||
val message: String, | ||
@SerialName("data") | ||
val data: T, | ||
) |
10 changes: 10 additions & 0 deletions
10
data/src/main/java/com/going/data/dto/request/RequestLoginDto.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,10 @@ | ||
package com.going.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RequestLoginDto( | ||
@SerialName("platform") | ||
val platform: String | ||
) |
37 changes: 37 additions & 0 deletions
37
data/src/main/java/com/going/data/dto/response/LoginResponseDto.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.going.data.dto.response | ||
|
||
import com.going.domain.entity.response.AuthTokenModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class LoginResponseDto( | ||
@SerialName("accessToken") | ||
val accessToken: String, | ||
@SerialName("refreshToken") | ||
val refreshToken: String, | ||
) { | ||
fun toAuthTokenModel() = | ||
AuthTokenModel(accessToken = accessToken, refreshToken = refreshToken) | ||
} | ||
|
||
// @Serializable | ||
// data class LoginResponseDto( | ||
// @SerialName("status") | ||
// val status: Int, | ||
// @SerialName("message") | ||
// val message: String, | ||
// @SerialName("data") | ||
// val data: Data, | ||
// ) { | ||
// @Serializable | ||
// data class Data( | ||
// @SerialName("accessToken") | ||
// val accessToken: String, | ||
// @SerialName("refreshToken") | ||
// val refreshToken: String, | ||
// ) | ||
// | ||
// fun toAuthTokenModel() = | ||
// AuthTokenModel(accessToken = data.accessToken, refreshToken = data.refreshToken) | ||
// } |
22 changes: 22 additions & 0 deletions
22
data/src/main/java/com/going/data/repositoryImpl/LoginRepositoryImpl.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,22 @@ | ||
package com.going.data.repositoryImpl | ||
|
||
import com.going.data.datasource.LoginDataSource | ||
import com.going.data.dto.request.RequestLoginDto | ||
import com.going.domain.entity.response.AuthTokenModel | ||
import com.going.domain.repository.LoginRepository | ||
import javax.inject.Inject | ||
|
||
class LoginRepositoryImpl @Inject constructor( | ||
private val loginDataSource: LoginDataSource, | ||
) : LoginRepository { | ||
override suspend fun postSignin( | ||
Authorization: String, | ||
platform: String, | ||
): Result<AuthTokenModel> = | ||
runCatching { | ||
loginDataSource.postLogin( | ||
Authorization, | ||
RequestLoginDto(platform), | ||
).data.toAuthTokenModel() | ||
} | ||
} |
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.going.data.service | ||
|
||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.RequestLoginDto | ||
import com.going.data.dto.response.LoginResponseDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.Header | ||
import retrofit2.http.POST | ||
|
||
interface LoginService { | ||
@POST("api/users/signin") | ||
suspend fun postSignin( | ||
@Header("Authorization") Authorization: String, | ||
@Body body: RequestLoginDto, | ||
): BaseResponse<LoginResponseDto> | ||
} |
15 changes: 15 additions & 0 deletions
15
domain/src/main/kotlin/com/going/domain/entity/TendencyResultMock.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,15 @@ | ||
package com.going.domain.entity | ||
|
||
data class TendencyResultMock( | ||
val tendencyTitle: String, | ||
val tendencySubTitle: String, | ||
val tags: List<String>, | ||
val tendencyBoxInfo: List<BoxInfo>, | ||
) { | ||
data class BoxInfo( | ||
val title: String, | ||
val first: String, | ||
val second: String, | ||
val third: String, | ||
) | ||
} |
1 change: 0 additions & 1 deletion
1
domain/src/main/kotlin/com/going/domain/entity/response/AuthTokenModel.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,7 +1,6 @@ | ||
package com.going.domain.entity.response | ||
|
||
data class AuthTokenModel( | ||
val isResigned: Boolean, | ||
val accessToken: String, | ||
val refreshToken: String, | ||
) |
7 changes: 7 additions & 0 deletions
7
domain/src/main/kotlin/com/going/domain/entity/response/CompletedListModel.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,7 @@ | ||
package com.going.domain.entity.response | ||
|
||
data class CompletedListModel( | ||
val title: String, | ||
val startDate: String, | ||
val endDate: String | ||
) |
2 changes: 1 addition & 1 deletion
2
...in/entity/response/TripCreateListModel.kt → ...omain/entity/response/OngoingListModel.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
10 changes: 10 additions & 0 deletions
10
domain/src/main/kotlin/com/going/domain/repository/LoginRepository.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,10 @@ | ||
package com.going.domain.repository | ||
|
||
import com.going.domain.entity.response.AuthTokenModel | ||
|
||
interface LoginRepository { | ||
suspend fun postSignin( | ||
Authorization: String, | ||
platform: String, | ||
): Result<AuthTokenModel> | ||
} |
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.