-
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.
Browse files
Browse the repository at this point in the history
[FEAT/#137] 신고하기 페이지 신고하기 기능 및 API 구현
- Loading branch information
Showing
18 changed files
with
189 additions
and
19 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/spoony/spoony/data/datasource/ReportDataSource.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.spoony.spoony.data.datasource | ||
|
||
import com.spoony.spoony.data.dto.base.BaseResponse | ||
|
||
interface ReportDataSource { | ||
suspend fun postReportPost(postId: Int, userId: Int, reportType: String, reportDetail: String): BaseResponse<Boolean> | ||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/spoony/spoony/data/datasourceimpl/ReportDataSourceImpl.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.spoony.spoony.data.datasourceimpl | ||
|
||
import com.spoony.spoony.data.datasource.ReportDataSource | ||
import com.spoony.spoony.data.dto.base.BaseResponse | ||
import com.spoony.spoony.data.dto.request.ReportPostRequestDto | ||
import com.spoony.spoony.data.service.ReportService | ||
import javax.inject.Inject | ||
|
||
class ReportDataSourceImpl @Inject constructor( | ||
private val reportService: ReportService | ||
) : ReportDataSource { | ||
override suspend fun postReportPost(postId: Int, userId: Int, reportType: String, reportDetail: String): BaseResponse<Boolean> = | ||
reportService.postReportPost( | ||
ReportPostRequestDto(postId = postId, userId = userId, reportType = reportType, reportDetail = reportDetail) | ||
) | ||
} |
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
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/spoony/spoony/data/dto/request/ReportPostRequestDto.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.spoony.spoony.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ReportPostRequestDto( | ||
@SerialName("postId") | ||
val postId: Int, | ||
@SerialName("userId") | ||
val userId: Int, | ||
@SerialName("reportType") | ||
val reportType: String, | ||
@SerialName("reportDetail") | ||
val reportDetail: String | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/spoony/spoony/data/repositoryimpl/ReportRepositoryImpl.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.spoony.spoony.data.repositoryimpl | ||
|
||
import com.spoony.spoony.data.datasource.ReportDataSource | ||
import com.spoony.spoony.domain.repository.ReportRepository | ||
import javax.inject.Inject | ||
|
||
class ReportRepositoryImpl @Inject constructor( | ||
private val reportDataSource: ReportDataSource | ||
) : ReportRepository { | ||
override suspend fun postReportPost(postId: Int, userId: Int, reportType: String, reportDetail: String): Result<Boolean> = | ||
runCatching { | ||
reportDataSource.postReportPost(postId = postId, userId = userId, reportType = reportType, reportDetail = reportDetail).success | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/spoony/spoony/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,13 @@ | ||
package com.spoony.spoony.data.service | ||
|
||
import com.spoony.spoony.data.dto.base.BaseResponse | ||
import com.spoony.spoony.data.dto.request.ReportPostRequestDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface ReportService { | ||
@POST("/api/v1/report") | ||
suspend fun postReportPost( | ||
@Body reportPostRequestDto: ReportPostRequestDto | ||
): BaseResponse<Boolean> | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/spoony/spoony/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,5 @@ | ||
package com.spoony.spoony.domain.repository | ||
|
||
interface ReportRepository { | ||
suspend fun postReportPost(postId: Int, userId: Int, reportType: String, reportDetail: String): Result<Boolean> | ||
} |
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
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/spoony/spoony/presentation/report/ReportSideEffect.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,5 @@ | ||
package com.spoony.spoony.presentation.report | ||
|
||
sealed class ReportSideEffect { | ||
data object ShowDialog : ReportSideEffect() | ||
} |
3 changes: 3 additions & 0 deletions
3
app/src/main/java/com/spoony/spoony/presentation/report/ReportState.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
Oops, something went wrong.