Skip to content

Commit

Permalink
Merge pull request #191 from GSM-MSG/feature/#137_apply_activity_api_…
Browse files Browse the repository at this point in the history
…query_string_and_naming

🔀 :: (#137) Activity API 변경사항, 컨벤션 적용
  • Loading branch information
Chaejongin12 authored May 30, 2024
2 parents e0e08a3 + 03aa0cb commit 4fd2e62
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 120 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.msg.data.repository.activity

import com.msg.model.remote.model.activity.StudentActivityModel
import com.msg.model.remote.response.activity.InquiryDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.InquiryStudentActivityListResponse
import com.msg.model.remote.response.activity.GetDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.GetStudentActivityListResponse
import kotlinx.coroutines.flow.Flow
import java.util.UUID

Expand All @@ -13,8 +13,8 @@ interface ActivityRepository {
suspend fun approveStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun rejectStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun deleteStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun inquiryMyStudentActivityInfoList(page: Int, size: Int, sort: String): Flow<InquiryStudentActivityListResponse>
suspend fun inquiryStudentActivityInfoList(page: Int, size: Int, sort: String, id: UUID): Flow<InquiryStudentActivityListResponse>
suspend fun inquiryEntireStudentActivityInfoList(page: Int, size: Int, sort: String): Flow<InquiryStudentActivityListResponse>
suspend fun inquiryDetailStudentActivityInfo(id: UUID): Flow<InquiryDetailStudentActivityInfoResponse>
suspend fun getMyStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
suspend fun getStudentActivityInfoList(page: Int, size: Int, id: UUID): Flow<GetStudentActivityListResponse>
suspend fun getEntireStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
suspend fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse>
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.msg.data.repository.activity

import com.msg.model.remote.model.activity.StudentActivityModel
import com.msg.model.remote.response.activity.InquiryDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.InquiryStudentActivityListResponse
import com.msg.model.remote.response.activity.GetDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.GetStudentActivityListResponse
import com.msg.network.datasource.activity.ActivityDataSource
import kotlinx.coroutines.flow.Flow
import java.util.UUID
Expand Down Expand Up @@ -42,46 +42,40 @@ class ActivityRepositoryImpl @Inject constructor(
)
}

override suspend fun inquiryMyStudentActivityInfoList(
override suspend fun getMyStudentActivityInfoList(
page: Int,
size: Int,
sort: String
): Flow<InquiryStudentActivityListResponse> {
return activityDataSource.inquiryMyStudentActivityInfoList(
): Flow<GetStudentActivityListResponse> {
return activityDataSource.getMyStudentActivityInfoList(
page = page,
size = size,
sort = sort
)
}

override suspend fun inquiryStudentActivityInfoList(
override suspend fun getStudentActivityInfoList(
page: Int,
size: Int,
sort: String,
id: UUID
): Flow<InquiryStudentActivityListResponse> {
return activityDataSource.inquiryStudentActivityInfoList(
): Flow<GetStudentActivityListResponse> {
return activityDataSource.getStudentActivityInfoList(
page = page,
size = size,
sort = sort,
id = id
)
}

override suspend fun inquiryEntireStudentActivityInfoList(
override suspend fun getEntireStudentActivityInfoList(
page: Int,
size: Int,
sort: String
): Flow<InquiryStudentActivityListResponse> {
return activityDataSource.inquiryEntireStudentActivityInfoList(
): Flow<GetStudentActivityListResponse> {
return activityDataSource.getEntireStudentActivityInfoList(
page = page,
size = size,
sort = sort
)
}

override suspend fun inquiryDetailStudentActivityInfo(id: UUID): Flow<InquiryDetailStudentActivityInfoResponse> {
return activityDataSource.inquiryDetailStudentActivityInfo(
override suspend fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse> {
return activityDataSource.getDetailStudentActivityInfo(
id = id
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import com.msg.data.repository.activity.ActivityRepository
import java.util.UUID
import javax.inject.Inject

class InquiryDetailStudentActivityInfoUseCase @Inject constructor(
class GetDetailStudentActivityInfoUseCase @Inject constructor(
private val activityRepository: ActivityRepository
) {
suspend operator fun invoke(id: UUID) = runCatching {
activityRepository.inquiryDetailStudentActivityInfo(id = id)
activityRepository.getDetailStudentActivityInfo(id = id)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ package com.msg.domain.activity
import com.msg.data.repository.activity.ActivityRepository
import javax.inject.Inject

class InquiryMyStudentActivityInfoListUseCase @Inject constructor(
class GetEntireStudentActivityInfoListUseCase @Inject constructor(
private val activityRepository: ActivityRepository
) {
suspend operator fun invoke(page: Int, size: Int, sort: String) = runCatching {
activityRepository.inquiryMyStudentActivityInfoList(
suspend operator fun invoke(page: Int, size: Int) = runCatching {
activityRepository.getEntireStudentActivityInfoList(
page = page,
size = size,
sort = sort
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ package com.msg.domain.activity
import com.msg.data.repository.activity.ActivityRepository
import javax.inject.Inject

class InquiryEntireStudentActivityInfoListUseCase @Inject constructor(
class GetMyStudentActivityInfoListUseCase @Inject constructor(
private val activityRepository: ActivityRepository
) {
suspend operator fun invoke(page: Int, size: Int, sort: String) = runCatching {
activityRepository.inquiryEntireStudentActivityInfoList(
suspend operator fun invoke(page: Int, size: Int) = runCatching {
activityRepository.getMyStudentActivityInfoList(
page = page,
size = size,
sort = sort
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import com.msg.data.repository.activity.ActivityRepository
import java.util.UUID
import javax.inject.Inject

class InquiryStudentActivityInfoListUseCase @Inject constructor(
class GetStudentActivityInfoListUseCase @Inject constructor(
private val activityRepository: ActivityRepository
) {
suspend operator fun invoke(page: Int, size: Int, sort: String, id: UUID) = runCatching {
activityRepository.inquiryStudentActivityInfoList(
suspend operator fun invoke(page: Int, size: Int, id: UUID) = runCatching {
activityRepository.getStudentActivityInfoList(
page = page,
size = size,
sort = sort,
id = id
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.msg.model.remote.enumdatatype.ApproveStatus
import java.time.LocalDate
import java.util.UUID

data class InquiryStudentActivityModel (
data class GetStudentActivityModel (
val activityId: UUID,
val title: String,
val activityDate: LocalDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.time.LocalDate
import java.time.LocalDateTime
import java.util.UUID

data class InquiryDetailStudentActivityInfoResponse(
data class GetDetailStudentActivityInfoResponse(
val id: UUID,
val title: String,
val content: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.msg.model.remote.response.activity

import com.msg.model.remote.model.activity.InquiryStudentActivityModel
import com.msg.model.remote.model.activity.GetStudentActivityModel

data class InquiryStudentActivityListResponse (
val content: List<InquiryStudentActivityModel>,
data class GetStudentActivityListResponse (
val content: List<GetStudentActivityModel>,
val pageable: Pageable,
val totalPages: Int,
val totalElements: Int,
Expand Down
23 changes: 10 additions & 13 deletions core/network/src/main/java/com/msg/network/api/ActivityAPI.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.msg.network.api

import com.msg.model.remote.model.activity.StudentActivityModel
import com.msg.model.remote.response.activity.InquiryDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.InquiryStudentActivityListResponse
import com.msg.model.remote.response.activity.GetDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.GetStudentActivityListResponse
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
Expand Down Expand Up @@ -40,29 +40,26 @@ interface ActivityAPI {
)

@GET("activity/my")
suspend fun inquiryMyStudentActivityInfoList(
suspend fun getMyStudentActivityInfoList(
@Query("page") page: Int,
@Query("size") size: Int,
@Query("sort") sort: String
): InquiryStudentActivityListResponse
): GetStudentActivityListResponse

@GET("activity/{student_id}")
suspend fun inquiryStudentActivityInfoList(
suspend fun getStudentActivityInfoList(
@Query("page") page: Int,
@Query("size") size: Int,
@Query("sort") sort: String,
@Path("student_id") id: UUID
): InquiryStudentActivityListResponse
): GetStudentActivityListResponse

@GET("activity")
suspend fun inquiryEntireStudentActivityInfoList(
suspend fun getEntireStudentActivityInfoList(
@Query("page") page: Int,
@Query("size") size: Int,
@Query("sort") sort: String
): InquiryStudentActivityListResponse
): GetStudentActivityListResponse

@GET("activity/{id}/detail")
suspend fun inquiryDetailStudentActivityInfo(
suspend fun getDetailStudentActivityInfo(
@Path("id") id: UUID
): InquiryDetailStudentActivityInfoResponse
): GetDetailStudentActivityInfoResponse
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.msg.network.datasource.activity

import com.msg.model.remote.model.activity.StudentActivityModel
import com.msg.model.remote.response.activity.InquiryDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.InquiryStudentActivityListResponse
import com.msg.model.remote.response.activity.GetDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.GetStudentActivityListResponse
import kotlinx.coroutines.flow.Flow
import java.util.UUID

Expand All @@ -12,8 +12,8 @@ interface ActivityDataSource {
suspend fun approveStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun rejectStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun deleteStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun inquiryMyStudentActivityInfoList(page: Int, size: Int, sort: String): Flow<InquiryStudentActivityListResponse>
suspend fun inquiryStudentActivityInfoList(page: Int, size: Int, sort: String, id: UUID): Flow<InquiryStudentActivityListResponse>
suspend fun inquiryEntireStudentActivityInfoList(page: Int, size: Int, sort: String): Flow<InquiryStudentActivityListResponse>
suspend fun inquiryDetailStudentActivityInfo(id: UUID): Flow<InquiryDetailStudentActivityInfoResponse>
suspend fun getMyStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
suspend fun getStudentActivityInfoList(page: Int, size: Int, id: UUID): Flow<GetStudentActivityListResponse>
suspend fun getEntireStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
suspend fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse>
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.msg.network.datasource.activity

import com.msg.model.remote.model.activity.StudentActivityModel
import com.msg.model.remote.response.activity.InquiryDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.InquiryStudentActivityListResponse
import com.msg.model.remote.response.activity.GetDetailStudentActivityInfoResponse
import com.msg.model.remote.response.activity.GetStudentActivityListResponse
import com.msg.network.api.ActivityAPI
import com.msg.network.util.BitgoeulApiHandler
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -55,47 +55,44 @@ class ActivityDataSourceImpl @Inject constructor(
)
}.flowOn(Dispatchers.IO)

override suspend fun inquiryMyStudentActivityInfoList(
override suspend fun getMyStudentActivityInfoList(
page: Int,
size: Int,
sort: String
): Flow<InquiryStudentActivityListResponse> = flow {
): Flow<GetStudentActivityListResponse> = flow {
emit(
BitgoeulApiHandler<InquiryStudentActivityListResponse>()
.httpRequest { activityAPI.inquiryMyStudentActivityInfoList(page = page, size = size, sort = sort) }
BitgoeulApiHandler<GetStudentActivityListResponse>()
.httpRequest { activityAPI.getMyStudentActivityInfoList(page = page, size = size) }
.sendRequest()
)
}.flowOn(Dispatchers.IO)

override suspend fun inquiryStudentActivityInfoList(
override suspend fun getStudentActivityInfoList(
page: Int,
size: Int,
sort: String,
id: UUID
): Flow<InquiryStudentActivityListResponse> = flow {
): Flow<GetStudentActivityListResponse> = flow {
emit(
BitgoeulApiHandler<InquiryStudentActivityListResponse>()
.httpRequest { activityAPI.inquiryStudentActivityInfoList(page = page, size = size, sort = sort, id = id) }
BitgoeulApiHandler<GetStudentActivityListResponse>()
.httpRequest { activityAPI.getStudentActivityInfoList(page = page, size = size, id = id) }
.sendRequest()
)
}.flowOn(Dispatchers.IO)

override suspend fun inquiryEntireStudentActivityInfoList(
override suspend fun getEntireStudentActivityInfoList(
page: Int,
size: Int,
sort: String
): Flow<InquiryStudentActivityListResponse> = flow {
): Flow<GetStudentActivityListResponse> = flow {
emit(
BitgoeulApiHandler<InquiryStudentActivityListResponse>()
.httpRequest { activityAPI.inquiryEntireStudentActivityInfoList(page = page, size = size, sort = sort) }
BitgoeulApiHandler<GetStudentActivityListResponse>()
.httpRequest { activityAPI.getEntireStudentActivityInfoList(page = page, size = size) }
.sendRequest()
)
}.flowOn(Dispatchers.IO)

override suspend fun inquiryDetailStudentActivityInfo(id: UUID): Flow<InquiryDetailStudentActivityInfoResponse> = flow {
override suspend fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse> = flow {
emit(
BitgoeulApiHandler<InquiryDetailStudentActivityInfoResponse>()
.httpRequest { activityAPI.inquiryDetailStudentActivityInfo(id = id) }
BitgoeulApiHandler<GetDetailStudentActivityInfoResponse>()
.httpRequest { activityAPI.getDetailStudentActivityInfo(id = id) }
.sendRequest()
)
}.flowOn(Dispatchers.IO)
Expand Down
6 changes: 3 additions & 3 deletions core/ui/src/main/java/com/msg/ui/StudentActivityCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import androidx.compose.ui.unit.dp
import com.msg.design_system.theme.BitgoeulAndroidTheme
import com.msg.model.remote.enumdatatype.ApproveStatus
import Authority
import com.msg.model.remote.model.activity.InquiryStudentActivityModel
import com.msg.model.remote.model.activity.GetStudentActivityModel
import com.msg.ui.util.toKoreanFormat
import java.time.LocalDate
import java.util.UUID

@Composable
fun StudentActivityCard(
data: InquiryStudentActivityModel,
data: GetStudentActivityModel,
onClick: (UUID) -> Unit,
role: Authority = Authority.ROLE_USER
) {
Expand Down Expand Up @@ -89,7 +89,7 @@ fun StudentActivityCard(
@Composable
fun StudentActivityCardPre() {
StudentActivityCard(
data = InquiryStudentActivityModel(
data = GetStudentActivityModel(
activityId = UUID.randomUUID(),
title = "title",
activityDate = LocalDate.now(),
Expand Down
4 changes: 2 additions & 2 deletions core/ui/src/main/java/com/msg/ui/StudentActivityList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.msg.design_system.theme.BitgoeulAndroidTheme
import Authority
import com.msg.model.remote.model.activity.InquiryStudentActivityModel
import com.msg.model.remote.model.activity.GetStudentActivityModel
import java.util.UUID

@Composable
fun StudentActivityList(
data: List<InquiryStudentActivityModel>,
data: List<GetStudentActivityModel>,
onClick: (UUID) -> Unit,
role: Authority
) {
Expand Down
Loading

0 comments on commit 4fd2e62

Please sign in to comment.