-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve directory response, reduce verbose log and refactoring
- Loading branch information
Showing
7 changed files
with
153 additions
and
106 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/jeluchu/core/extensions/RoutesExtensions.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 com.jeluchu.core.extensions | ||
|
||
import io.ktor.http.* | ||
import io.ktor.server.routing.* | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.withContext | ||
|
||
fun Route.getToJson( | ||
path: String, | ||
request: suspend RoutingContext.() -> Unit | ||
): Route = get(path) { | ||
call.response.headers.append(HttpHeaders.ContentType, ContentType.Application.Json.toString()) | ||
withContext(Dispatchers.IO) { request() } | ||
} |
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.jeluchu.core.utils | ||
|
||
object Routes { | ||
const val DIRECTORY = "/directory" | ||
const val ANIME_DETAILS = "/anime/{id}" | ||
} |
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
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/jeluchu/features/anime/models/directory/AnimeDirectoryEntity.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.jeluchu.features.anime.models.directory | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AnimeDirectoryEntity( | ||
val rank: Int = 0, | ||
val year: Int = 0, | ||
var malId: Int = 0, | ||
val url: String = "", | ||
var type: String = "", | ||
var score: String = "", | ||
var title: String = "", | ||
var status: String = "", | ||
val season: String = "", | ||
var poster: String = "", | ||
var episodesCount: Int = 0, | ||
val airing: Boolean = false, | ||
var genres: List<String> = emptyList() | ||
) |
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
Oops, something went wrong.