-
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.
- Loading branch information
Showing
8 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/moidot/moidot/data/api/GroupVoteService.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,13 +1,20 @@ | ||
package com.moidot.moidot.data.api | ||
|
||
import com.moidot.moidot.data.remote.request.RequestCreateVote | ||
import com.moidot.moidot.data.remote.response.ResponseCreateVote | ||
import com.moidot.moidot.data.remote.response.ResponseVoteStatus | ||
import retrofit2.Response | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Path | ||
|
||
interface GroupVoteService { | ||
|
||
@GET("/group/{groupId}/vote") | ||
suspend fun getVoteStatus(@Path("groupId") groupId: Int): Response<ResponseVoteStatus> | ||
|
||
@POST("/group/{groupId}/vote") | ||
suspend fun createVote(@Path("groupId") groupId: Int, @Body requestCreateVote: RequestCreateVote): Response<ResponseCreateVote> | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
...src/main/java/com/moidot/moidot/data/remote/datasource/group/GroupVoteRemoteDataSource.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,11 @@ | ||
package com.moidot.moidot.data.remote.datasource.group | ||
|
||
import com.moidot.moidot.data.remote.request.RequestCreateVote | ||
import com.moidot.moidot.data.remote.response.ResponseCreateVote | ||
import com.moidot.moidot.data.remote.response.ResponseVoteStatus | ||
|
||
interface GroupVoteRemoteDataSource { | ||
suspend fun getVoteStatus(groupId:Int): Result<ResponseVoteStatus> | ||
|
||
suspend fun createVote(groupId: Int, requestCreateVote: RequestCreateVote): Result<ResponseCreateVote> | ||
} |
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/moidot/moidot/data/remote/request/RequestCreateVote.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.moidot.moidot.data.remote.request | ||
|
||
data class RequestCreateVote( | ||
val isAnonymous: Boolean, | ||
val isEnabledMultipleChoice: Boolean, | ||
val endAt: String, | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/moidot/moidot/data/remote/response/ResponseCreateVote.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.moidot.moidot.data.remote.response | ||
|
||
data class ResponseCreateVote( | ||
val `data`: Data, | ||
) : BaseResponse() { | ||
data class Data( | ||
val endAt: String, | ||
val groupId: Int, | ||
val isAnonymous: Boolean, | ||
val isClosed: Boolean, | ||
val isEnabledMultipleChoice: Boolean, | ||
val voteId: Int | ||
) | ||
} |
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
4 changes: 4 additions & 0 deletions
4
app/src/main/java/com/moidot/moidot/repository/GroupVoteRepository.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,11 @@ | ||
package com.moidot.moidot.repository | ||
|
||
import com.moidot.moidot.data.remote.request.RequestCreateVote | ||
import com.moidot.moidot.data.remote.response.ResponseCreateVote | ||
import com.moidot.moidot.data.remote.response.ResponseVoteStatus | ||
|
||
interface GroupVoteRepository { | ||
suspend fun getVoteStatus(groupId: Int): Result<ResponseVoteStatus> | ||
|
||
suspend fun createVote(groupId: Int, requestCreateVote: RequestCreateVote): Result<ResponseCreateVote> | ||
} |