-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] #98 기존단체입장(초대코드) 그룹 단체 디테일 서버통신 기능 구현
- Loading branch information
1 parent
0eeb106
commit 7ca7341
Showing
11 changed files
with
189 additions
and
68 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
app/src/main/java/org/sopt/pingle/data/datasource/remote/JoinGroupCodeRemoteDataSource.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,8 @@ | ||
package org.sopt.pingle.data.datasource.remote | ||
|
||
import org.sopt.pingle.data.model.remote.response.ResponseJoinGroupInfoDto | ||
import org.sopt.pingle.util.base.BaseResponse | ||
|
||
interface JoinGroupCodeRemoteDataSource { | ||
suspend fun getJoinGroupCodeInfo(teamId: Int): BaseResponse<ResponseJoinGroupInfoDto> | ||
} |
14 changes: 14 additions & 0 deletions
14
...main/java/org/sopt/pingle/data/datasourceimpl/remote/JoinGroupCodeRemoteDataSourceImpl.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 org.sopt.pingle.data.datasourceimpl.remote | ||
|
||
import org.sopt.pingle.data.datasource.remote.JoinGroupCodeRemoteDataSource | ||
import org.sopt.pingle.data.model.remote.response.ResponseJoinGroupInfoDto | ||
import org.sopt.pingle.data.service.JoinGroupService | ||
import org.sopt.pingle.util.base.BaseResponse | ||
import javax.inject.Inject | ||
|
||
class JoinGroupCodeRemoteDataSourceImpl @Inject constructor( | ||
private val joinGroupService: JoinGroupService | ||
) : JoinGroupCodeRemoteDataSource { | ||
override suspend fun getJoinGroupCodeInfo(teamId: Int): BaseResponse<ResponseJoinGroupInfoDto> = | ||
joinGroupService.getJoinGroupDetail(teamId = teamId) | ||
} |
34 changes: 0 additions & 34 deletions
34
app/src/main/java/org/sopt/pingle/data/model/remote/response/ResponseJoinGroupCodeDto.kt
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
app/src/main/java/org/sopt/pingle/data/model/remote/response/ResponseJoinGroupInfoDto.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,27 @@ | ||
package org.sopt.pingle.data.model.remote.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import org.sopt.pingle.domain.model.JoinGroupInfoEntity | ||
|
||
@Serializable | ||
data class ResponseJoinGroupInfoDto( | ||
@SerialName("id") | ||
val id: Int, | ||
@SerialName("keyword") | ||
val keyword: String, | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("meetingCount") | ||
val meetingCount: Int, | ||
@SerialName("participantCount") | ||
val participantCount: Int | ||
) { | ||
fun toJoinGroupCodeEntity() = JoinGroupInfoEntity( | ||
id = this.id, | ||
keyword = this.keyword, | ||
name = this.name, | ||
meetingCount = this.meetingCount, | ||
participantCount = this.participantCount | ||
) | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/org/sopt/pingle/data/repository/JoinGroupCodeRepositoryImpl.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 org.sopt.pingle.data.repository | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
import org.sopt.pingle.data.datasource.remote.JoinGroupCodeRemoteDataSource | ||
import org.sopt.pingle.domain.model.JoinGroupInfoEntity | ||
import org.sopt.pingle.domain.repository.JoinGroupCodeRepository | ||
import javax.inject.Inject | ||
|
||
class JoinGroupCodeRepositoryImpl @Inject constructor( | ||
private val joinGroupCodeRemoteDataSource: JoinGroupCodeRemoteDataSource | ||
) : JoinGroupCodeRepository { | ||
override fun getJoinGroupInfo(teamId: Int): Flow<JoinGroupInfoEntity> = flow { | ||
val result = runCatching { | ||
joinGroupCodeRemoteDataSource.getJoinGroupCodeInfo(teamId = teamId).data.toJoinGroupCodeEntity() | ||
} | ||
emit(result.getOrThrow()) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/org/sopt/pingle/data/service/JoinGroupService.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 org.sopt.pingle.data.service | ||
|
||
import org.sopt.pingle.data.model.remote.response.ResponseJoinGroupInfoDto | ||
import org.sopt.pingle.util.base.BaseResponse | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
|
||
interface JoinGroupService { | ||
@GET("$VERSION/$TEAMS/{$TEAM_ID}") | ||
suspend fun getJoinGroupDetail( | ||
@Path("$TEAM_ID") teamId: Int | ||
): BaseResponse<ResponseJoinGroupInfoDto> | ||
|
||
companion object { | ||
const val VERSION = "v1" | ||
const val TEAMS = "teams" | ||
const val TEAM_ID = "teamId" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ingle/domain/model/JoinGroupCodeEntity.kt → ...ingle/domain/model/JoinGroupInfoEntity.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
8 changes: 8 additions & 0 deletions
8
app/src/main/java/org/sopt/pingle/domain/repository/JoinGroupCodeRepository.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,8 @@ | ||
package org.sopt.pingle.domain.repository | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import org.sopt.pingle.domain.model.JoinGroupInfoEntity | ||
|
||
interface JoinGroupCodeRepository { | ||
fun getJoinGroupInfo(teamId: Int): Flow<JoinGroupInfoEntity> | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/org/sopt/pingle/domain/usecase/GetJoinGroupInfoUseCase.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,12 @@ | ||
package org.sopt.pingle.domain.usecase | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import org.sopt.pingle.domain.model.JoinGroupInfoEntity | ||
import org.sopt.pingle.domain.repository.JoinGroupCodeRepository | ||
|
||
class GetJoinGroupInfoUseCase( | ||
private val joinGroupCodeRepository: JoinGroupCodeRepository | ||
) { | ||
operator fun invoke(teamId: Int): Flow<JoinGroupInfoEntity> = | ||
joinGroupCodeRepository.getJoinGroupInfo(teamId = teamId) | ||
} |
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