-
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
* [FEATURE] #32 포킷 목록 조회 API 구현 (useCase, repository, datasource, api) * [FIX] 포킷 상세 화면에서 포킷 수정과 링크 수정의 이벤트 호출부가 서로 바뀌어 있던 현상 수정 * [BASE] #32 RemotePokitDataSource, PokitRepositoryImpl 관련 테스트코드 작성 * [BASE] #32 pokitDetail 모듈에 domain의존성 추가 및 매핑 함수 구현 * [BASE] #32 포킷 상세 화면 포킷 목록 조회 useCase 연결 및 포킷 목록 페이지네이션 구현 * [FEATURE] #32 포킷 상세 화면 포킷 목록 조회 useCase 연결 및 포킷 목록 페이지네이션 구현 * [FEATURE] #32 포킷 수정/포킷 추가 API, repository, useCase 구현 * [UI] #32 포킷 상세 화면에서 링크 아이템의 날짜+도메인을 표시하는 텍스트의 최대 라인을 1로 변경 및 해당 케이스 preview 추가 * [FEATURE] #32 카테고리 내 링크 목록 조회 API, repository, useCase 구현 * [UI] #32 카테고리 상세 화면에서 필터의 정렬 기준값 2개가 모두 "최신순"으로 되어있던 부분 수정 * [FEATURE] #32 카테고리 상세 화면에서 링크 페이지네이션 적용 및 기존 카테고리 내 링크 목록 조회에서 필터 옵션 적용가능하도록 수정 + 테스트코드 추가 * [FIX] #32 포킷 목록 페이징에서 새로고침시 기존 데이터를 지우지 않던 문제 수정 * [FIX] #32 포킷 내 링크 목록 조회의 response 변경내역 적용 및 포킷 상세 화면에 진입할 때마다 새로고침되는 현상 수정 * [FEATURE] #32 포킷 상세조회, 포킷 이미지 목록 조회 API, Datasource, Repository, UseCase 구현 * [FEATURE] #32 포킷 상세 화면에 포킷 상세조회 UseCase연결 * [FEATURE] #32 포킷 추가/수정 화면에 API 연결 및 포킷 목록 리스트 페이지네이션 적용 * [FIX] #32 포킷 추가 모듈에 누락된 coil 라이브러리 의존성 추가 * [FEATURE] #32 포킷 추가 화면에 추가/수정 API 연결 및 포킷 도메인과 관련된 에러 코드 매핑 로직 구현 * [FEATURE] #32 포킷 삭제, 포킷 개수 조회 API, datasource, repository, useCase 구현 * [FEATURE] #32 포킷 상세 화면에 포킷 삭제 API 연결 * [FEATURE] #32 포킷 수정 후 포킷 상세 화면에서 포킷 명 변경 반영 * [CHORE] #32 ktlint 적용, 오타 수정 * [CHORE] #32 코드리뷰 반영
- Loading branch information
Showing
73 changed files
with
2,169 additions
and
135 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package pokitmons.pokit.data.api | ||
|
||
import pokitmons.pokit.data.model.link.response.GetLinksResponse | ||
import pokitmons.pokit.domain.model.link.LinksSort | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
import retrofit2.http.Query | ||
|
||
interface LinkApi { | ||
@GET("content/{categoryId}") | ||
suspend fun getLinks( | ||
@Path("categoryId") categoryId: Int = 0, | ||
@Query("page") page: Int = 0, | ||
@Query("size") size: Int = 10, | ||
@Query("sort") sort: List<String> = listOf(LinksSort.RECENT.value), | ||
@Query("isRead") isRead: Boolean = false, | ||
@Query("favorites") favorites: Boolean = false, | ||
@Query("startDate") startDate: String? = null, | ||
@Query("endDate") endDate: String? = null, | ||
@Query("categoryIds") categoryIds: List<Int>? = null, | ||
): GetLinksResponse | ||
} |
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,55 @@ | ||
package pokitmons.pokit.data.api | ||
|
||
import pokitmons.pokit.data.model.pokit.request.CreatePokitRequest | ||
import pokitmons.pokit.data.model.pokit.request.ModifyPokitRequest | ||
import pokitmons.pokit.data.model.pokit.response.CreatePokitResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitCountResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitImagesResponseItem | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitsResponse | ||
import pokitmons.pokit.data.model.pokit.response.ModifyPokitResponse | ||
import pokitmons.pokit.domain.model.pokit.PokitsSort | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.PATCH | ||
import retrofit2.http.POST | ||
import retrofit2.http.PUT | ||
import retrofit2.http.Path | ||
import retrofit2.http.Query | ||
|
||
interface PokitApi { | ||
@GET("category") | ||
suspend fun getPokits( | ||
@Query("filterUncategorized") filterUncategorized: Boolean = true, | ||
@Query("size") size: Int = 10, | ||
@Query("page") page: Int = 0, | ||
@Query("sort") sort: String = PokitsSort.RECENT.value, | ||
): GetPokitsResponse | ||
|
||
@POST("category") | ||
suspend fun createPokit( | ||
@Body createPokitRequest: CreatePokitRequest, | ||
): CreatePokitResponse | ||
|
||
@PATCH("category/{categoryId}") | ||
suspend fun modifyPokit( | ||
@Path("categoryId") categoryId: Int, | ||
@Body modifyPokitRequest: ModifyPokitRequest, | ||
): ModifyPokitResponse | ||
|
||
@GET("category/images") | ||
suspend fun getPokitImages(): List<GetPokitImagesResponseItem> | ||
|
||
@GET("category/{categoryId}") | ||
suspend fun getPokit( | ||
@Path("categoryId") categoryId: Int, | ||
): GetPokitResponse | ||
|
||
@PUT("category/{categoryId}") | ||
suspend fun deletePokit( | ||
@Path("categoryId") categoryId: Int, | ||
) | ||
|
||
@GET("category/count") | ||
suspend fun getPokitCount(): GetPokitCountResponse | ||
} |
18 changes: 18 additions & 0 deletions
18
data/src/main/java/pokitmons/pokit/data/datasource/remote/link/LinkDataSource.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,18 @@ | ||
package pokitmons.pokit.data.datasource.remote.link | ||
|
||
import pokitmons.pokit.data.model.link.response.GetLinksResponse | ||
import pokitmons.pokit.domain.model.link.LinksSort | ||
|
||
interface LinkDataSource { | ||
suspend fun getLinks( | ||
categoryId: Int = 0, | ||
page: Int = 0, | ||
size: Int = 10, | ||
sort: List<String> = listOf(LinksSort.RECENT.value), | ||
isRead: Boolean = false, | ||
favorites: Boolean = false, | ||
startDate: String? = null, | ||
endDate: String? = null, | ||
categoryIds: List<Int>? = null, | ||
): GetLinksResponse | ||
} |
33 changes: 33 additions & 0 deletions
33
data/src/main/java/pokitmons/pokit/data/datasource/remote/link/RemoteLinkDataSource.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,33 @@ | ||
package pokitmons.pokit.data.datasource.remote.link | ||
|
||
import pokitmons.pokit.data.api.LinkApi | ||
import pokitmons.pokit.data.model.link.response.GetLinksResponse | ||
import javax.inject.Inject | ||
|
||
class RemoteLinkDataSource @Inject constructor( | ||
private val linkApi: LinkApi, | ||
) : LinkDataSource { | ||
override suspend fun getLinks( | ||
categoryId: Int, | ||
page: Int, | ||
size: Int, | ||
sort: List<String>, | ||
isRead: Boolean, | ||
favorites: Boolean, | ||
startDate: String?, | ||
endDate: String?, | ||
categoryIds: List<Int>?, | ||
): GetLinksResponse { | ||
return linkApi.getLinks( | ||
categoryId = categoryId, | ||
page = page, | ||
size = size, | ||
sort = sort, | ||
isRead = isRead, | ||
favorites = favorites, | ||
startDate = startDate, | ||
endDate = endDate, | ||
categoryIds = categoryIds | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
data/src/main/java/pokitmons/pokit/data/datasource/remote/pokit/PokitDataSource.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,21 @@ | ||
package pokitmons.pokit.data.datasource.remote.pokit | ||
|
||
import pokitmons.pokit.data.model.pokit.request.CreatePokitRequest | ||
import pokitmons.pokit.data.model.pokit.request.GetPokitsRequest | ||
import pokitmons.pokit.data.model.pokit.request.ModifyPokitRequest | ||
import pokitmons.pokit.data.model.pokit.response.CreatePokitResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitCountResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitImagesResponseItem | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitsResponse | ||
import pokitmons.pokit.data.model.pokit.response.ModifyPokitResponse | ||
|
||
interface PokitDataSource { | ||
suspend fun getPokits(getPokitsRequest: GetPokitsRequest): GetPokitsResponse | ||
suspend fun createPokit(createPokitRequest: CreatePokitRequest): CreatePokitResponse | ||
suspend fun modifyPokit(pokitId: Int, modifyPokitRequest: ModifyPokitRequest): ModifyPokitResponse | ||
suspend fun getPokitImages(): List<GetPokitImagesResponseItem> | ||
suspend fun getPokit(pokitId: Int): GetPokitResponse | ||
suspend fun deletePokit(pokitId: Int) | ||
suspend fun getPokitCount(): GetPokitCountResponse | ||
} |
50 changes: 50 additions & 0 deletions
50
data/src/main/java/pokitmons/pokit/data/datasource/remote/pokit/RemotePokitDataSource.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,50 @@ | ||
package pokitmons.pokit.data.datasource.remote.pokit | ||
|
||
import pokitmons.pokit.data.api.PokitApi | ||
import pokitmons.pokit.data.model.pokit.request.CreatePokitRequest | ||
import pokitmons.pokit.data.model.pokit.request.GetPokitsRequest | ||
import pokitmons.pokit.data.model.pokit.request.ModifyPokitRequest | ||
import pokitmons.pokit.data.model.pokit.response.CreatePokitResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitCountResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitImagesResponseItem | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitResponse | ||
import pokitmons.pokit.data.model.pokit.response.GetPokitsResponse | ||
import pokitmons.pokit.data.model.pokit.response.ModifyPokitResponse | ||
import javax.inject.Inject | ||
|
||
class RemotePokitDataSource @Inject constructor( | ||
private val pokitApi: PokitApi, | ||
) : PokitDataSource { | ||
override suspend fun getPokits(getPokitsRequest: GetPokitsRequest): GetPokitsResponse { | ||
return pokitApi.getPokits( | ||
filterUncategorized = getPokitsRequest.filterUncategoriezd, | ||
size = getPokitsRequest.size, | ||
page = getPokitsRequest.page, | ||
sort = getPokitsRequest.sort.value | ||
) | ||
} | ||
|
||
override suspend fun createPokit(createPokitRequest: CreatePokitRequest): CreatePokitResponse { | ||
return pokitApi.createPokit(createPokitRequest = createPokitRequest) | ||
} | ||
|
||
override suspend fun modifyPokit(pokitId: Int, modifyPokitRequest: ModifyPokitRequest): ModifyPokitResponse { | ||
return pokitApi.modifyPokit(categoryId = pokitId, modifyPokitRequest = modifyPokitRequest) | ||
} | ||
|
||
override suspend fun getPokitImages(): List<GetPokitImagesResponseItem> { | ||
return pokitApi.getPokitImages() | ||
} | ||
|
||
override suspend fun getPokit(pokitId: Int): GetPokitResponse { | ||
return pokitApi.getPokit(pokitId) | ||
} | ||
|
||
override suspend fun deletePokit(pokitId: Int) { | ||
return pokitApi.deletePokit(pokitId) | ||
} | ||
|
||
override suspend fun getPokitCount(): GetPokitCountResponse { | ||
return pokitApi.getPokitCount() | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
data/src/main/java/pokitmons/pokit/data/di/link/LinkModule.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,23 @@ | ||
package pokitmons.pokit.data.di.link | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import pokitmons.pokit.data.datasource.remote.link.LinkDataSource | ||
import pokitmons.pokit.data.datasource.remote.link.RemoteLinkDataSource | ||
import pokitmons.pokit.data.repository.link.LinkRepositoryImpl | ||
import pokitmons.pokit.domain.repository.link.LinkRepository | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class LinkModule { | ||
@Binds | ||
@Singleton | ||
abstract fun bindLinkRepository(linkRepositoryImpl: LinkRepositoryImpl): LinkRepository | ||
|
||
@Binds | ||
@Singleton | ||
abstract fun bindLinkDataSource(linkDataSourceImpl: RemoteLinkDataSource): LinkDataSource | ||
} |
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
23 changes: 23 additions & 0 deletions
23
data/src/main/java/pokitmons/pokit/data/di/pokit/PokitModule.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,23 @@ | ||
package pokitmons.pokit.data.di.pokit | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import pokitmons.pokit.data.datasource.remote.pokit.PokitDataSource | ||
import pokitmons.pokit.data.datasource.remote.pokit.RemotePokitDataSource | ||
import pokitmons.pokit.data.repository.pokit.PokitRepositoryImpl | ||
import pokitmons.pokit.domain.repository.pokit.PokitRepository | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class PokitModule { | ||
@Binds | ||
@Singleton | ||
abstract fun bindPokitRepository(pokitRepositoryImpl: PokitRepositoryImpl): PokitRepository | ||
|
||
@Binds | ||
@Singleton | ||
abstract fun bindPokitDataSource(pokitDataSourceImpl: RemotePokitDataSource): PokitDataSource | ||
} |
24 changes: 24 additions & 0 deletions
24
data/src/main/java/pokitmons/pokit/data/mapper/link/LinkMapper.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,24 @@ | ||
package pokitmons.pokit.data.mapper.link | ||
|
||
import pokitmons.pokit.data.model.link.response.GetLinksResponse | ||
import pokitmons.pokit.domain.model.link.Link | ||
|
||
object LinkMapper { | ||
fun mapperToLinks(linksResponse: GetLinksResponse): List<Link> { | ||
return linksResponse.data.map { data -> | ||
Link( | ||
id = data.contentId, | ||
categoryId = data.category.categoryId, | ||
categoryName = data.category.categoryName, | ||
data = data.data, | ||
domain = data.domain, | ||
title = data.title, | ||
memo = data.memo, | ||
alertYn = data.alertYn, | ||
createdAt = data.createdAt, | ||
isRead = data.isRead, | ||
thumbnail = data.thumbNail | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.