-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/#113-home-filter
- Loading branch information
Showing
29 changed files
with
662 additions
and
249 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
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
18 changes: 18 additions & 0 deletions
18
data/src/main/java/com/terning/data/datasource/ScrapDataSource.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 com.terning.data.datasource | ||
|
||
import com.terning.data.dto.NonDataBaseResponse | ||
import com.terning.domain.entity.request.ScrapRequestModel | ||
|
||
interface ScrapDataSource { | ||
suspend fun postScrap( | ||
scrapRequestModel: ScrapRequestModel, | ||
): NonDataBaseResponse | ||
|
||
suspend fun deleteScrap( | ||
scrapRequestModel: ScrapRequestModel, | ||
): NonDataBaseResponse | ||
|
||
suspend fun patchScrap( | ||
scrapRequestModel: ScrapRequestModel, | ||
): NonDataBaseResponse | ||
} |
27 changes: 27 additions & 0 deletions
27
data/src/main/java/com/terning/data/datasourceimpl/ScrapDataSourceImpl.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 com.terning.data.datasourceimpl | ||
|
||
import com.terning.data.datasource.ScrapDataSource | ||
import com.terning.data.dto.NonDataBaseResponse | ||
import com.terning.data.dto.request.ScrapColorRequestDto | ||
import com.terning.data.service.ScrapService | ||
import com.terning.domain.entity.request.ScrapRequestModel | ||
import javax.inject.Inject | ||
|
||
class ScrapDataSourceImpl @Inject constructor( | ||
private val scrapService: ScrapService, | ||
) : ScrapDataSource { | ||
override suspend fun postScrap(scrapRequestModel: ScrapRequestModel): NonDataBaseResponse = | ||
scrapService.postScrap( | ||
scrapRequestModel.id, | ||
ScrapColorRequestDto(scrapRequestModel.color) | ||
) | ||
|
||
override suspend fun deleteScrap(scrapRequestModel: ScrapRequestModel): NonDataBaseResponse = | ||
scrapService.deleteScrap(scrapRequestModel.id) | ||
|
||
override suspend fun patchScrap(scrapRequestModel: ScrapRequestModel): NonDataBaseResponse = | ||
scrapService.patchScrap( | ||
scrapRequestModel.id, | ||
ScrapColorRequestDto(scrapRequestModel.color) | ||
) | ||
} |
10 changes: 10 additions & 0 deletions
10
data/src/main/java/com/terning/data/dto/request/ScrapColorRequestDto.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,10 @@ | ||
package com.terning.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ScrapColorRequestDto( | ||
@SerialName("color") | ||
val color: Int? = null, | ||
) |
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 |
---|---|---|
|
@@ -56,4 +56,4 @@ data class InternResponseDto( | |
scrapId = scrapId | ||
) | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -29,6 +29,4 @@ data class SearchScrapsResponseDto( | |
) | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
20 changes: 20 additions & 0 deletions
20
data/src/main/java/com/terning/data/repositoryimpl/ScrapRepositoryImpl.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,20 @@ | ||
package com.terning.data.repositoryimpl | ||
|
||
import com.terning.data.datasource.ScrapDataSource | ||
import com.terning.domain.entity.request.ScrapRequestModel | ||
import com.terning.domain.repository.ScrapRepository | ||
import javax.inject.Inject | ||
|
||
class ScrapRepositoryImpl @Inject constructor( | ||
private val scrapDataSource: ScrapDataSource, | ||
) : ScrapRepository { | ||
override suspend fun postScrap(scrapRequestModel: ScrapRequestModel) | ||
: Result<Unit> = runCatching { | ||
scrapDataSource.postScrap(scrapRequestModel) | ||
} | ||
|
||
override suspend fun deleteScrap(scrapRequestModel: ScrapRequestModel) | ||
: Result<Unit> = runCatching { | ||
scrapDataSource.deleteScrap(scrapRequestModel) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
data/src/main/java/com/terning/data/service/ScrapService.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,28 @@ | ||
package com.terning.data.service | ||
|
||
import com.terning.data.dto.NonDataBaseResponse | ||
import com.terning.data.dto.request.ScrapColorRequestDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.DELETE | ||
import retrofit2.http.PATCH | ||
import retrofit2.http.POST | ||
import retrofit2.http.Path | ||
|
||
interface ScrapService { | ||
@POST("api/v1/scraps/{internshipAnnouncementId}") | ||
suspend fun postScrap( | ||
@Path(value = "internshipAnnouncementId") internshipAnnouncementId: Long, | ||
@Body body: ScrapColorRequestDto, | ||
): NonDataBaseResponse | ||
|
||
@DELETE("api/v1/scraps/{scrapId}") | ||
suspend fun deleteScrap( | ||
@Path(value = "scrapId") scrapId: Long, | ||
): NonDataBaseResponse | ||
|
||
@PATCH("api/v1/scraps/{scrapId}") | ||
suspend fun patchScrap( | ||
@Path(value = "scrapId") scrapId: Long, | ||
@Body body: ScrapColorRequestDto, | ||
): NonDataBaseResponse | ||
} |
6 changes: 6 additions & 0 deletions
6
domain/src/main/java/com/terning/domain/entity/request/ScrapRequestModel.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,6 @@ | ||
package com.terning.domain.entity.request | ||
|
||
data class ScrapRequestModel( | ||
val id: Long, | ||
val color: Int? = 0, | ||
) |
Oops, something went wrong.