-
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.
[Feat/#40] 신고페이지 POST API 연결
- Loading branch information
Showing
13 changed files
with
139 additions
and
39 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/sopt/shinmungo/data/dto/request/ReportRequest.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,19 @@ | ||
package com.sopt.shinmungo.data.dto.request | ||
|
||
import com.sopt.shinmungo.domain.entity.ReportPhotoItem | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ReportRequest( | ||
@SerialName("photoList") | ||
val photoList: List<ReportPhotoItem>, | ||
@SerialName("address") | ||
val address: String, | ||
@SerialName("content") | ||
val content: String, | ||
@SerialName("phoneNumber") | ||
val phoneNumber: String, | ||
@SerialName("category") | ||
val category: String, | ||
) |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/sopt/shinmungo/data/dto/response/ReportResponse.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,20 @@ | ||
package com.sopt.shinmungo.data.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ReportResponse( | ||
@SerialName("reportId") | ||
val reportId: Int, | ||
@SerialName("photoList") | ||
val photoList: List<PhotoDto>, | ||
@SerialName("address") | ||
val address: String, | ||
@SerialName("content") | ||
val content: String, | ||
@SerialName("phoneNumber") | ||
val phoneNumber: String, | ||
@SerialName("category") | ||
val category: 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
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/sopt/shinmungo/data/service/ReportService.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,16 @@ | ||
package com.sopt.shinmungo.data.service | ||
|
||
import com.sopt.shinmungo.data.dto.BaseResponse | ||
import com.sopt.shinmungo.data.dto.request.ReportRequest | ||
import com.sopt.shinmungo.data.dto.response.ReportResponse | ||
import retrofit2.http.Body | ||
import retrofit2.http.Header | ||
import retrofit2.http.POST | ||
|
||
interface ReportService { | ||
@POST("report") | ||
suspend fun postReport( | ||
@Header("userId") userId: Long, | ||
@Body request: ReportRequest | ||
): BaseResponse<ReportResponse> | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/sopt/shinmungo/domain/entity/ReportPhotoItem.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,6 +1,12 @@ | ||
package com.sopt.shinmungo.domain.entity | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ReportPhotoItem( | ||
@SerialName("photoId") | ||
val photoId: Int, | ||
@SerialName("photoUrl") | ||
val photoUrl: String, | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/sopt/shinmungo/domain/repository/ReportRepository.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,14 @@ | ||
package com.sopt.shinmungo.domain.repository | ||
|
||
import com.sopt.shinmungo.data.dto.request.ReportRequest | ||
import com.sopt.shinmungo.data.dto.response.ReportResponse | ||
import com.sopt.shinmungo.data.remote.ServicePool | ||
|
||
class ReportRepository { | ||
private val service = ServicePool.reportService | ||
|
||
suspend fun postReport(userId: Long, request: ReportRequest): Result<ReportResponse> = runCatching { | ||
val response = service.postReport(userId, request) | ||
response.data ?: throw Throwable("Failed to post report") | ||
} | ||
} |
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
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