-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # backend/src/test/java/com/festago/artist/repository/MemoryArtistRepository.java
- Loading branch information
Showing
46 changed files
with
516 additions
and
176 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
22 changes: 22 additions & 0 deletions
22
...id/festago/data/src/main/java/com/festago/festago/data/dto/artist/ArtistDetailResponse.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,22 @@ | ||
package com.festago.festago.data.dto.artist | ||
|
||
import com.festago.festago.data.dto.school.SocialMediaResponse | ||
import com.festago.festago.domain.model.artist.ArtistDetail | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ArtistDetailResponse( | ||
val id: Int, | ||
val name: String?, | ||
val profileImageUrl: String?, | ||
val backgroundImageUrl: String?, | ||
val socialMedias: List<SocialMediaResponse>, | ||
) { | ||
fun toDomain() = ArtistDetail( | ||
id = id, | ||
artistName = name ?: "", | ||
profileUrl = profileImageUrl ?: "", | ||
backgroundUrl = backgroundImageUrl ?: "", | ||
artistMedia = socialMedias.map { it.toDomain() }, | ||
) | ||
} |
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
25 changes: 25 additions & 0 deletions
25
...estago/data/src/main/java/com/festago/festago/data/dto/festival/FestivalSearchResponse.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,25 @@ | ||
package com.festago.festago.data.dto.festival | ||
|
||
import com.festago.festago.data.dto.artist.ArtistResponse | ||
import com.festago.festago.domain.model.search.FestivalSearch | ||
import kotlinx.serialization.Serializable | ||
import java.time.LocalDate | ||
|
||
@Serializable | ||
data class FestivalSearchResponse( | ||
val id: Long, | ||
val name: String, | ||
val startDate: String, | ||
val endDate: String, | ||
val posterImageUrl: String, | ||
val artists: List<ArtistResponse>, | ||
) { | ||
fun toDomain(): FestivalSearch = FestivalSearch( | ||
id = id, | ||
name = name, | ||
startDate = LocalDate.parse(startDate), | ||
endDate = LocalDate.parse(endDate), | ||
imageUrl = posterImageUrl, | ||
artists = artists.map { it.toDomain() }, | ||
) | ||
} |
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
38 changes: 38 additions & 0 deletions
38
...festago/data/src/main/java/com/festago/festago/data/repository/DefaultArtistRepository.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,38 @@ | ||
package com.festago.festago.data.repository | ||
|
||
import com.festago.festago.data.service.ArtistRetrofitService | ||
import com.festago.festago.data.util.onSuccessOrCatch | ||
import com.festago.festago.data.util.runCatchingResponse | ||
import com.festago.festago.domain.model.artist.ArtistDetail | ||
import com.festago.festago.domain.model.festival.FestivalsPage | ||
import com.festago.festago.domain.repository.ArtistRepository | ||
import java.time.LocalDate | ||
import javax.inject.Inject | ||
|
||
class DefaultArtistRepository @Inject constructor( | ||
private val artistRetrofitService: ArtistRetrofitService, | ||
) : ArtistRepository { | ||
|
||
override suspend fun loadArtistDetail(id: Long): Result<ArtistDetail> { | ||
return runCatchingResponse { artistRetrofitService.getArtistDetail(id) } | ||
.onSuccessOrCatch { it.toDomain() } | ||
} | ||
|
||
override suspend fun loadArtistFestivals( | ||
id: Long, | ||
size: Int?, | ||
lastFestivalId: Long?, | ||
lastStartDate: LocalDate?, | ||
isPast: Boolean?, | ||
): Result<FestivalsPage> { | ||
return runCatchingResponse { | ||
artistRetrofitService.getArtistFestivals( | ||
artistId = id, | ||
size = size, | ||
lastFestivalId = lastFestivalId, | ||
lastStartDate = lastStartDate, | ||
isPast = isPast, | ||
) | ||
}.onSuccessOrCatch { it.toDomain() } | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
android/festago/data/src/main/java/com/festago/festago/data/service/ArtistRetrofitService.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,26 @@ | ||
package com.festago.festago.data.service | ||
|
||
import com.festago.festago.data.dto.artist.ArtistDetailResponse | ||
import com.festago.festago.data.dto.festival.FestivalsResponse | ||
import retrofit2.Response | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
import retrofit2.http.Query | ||
import java.time.LocalDate | ||
|
||
interface ArtistRetrofitService { | ||
|
||
@GET("api/v1/artists/{artistId}/festivals") | ||
suspend fun getArtistFestivals( | ||
@Path("artistId") artistId: Long, | ||
@Query("size") size: Int?, | ||
@Query("lastFestivalId") lastFestivalId: Long?, | ||
@Query("lastStartDate") lastStartDate: LocalDate?, | ||
@Query("isPast") isPast: Boolean?, | ||
): Response<FestivalsResponse> | ||
|
||
@GET("api/v1/artists/{artistId}") | ||
suspend fun getArtistDetail( | ||
@Path("artistId") artistId: Long, | ||
): Response<ArtistDetailResponse> | ||
} |
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
6 changes: 4 additions & 2 deletions
6
android/festago/domain/src/main/java/com/festago/festago/domain/model/artist/ArtistDetail.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,9 +1,11 @@ | ||
package com.festago.festago.domain.model.artist | ||
|
||
import com.festago.festago.domain.model.social.SocialMedia | ||
|
||
data class ArtistDetail( | ||
val id: Int, | ||
val artistName: String, | ||
val logoUrl: String, | ||
val profileUrl: String, | ||
val backgroundUrl: String, | ||
val artistMedia: List<ArtistMedia>, | ||
val artistMedia: List<SocialMedia>, | ||
) |
Oops, something went wrong.