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

feature/management: 회원가입 수정사항 반영 #168

Merged
merged 9 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ core/designsystem/build/outputs/aar/
core/model/build/outputs/aar/
core/designsystem/build/tmp/kotlin-classes/debug/META-INF
core/designsystem/build/tmp
core/designsystem/build/kotlin/compileReleaseKotlin/
20 changes: 20 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.kusitms.connectdog",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 15,
"versionName": "1.0.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ import com.kusitms.connectdog.core.data.api.model.volunteer.NoticeDetailResponse
import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewDetailResponse
import com.kusitms.connectdog.core.data.api.model.volunteer.SocialVolunteerSignUpBody
import com.kusitms.connectdog.core.data.api.model.volunteer.UserInfoResponse
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Multipart
import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Path
import retrofit2.http.Query

Expand Down Expand Up @@ -67,7 +71,7 @@ internal interface ApiService {
suspend fun getReviewsHome(
@Query("page") page: Int,
@Query("size") size: Int
): List<ReviewResponseItem>
): List<ReviewDetailResponse>

/**
* 회원가입
Expand Down Expand Up @@ -237,6 +241,14 @@ internal interface ApiService {
@Query("size") size: Int?
): List<ReviewResponseItem>

@Multipart
@POST("/volunteers/posts/{postId}/reviews")
suspend fun postReview(
@Path("postId") postId: Long,
@Part("request") json: RequestBody,
@Part files: List<MultipartBody.Part>
)

/**
* fcm
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.kusitms.connectdog.core.data.api.model.volunteer

data class ReviewBody(
val content: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ package com.kusitms.connectdog.core.data.api.model.volunteer
data class SocialVolunteerSignUpBody(
val nickname: String,
val profileImageNum: Int,
val isOptionAgr: Boolean = true
val isOptionAgr: Boolean = true,
val phone: String,
val name: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fun ReviewDetailResponse.toData(): Review {
userName = volunteerNickname,
mainImage = mainImage,
contentImages = images,
date = dateRangeFormat(startDate, endDate),
date = if (startDate == endDate) startDate else dateRangeFormat(startDate, endDate),
location = "$departureLoc → $arrivalLoc",
organization = intermediaryName,
content = content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ class DataStoreRepository @Inject constructor(
private object PreferenceKeys {
val accessToken = stringPreferencesKey("access_token")
val refreshToken = stringPreferencesKey("refresh_token")
val socialToken = stringPreferencesKey("social_token")
val fcmToken = stringPreferencesKey("fcm_token")
val appMode = stringPreferencesKey("app_mode")
val socialProvider = stringPreferencesKey("social_provider")
}

suspend fun saveSocialToken(accessToken: String) {
context.dataStore.edit { preferences ->
preferences[PreferenceKeys.socialToken] = accessToken
}
}

suspend fun saveAccessToken(accessToken: String) {
Expand All @@ -51,6 +59,12 @@ class DataStoreRepository @Inject constructor(
}
}

suspend fun saveSocialProvider(provider: String) {
context.dataStore.edit { preferences ->
preferences[PreferenceKeys.socialProvider] = provider
}
}

val accessTokenFlow: Flow<String?> = context.dataStore.data
.map { preferences ->
preferences[PreferenceKeys.accessToken]
Expand All @@ -73,4 +87,14 @@ class DataStoreRepository @Inject constructor(
.map { preferences ->
preferences[PreferenceKeys.fcmToken]
}

val socialTokenFlow: Flow<String?> = context.dataStore.data
.map { preferences ->
preferences[PreferenceKeys.socialToken]
}

val socialProviderFlow: Flow<String?> = context.dataStore.data
.map { preferences ->
preferences[PreferenceKeys.socialProvider]
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.kusitms.connectdog.core.data.repository

import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewBody
import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewDetailResponse
import com.kusitms.connectdog.core.model.Application
import com.kusitms.connectdog.core.model.ConnectDogResult
import com.kusitms.connectdog.core.model.Volunteer
import java.io.File

interface ManagementRepository {
suspend fun getApplicationWaiting(page: Int? = 0, size: Int? = 5): List<Application>
Expand All @@ -12,4 +14,5 @@ interface ManagementRepository {
suspend fun getMyApplication(applicationId: Long): Volunteer
suspend fun deleteMyApplication(applicationId: Long): ConnectDogResult
suspend fun getReview(reviewId: Long): ReviewDetailResponse
suspend fun postReview(postId: Long, body: ReviewBody, images: List<File>)
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.kusitms.connectdog.core.data.repository

import com.google.gson.Gson
import com.kusitms.connectdog.core.data.api.ApiService
import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewBody
import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewDetailResponse
import com.kusitms.connectdog.core.data.mapper.toData
import com.kusitms.connectdog.core.data.mapper.volunteer.toData
import com.kusitms.connectdog.core.model.Application
import com.kusitms.connectdog.core.model.ConnectDogResult
import com.kusitms.connectdog.core.model.Volunteer
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
import javax.inject.Inject

internal class ManagementRepositoryImpl @Inject constructor(
Expand Down Expand Up @@ -35,4 +41,18 @@ internal class ManagementRepositoryImpl @Inject constructor(
override suspend fun getReview(reviewId: Long): ReviewDetailResponse {
return api.getReviewDetail(reviewId)
}

override suspend fun postReview(postId: Long, body: ReviewBody, images: List<File>) {
val jsonBody = RequestBody.create(
"application/json; charset=utf-8".toMediaTypeOrNull(),
Gson().toJson(body)
)

val files = images.map { file ->
val fileBody = RequestBody.create("multipart/form-data".toMediaTypeOrNull(), file)
MultipartBody.Part.createFormData("files", file.name, fileBody)
}

return api.postReview(postId, jsonBody, files)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import com.kusitms.connectdog.core.data.api.model.volunteer.EmailCertificationRe
import com.kusitms.connectdog.core.data.api.model.volunteer.IsDuplicateNicknameBody
import com.kusitms.connectdog.core.data.api.model.volunteer.NormalVolunteerSignUpBody
import com.kusitms.connectdog.core.data.api.model.volunteer.SocialVolunteerSignUpBody
import java.io.File

interface SignUpRepository {
suspend fun postNickname(nickname: IsDuplicateNicknameBody): IsDuplicateNicknameResponse
suspend fun postEmail(email: EmailCertificationBody): EmailCertificationResponseItem
suspend fun postNormalVolunteerSignUp(signUp: NormalVolunteerSignUpBody)
suspend fun postSocialVolunteerSignUp(signUp: SocialVolunteerSignUpBody)
suspend fun postIntermediatorSignUp(signUp: IntermediatorSignUpBody)
suspend fun postIntermediatorSignUp(signUp: IntermediatorSignUpBody, file: File)
suspend fun getVolunteerPhoneNumberDuplicated(body: IsDuplicatePhoneNumberBody): IsDuplicatePhoneNumberResponse
suspend fun getInterMediatorPhoneNumberDuplicated(body: IsDuplicatePhoneNumberBody): IsDuplicatePhoneNumberResponse
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kusitms.connectdog.core.data.repository

import com.google.gson.Gson
import com.kusitms.connectdog.core.data.api.ApiService
import com.kusitms.connectdog.core.data.api.InterApiService
import com.kusitms.connectdog.core.data.api.model.IsDuplicateNicknameResponse
Expand All @@ -11,6 +12,10 @@ import com.kusitms.connectdog.core.data.api.model.volunteer.EmailCertificationRe
import com.kusitms.connectdog.core.data.api.model.volunteer.IsDuplicateNicknameBody
import com.kusitms.connectdog.core.data.api.model.volunteer.NormalVolunteerSignUpBody
import com.kusitms.connectdog.core.data.api.model.volunteer.SocialVolunteerSignUpBody
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
import javax.inject.Inject

internal class SignUpRepositoryImpl @Inject constructor(
Expand All @@ -33,8 +38,17 @@ internal class SignUpRepositoryImpl @Inject constructor(
return volunteerApi.postSocialVolunteerSignUp(signUp)
}

override suspend fun postIntermediatorSignUp(signUp: IntermediatorSignUpBody) {
return intermediatorApi.intermediatorSignUp(signUp)
override suspend fun postIntermediatorSignUp(signUp: IntermediatorSignUpBody, image: File) {
val jsonBody = RequestBody.create(
"application/json; charset=utf-8".toMediaTypeOrNull(),
Gson().toJson(signUp)
)

val fileBody = RequestBody.create("multipart/form-data".toMediaTypeOrNull(), image)

val file = MultipartBody.Part.createFormData("file", image.name, fileBody)

return intermediatorApi.intermediatorSignUp(jsonBody, file)
}

override suspend fun getVolunteerPhoneNumberDuplicated(body: IsDuplicatePhoneNumberBody): IsDuplicatePhoneNumberResponse {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading