-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat/IPLC-24] 개인정보 수정 뷰 api 연결 #198
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
Merged
The head ref may contain hidden characters: "feat/IPLC-24-\uAC1C\uC778\uC815\uBCF4-\uC218\uC815-\uBDF0-API-\uC5F0\uACB0"
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
99efc3a
[feat] 개인정보 수정 api 연결
jyvnee 4df5387
[feat] url 수정
jyvnee 8124f0f
[feat] 하단 패딩 수정
jyvnee 55e5d22
[feat] 텍스트필드 커서 위치 수정
jyvnee f05d936
Merge branch 'develop' into feat/IPLC-24-개인정보-수정-뷰-API-연결
jyvnee 892a594
[feat] 사용자 프로필 uri 변경
jyvnee 1e707a3
[feat] 사용자 프로필 업데이트 수정
jyvnee b8cc2e9
[feat] 마이페이지 메인 화면 새로고침 추가
jyvnee f203291
[feat] 날짜 매핑 위치 수정
jyvnee 6410e69
Merge branch 'develop' into feat/IPLC-24-개인정보-수정-뷰-API-연결
jyvnee 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
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/sopt/certi/data/mapper/todomain/image/PresignedDtoMapper.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,9 @@ | ||
| package org.sopt.certi.data.mapper.todomain.image | ||
|
|
||
| import org.sopt.certi.data.remote.dto.response.PresignedResponseDto | ||
| import org.sopt.certi.domain.model.image.PresignedData | ||
|
|
||
| fun PresignedResponseDto.toDomain(): PresignedData = PresignedData( | ||
| presignedUrl = preSignedURL, | ||
| publicUrl = publicURL | ||
| ) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/sopt/certi/data/mapper/todomain/user/PersonalInfoDtoMapper.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,14 @@ | ||
| package org.sopt.certi.data.mapper.todomain.user | ||
|
|
||
| import org.sopt.certi.core.util.toDateData | ||
| import org.sopt.certi.data.remote.dto.response.GetPersonalInfoResponseDto | ||
| import org.sopt.certi.domain.model.DateData | ||
| import org.sopt.certi.domain.model.user.PersonalInfo | ||
|
|
||
| fun GetPersonalInfoResponseDto.toDomain(): PersonalInfo = PersonalInfo( | ||
| name = name, | ||
| nickname = nickName, | ||
| email = email, | ||
| birth = birthDate?.toDateData() ?: DateData(), | ||
| profileImageUrl = profileImageURL ?: "" | ||
| ) |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/org/sopt/certi/data/mapper/todto/user/PersonalInfoMapper.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,12 @@ | ||
| package org.sopt.certi.data.mapper.todto.user | ||
|
|
||
| import org.sopt.certi.data.remote.dto.request.PutPersonalInfoRequestDto | ||
| import org.sopt.certi.domain.model.user.PersonalInfo | ||
|
|
||
| fun PersonalInfo.toDto(): PutPersonalInfoRequestDto = PutPersonalInfoRequestDto( | ||
| name = name, | ||
| email = email, | ||
| nickName = nickname, | ||
| birthDate = if (!birth.isComplete) "" else "${birth.year}.${birth.month?.let { "%02d".format(it) }}.${birth.day?.let { "%02d".format(it) }}", | ||
| publicURL = profileImageUrl | ||
| ) |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/org/sopt/certi/data/remote/datasource/S3DataSource.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,7 @@ | ||
| package org.sopt.certi.data.remote.datasource | ||
|
|
||
| import android.net.Uri | ||
|
|
||
| interface S3DataSource { | ||
| suspend fun uploadImageToS3(presignedUrl: String, imageUri: Uri) | ||
| } |
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
29 changes: 29 additions & 0 deletions
29
app/src/main/java/org/sopt/certi/data/remote/datasourceimpl/S3DataSourceImpl.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,29 @@ | ||
| package org.sopt.certi.data.remote.datasourceimpl | ||
|
|
||
| import android.content.Context | ||
| import android.net.Uri | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import okhttp3.MediaType.Companion.toMediaTypeOrNull | ||
| import okhttp3.RequestBody.Companion.toRequestBody | ||
| import org.sopt.certi.data.remote.datasource.S3DataSource | ||
| import org.sopt.certi.data.remote.service.S3Service | ||
| import javax.inject.Inject | ||
|
|
||
| class S3DataSourceImpl @Inject constructor( | ||
| private val s3Service: S3Service, | ||
| @ApplicationContext private val context: Context | ||
| ) : S3DataSource { | ||
| override suspend fun uploadImageToS3(presignedUrl: String, imageUri: Uri) { | ||
| val inputStream = context.contentResolver.openInputStream(imageUri) | ||
| val byteArray = inputStream?.readBytes() ?: throw IllegalStateException("이미지를 읽을 수 없습니다.") | ||
| inputStream.close() | ||
|
|
||
| val requestBody = byteArray.toRequestBody("image/*".toMediaTypeOrNull()) | ||
|
|
||
| val response = s3Service.uploadImage(presignedUrl, requestBody) | ||
|
|
||
| if (!response.isSuccessful) { | ||
| throw Exception("S3 업로드 실패: ${response.code()}") | ||
| } | ||
| } | ||
| } |
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
18 changes: 18 additions & 0 deletions
18
app/src/main/java/org/sopt/certi/data/remote/dto/request/PutPersonalInfoRequestDto.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,18 @@ | ||
| package org.sopt.certi.data.remote.dto.request | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class PutPersonalInfoRequestDto( | ||
| @SerialName("name") | ||
| val name: String, | ||
| @SerialName("email") | ||
| val email: String, | ||
| @SerialName("nickName") | ||
| val nickName: String, | ||
| @SerialName("birthDate") | ||
| val birthDate: String, | ||
| @SerialName("publicURL") | ||
| val publicURL: String | ||
| ) |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/org/sopt/certi/data/remote/dto/response/GetPersonalInfoResponseDto.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,18 @@ | ||
| package org.sopt.certi.data.remote.dto.response | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class GetPersonalInfoResponseDto( | ||
| @SerialName("nickName") | ||
| val nickName: String, | ||
| @SerialName("name") | ||
| val name: String, | ||
| @SerialName("email") | ||
| val email: String, | ||
| @SerialName("birthDate") | ||
| val birthDate: String?, | ||
| @SerialName("profileImageURL") | ||
| val profileImageURL: String? | ||
| ) |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/org/sopt/certi/data/remote/dto/response/PresignedResponseDto.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,12 @@ | ||
| package org.sopt.certi.data.remote.dto.response | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class PresignedResponseDto( | ||
| @SerialName("preSignedURL") | ||
| val preSignedURL: String, | ||
| @SerialName("publicURL") | ||
| val publicURL: String | ||
| ) |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/org/sopt/certi/data/remote/service/S3Service.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,15 @@ | ||
| package org.sopt.certi.data.remote.service | ||
|
|
||
| import okhttp3.RequestBody | ||
| import retrofit2.Response | ||
| import retrofit2.http.Body | ||
| import retrofit2.http.PUT | ||
| import retrofit2.http.Url | ||
|
|
||
| interface S3Service { | ||
| @PUT | ||
| suspend fun uploadImage( | ||
| @Url presignedUrl: String, | ||
| @Body file: RequestBody | ||
| ): Response<Unit> | ||
| } | ||
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/certi/data/repositoryimpl/S3RepositoryImpl.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.certi.data.repositoryimpl | ||
|
|
||
| import androidx.core.net.toUri | ||
| import org.sopt.certi.data.remote.datasource.S3DataSource | ||
| import org.sopt.certi.domain.repository.S3Repository | ||
| import javax.inject.Inject | ||
|
|
||
| class S3RepositoryImpl @Inject constructor( | ||
| private val s3DataSource: S3DataSource | ||
| ) : S3Repository { | ||
| override suspend fun uploadImage(presignedUrl: String, imageUri: String): Result<Unit> { | ||
| return runCatching { | ||
| s3DataSource.uploadImageToS3(presignedUrl, imageUri.toUri()) | ||
| } | ||
| } | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[3] 왜 이름을 S3로 하셨나요 변수나 함수이름에 숫자 넣기 귀찮을텐디