-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from EAT-SSU/refactor/base-response
[Refactor/base response]
- Loading branch information
Showing
29 changed files
with
815 additions
and
433 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
2 changes: 1 addition & 1 deletion
2
app/src/main/java/com/eatssu/android/data/dto/request/InquiriesRequest.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
9 changes: 6 additions & 3 deletions
9
app/src/main/java/com/eatssu/android/data/dto/request/ModifyReviewRequest.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,10 @@ | ||
package com.eatssu.android.data.dto.request | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class ModifyReviewRequest( | ||
val content: String, | ||
val grade: Int, | ||
val reviewTags: List<String>, | ||
@SerializedName("mainRate") var mainRate: Int? = null, | ||
@SerializedName("amountRate") var amountRate: Int? = null, | ||
@SerializedName("tasteRate") var tasteRate: Int? = null, | ||
@SerializedName("content") var content: String? = null, | ||
) |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/eatssu/android/data/dto/request/WriteReviewRequest.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,13 @@ | ||
package com.eatssu.android.data.dto.request | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class WriteReviewRequest( | ||
|
||
@SerializedName("mainRating") var mainRating: Int? = null, | ||
@SerializedName("amountRating") var amountRating: Int? = null, | ||
@SerializedName("tasteRating") var tasteRating: Int? = null, | ||
@SerializedName("content") var content: String? = null, | ||
@SerializedName("imageUrl") var imageUrl: String? = null, | ||
|
||
) |
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
25 changes: 21 additions & 4 deletions
25
app/src/main/java/com/eatssu/android/data/dto/response/GetReviewListResponse.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,21 +1,38 @@ | ||
package com.eatssu.android.data.dto.response | ||
|
||
import com.eatssu.android.data.model.Reviews | ||
|
||
data class GetReviewListResponse( | ||
val dataList: List<Data>?, | ||
val hasNext: Boolean, | ||
val numberOfElements: Int | ||
){ | ||
val numberOfElements: Int, | ||
) { | ||
data class Data( | ||
val reviewId: Long, | ||
val menu: String, | ||
val writerId : Int, | ||
val writerId: Int, | ||
val isWriter: Boolean, | ||
val writerNickname: String, | ||
val mainGrade: Int, | ||
val amountGrade: Int, | ||
val tasteGrade: Int, | ||
val writeDate: String, | ||
val content: String, | ||
val imgUrlList: List<String> | ||
val imgUrlList: List<String>, | ||
) | ||
} | ||
|
||
fun GetReviewListResponse.toReviewList(): List<Reviews> { | ||
return dataList.orEmpty().map { data -> | ||
Reviews( | ||
menu = data.menu, | ||
writerNickname = data.writerNickname, | ||
mainGrade = data.mainGrade, | ||
amountGrade = data.amountGrade, | ||
tasteGrade = data.tasteGrade, | ||
writeDate = data.writeDate, | ||
content = data.content, | ||
imgUrlList = data.imgUrlList | ||
) | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/eatssu/android/data/dto/response/ImageResponse.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.eatssu.android.data.dto.response | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class ImageResponse( | ||
@SerializedName("url") var url: String? = null, | ||
) |
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,8 +1,8 @@ | ||
package com.eatssu.android.data.model | ||
|
||
data class Menu( | ||
val id: Int?, | ||
val name: String?, | ||
val price: Int?, | ||
val rate: String?, | ||
val id: Long, | ||
val name: String, | ||
val price: Int, | ||
val rate: String, | ||
) |
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,13 +1,33 @@ | ||
package com.eatssu.android.data.model | ||
|
||
data class Review( | ||
val multipartFileList: List<String>, | ||
val reviewCreate: ReviewCreate, | ||
var name: String? = null, | ||
var reviewCnt: Int? = null, | ||
var mainRating: Double? = null, | ||
var amountRating: Double? = null, | ||
var tasteRating: Double? = null, | ||
var ratingDetails: RatingDetails, | ||
var reviewList: List<Reviews>? = null, | ||
) | ||
|
||
data class ReviewCreate( | ||
val content: String, | ||
data class RatingDetails( | ||
var one: Int, | ||
var two: Int, | ||
var three: Int, | ||
var four: Int, | ||
var five: Int, | ||
) | ||
|
||
data class Reviews( | ||
val menu: String, | ||
val writerNickname: String, | ||
|
||
val mainGrade: Int, | ||
val amountGrade: Int, | ||
val tasteGrade: Int, | ||
|
||
val writeDate: String, | ||
|
||
val content: String, | ||
val imgUrlList: List<String>, | ||
) |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/eatssu/android/data/model/WriteReview.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,13 @@ | ||
package com.eatssu.android.data.model | ||
|
||
data class WriteReview( | ||
val multipartFileList: List<String>, | ||
val reviewCreate: ReviewCreate, | ||
) | ||
|
||
data class ReviewCreate( | ||
val content: String, | ||
val mainGrade: Int, | ||
val amountGrade: Int, | ||
val tasteGrade: Int, | ||
) |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/eatssu/android/data/repository/ImageRepository.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,11 @@ | ||
package com.eatssu.android.data.repository | ||
|
||
|
||
interface ImageRepository { | ||
|
||
// suspend fun getImageString( | ||
// image: MultipartBody.Part | ||
// ): Flow<Unit> | ||
|
||
// suspend fun login(idToken: String): Flow<LoginResponse> | ||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/eatssu/android/data/repository/ImageRepositoryImpl.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,17 @@ | ||
package com.eatssu.android.data.repository | ||
|
||
import com.eatssu.android.data.service.ImageService | ||
import javax.inject.Inject | ||
|
||
class ImageRepositoryImpl @Inject constructor(private val imageService: ImageService) : | ||
ImageRepository { | ||
|
||
|
||
// override suspend fun getImageString( | ||
// image: MultipartBody.Part | ||
// ): Flow<Unit> = flow { | ||
// emit(imageService.getImageUrl(image)) | ||
// } | ||
|
||
|
||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/eatssu/android/data/service/ImageService.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.eatssu.android.data.service | ||
|
||
import com.eatssu.android.base.BaseResponse | ||
import com.eatssu.android.data.dto.response.ImageResponse | ||
import okhttp3.MultipartBody | ||
import retrofit2.Call | ||
import retrofit2.http.Multipart | ||
import retrofit2.http.POST | ||
import retrofit2.http.Part | ||
|
||
interface ImageService { | ||
|
||
@Multipart | ||
@POST("/reviews/upload/image") //리뷰 이미지 업로드 | ||
fun getImageUrl( | ||
@Part image: MultipartBody.Part, | ||
): Call<BaseResponse<ImageResponse>> | ||
} |
2 changes: 1 addition & 1 deletion
2
app/src/main/java/com/eatssu/android/data/service/InquiresService.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
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.