generated from AT-SOPT-ANDROID/at-sopt-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Week4 #8
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
Open
seungjunGong
wants to merge
10
commits into
develop
Choose a base branch
from
week4
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Week4 #8
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a54d710
refactor: navigation type safety ์ ์ฉ #6
seungjunGong f645e4b
feat: ํ์๊ฐ์
๋ทฐ ์ถ๊ฐ nickname #7
seungjunGong 835d353
chore: retrofit ์์กด์ฑ ์ถ๊ฐ #7
seungjunGong 06c4fb9
feat: dto, service ์ถ๊ฐ #7
seungjunGong 8328629
feat: regex nickname ์ถ๊ฐ #7
seungjunGong bd1279e
feat: ํ์๊ฐ์
๊ตฌํ #7
seungjunGong 5a9f65f
feat: login api ์ฐ๋ #7
seungjunGong 9143b5c
refactor: signup ์๋ต ์ฒ๋ฆฌ ๋ถ๋ฆฌ #7
seungjunGong 0a853bb
feat: My ๋ด ๋๋ค์ ์กฐํ ๊ตฌํ #7
seungjunGong da2fbd5
feat: My ๋ทฐ ํ๋ฉด UI ๊ตฌ์ฑ #7
seungjunGong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
app/src/main/java/org/sopt/at/data/model/BaseResponseDto.kt
This file contains hidden or 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 org.sopt.at.data.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class BaseResponseDto<T>( | ||
| @SerialName("success") | ||
| val success: Boolean, | ||
| @SerialName("code") | ||
| val code: String, | ||
| @SerialName("message") | ||
| val message: String, | ||
| @SerialName("data") | ||
| val data: T?, | ||
| ) | ||
This file contains hidden or 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 org.sopt.at.data.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class SignInRequestDto( | ||
| @SerialName("loginId") | ||
| val loginId: String, | ||
| @SerialName("password") | ||
| val password: String, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class SignInResponseDto( | ||
| @SerialName("userId") | ||
| val userId: Int, | ||
| ) | ||
seungjunGong marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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 org.sopt.at.data.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class SignUpRequestDto( | ||
| @SerialName("loginId") | ||
| val loginId: String, | ||
| @SerialName("password") | ||
| val password: String, | ||
| @SerialName("nickname") | ||
| val nickname: String, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class SignUpResponseDto( | ||
| @SerialName("userId") | ||
| val userId: Int, | ||
| @SerialName("nickname") | ||
| val nickname: String, | ||
| ) | ||
seungjunGong marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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 org.sopt.at.data.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class UserNickNameResponseDto( | ||
| @SerialName("nickname") | ||
| val nickname: String, | ||
| ) |
This file contains hidden or 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,40 @@ | ||
| package org.sopt.at.data.service | ||
|
|
||
| import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory | ||
| import kotlinx.serialization.json.Json | ||
| import okhttp3.MediaType.Companion.toMediaType | ||
| import okhttp3.OkHttpClient | ||
| import okhttp3.logging.HttpLoggingInterceptor | ||
| import org.sopt.at.BuildConfig | ||
| import retrofit2.Retrofit | ||
|
|
||
| object ApiFactory { | ||
| private const val BASE_URL: String = BuildConfig.BASE_URL | ||
|
|
||
| private val loggingInterceptor = HttpLoggingInterceptor().apply { | ||
| level = HttpLoggingInterceptor.Level.BODY | ||
| } | ||
|
|
||
| private val client = OkHttpClient.Builder() | ||
| .addInterceptor(loggingInterceptor) | ||
| .build() | ||
|
|
||
| val retrofit: Retrofit by lazy { | ||
| Retrofit.Builder() | ||
| .baseUrl(BASE_URL) | ||
| .client(client) | ||
| .addConverterFactory(Json.asConverterFactory("application/json".toMediaType())) | ||
| .build() | ||
| } | ||
|
|
||
| inline fun <reified T> create(): T = retrofit.create(T::class.java) | ||
| } | ||
|
|
||
| object ServicePool { | ||
| val authService: AuthService by lazy { | ||
| ApiFactory.create<AuthService>() | ||
| } | ||
| val userService: UserService by lazy { | ||
| ApiFactory.create<UserService>() | ||
| } | ||
seungjunGong marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or 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,24 @@ | ||
| package org.sopt.at.data.service | ||
|
|
||
| import org.sopt.at.data.model.BaseResponseDto | ||
| import org.sopt.at.data.model.SignInRequestDto | ||
| import org.sopt.at.data.model.SignInResponseDto | ||
| import org.sopt.at.data.model.SignUpRequestDto | ||
| import org.sopt.at.data.model.SignUpResponseDto | ||
| import retrofit2.Call | ||
| import retrofit2.http.Body | ||
| import retrofit2.http.GET | ||
| import retrofit2.http.Header | ||
| import retrofit2.http.POST | ||
|
|
||
| interface AuthService { | ||
| @POST("/api/v1/auth/signup") | ||
| fun signup( | ||
| @Body request: SignUpRequestDto | ||
seungjunGong marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ): Call<BaseResponseDto<SignUpResponseDto>> | ||
|
|
||
| @POST("/api/v1/auth/signin") | ||
| fun signin( | ||
| @Body request: SignInRequestDto | ||
| ): Call<BaseResponseDto<SignInResponseDto>> | ||
| } | ||
This file contains hidden or 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 org.sopt.at.data.service | ||
|
|
||
| import org.sopt.at.data.model.BaseResponseDto | ||
| import org.sopt.at.data.model.UserNickNameResponseDto | ||
| import retrofit2.Call | ||
| import retrofit2.http.GET | ||
| import retrofit2.http.Header | ||
|
|
||
| interface UserService { | ||
| @GET("/api/v1/users/me") | ||
| fun getUserInfo( | ||
| @Header("userId") userId: Int | ||
| ): Call<BaseResponseDto<UserNickNameResponseDto>> | ||
| } |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.