diff --git a/.gitignore b/.gitignore index 7f31c66..bc49ede 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ out/ gradlew gradlew.bat + +.kotlin/ diff --git a/src/main/kotlin/com/jeluchu/core/models/jikan/anime/Aired.kt b/src/main/kotlin/com/jeluchu/core/models/jikan/anime/Aired.kt index a584707..58895a3 100644 --- a/src/main/kotlin/com/jeluchu/core/models/jikan/anime/Aired.kt +++ b/src/main/kotlin/com/jeluchu/core/models/jikan/anime/Aired.kt @@ -1,6 +1,5 @@ package com.jeluchu.core.models.jikan.anime -import com.jeluchu.core.models.jikan.anime.Prop import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/core/models/jikan/anime/AnimeData.kt b/src/main/kotlin/com/jeluchu/core/models/jikan/anime/AnimeData.kt index 124077d..fd3ffbb 100644 --- a/src/main/kotlin/com/jeluchu/core/models/jikan/anime/AnimeData.kt +++ b/src/main/kotlin/com/jeluchu/core/models/jikan/anime/AnimeData.kt @@ -3,7 +3,6 @@ package com.jeluchu.core.models.jikan.anime import com.jeluchu.core.enums.Day import com.jeluchu.core.utils.toVideoPromo import com.jeluchu.features.rankings.models.AnimeTopEntity -import com.jeluchu.features.rankings.models.MangaTopEntity import com.jeluchu.features.schedule.models.DayEntity import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/core/models/jikan/character/CharacterData.kt b/src/main/kotlin/com/jeluchu/core/models/jikan/character/CharacterData.kt index 310b14d..97d3c9c 100644 --- a/src/main/kotlin/com/jeluchu/core/models/jikan/character/CharacterData.kt +++ b/src/main/kotlin/com/jeluchu/core/models/jikan/character/CharacterData.kt @@ -1,9 +1,7 @@ package fordelete import com.jeluchu.core.models.jikan.anime.Images -import com.jeluchu.core.models.jikan.people.PeopleData import com.jeluchu.features.rankings.models.CharacterTopEntity -import com.jeluchu.features.rankings.models.PeopleTopEntity import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/core/utils/Constants.kt b/src/main/kotlin/com/jeluchu/core/utils/Constants.kt index 2b82b49..746b48e 100644 --- a/src/main/kotlin/com/jeluchu/core/utils/Constants.kt +++ b/src/main/kotlin/com/jeluchu/core/utils/Constants.kt @@ -5,10 +5,14 @@ object BaseUrls { } object Endpoints { + const val FULL = "full" + const val ANIME = "anime/" const val SCHEDULES = "schedules" const val TOP_ANIME = "top/anime" const val TOP_MANGA = "top/manga" const val TOP_PEOPLE = "top/people" + const val STATISTICS = "statistics" + const val CHARACTERS = "characters" const val TOP_CHARACTER = "top/characters" } @@ -41,5 +45,6 @@ object Collections { const val ANIME_RANKING = "anime_ranking" const val MANGA_RANKING = "manga_ranking" const val PEOPLE_RANKING = "people_ranking" + const val ANIME_DIRECTORY = "anime_directory" const val CHARACTER_RANKING = "character_ranking" } \ No newline at end of file diff --git a/src/main/kotlin/com/jeluchu/core/utils/Mappers.kt b/src/main/kotlin/com/jeluchu/core/utils/Mappers.kt index d130464..cbf9ce4 100644 --- a/src/main/kotlin/com/jeluchu/core/utils/Mappers.kt +++ b/src/main/kotlin/com/jeluchu/core/utils/Mappers.kt @@ -1,9 +1,9 @@ package com.jeluchu.core.utils -import com.example.models.VideoPromo import com.jeluchu.core.models.jikan.anime.ImageFormat import com.jeluchu.core.models.jikan.anime.Trailer import com.jeluchu.features.anime.models.anime.Images +import com.jeluchu.features.anime.models.anime.VideoPromo fun Trailer.toVideoPromo() = VideoPromo( url = url.orEmpty(), diff --git a/src/main/kotlin/com/jeluchu/features/anime/mappers/AnimeMappers.kt b/src/main/kotlin/com/jeluchu/features/anime/mappers/AnimeMappers.kt index 98e802b..37e7f3b 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/mappers/AnimeMappers.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/mappers/AnimeMappers.kt @@ -1,12 +1,14 @@ package com.jeluchu.features.anime.mappers -import com.example.models.* import com.jeluchu.core.extensions.* -import com.jeluchu.features.anime.models.anime.Images +import com.jeluchu.features.anime.models.anime.* import com.jeluchu.features.anime.models.directory.AnimeDirectoryEntity import com.jeluchu.features.rankings.models.AnimeTopEntity import com.jeluchu.features.schedule.models.DayEntity import org.bson.Document +import java.sql.Timestamp +import java.time.ZonedDateTime +import java.time.format.DateTimeFormatter fun documentToAnimeDirectoryEntity(doc: Document) = AnimeDirectoryEntity( rank = doc.getIntSafe("rank"), @@ -26,7 +28,7 @@ fun documentToAnimeDirectoryEntity(doc: Document) = AnimeDirectoryEntity( fun documentToMoreInfoEntity(doc: Document): MoreInfoEntity { return MoreInfoEntity( - id = doc.getLongSafe("id"), + id = doc.getObjectId("_id").toString(), malId = doc.getIntSafe("malId"), title = doc.getStringSafe("title"), poster = doc.getStringSafe("poster"), @@ -155,9 +157,14 @@ fun documentToIndividual(doc: Document): Individual { fun documentToMergedEpisode(doc: Document): MergedEpisode { return MergedEpisode( - number = doc.getIntSafe("number", 0), - ids = doc.getListSafe("ids").map { documentToAnimeSource(it) }.toMutableList(), - nextEpisodeDate = doc.getStringSafe("nextEpisodeDate") + malId = doc.getIntSafe("malId"), + title = doc.getStringSafe("title"), + titleJapanese = doc.getStringSafe("titleJapanese"), + titleRomanji = doc.getStringSafe("titleRomanji"), + aired = doc.getStringSafe("aired", ZonedDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)), + score = doc.getFloatSafe("score"), + filler = doc.getBooleanSafe("filler"), + recap = doc.getBooleanSafe("recap") ) } diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Actor.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Actor.kt index 7ce6dea..90e1d53 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Actor.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Actor.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AiringTime.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AiringTime.kt index 257395d..a0f37b4 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AiringTime.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AiringTime.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AlternativeTitles.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AlternativeTitles.kt index 524be45..1f48c3a 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AlternativeTitles.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AlternativeTitles.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeBroadcast.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeBroadcast.kt index 1e34a8c..c8d587e 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeBroadcast.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeBroadcast.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeSource.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeSource.kt index 47c7ed5..99fdd14 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeSource.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/AnimeSource.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Character.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Character.kt index 9741f91..f0f9eb8 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Character.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Character.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Companies.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Companies.kt index f6ea791..35dc3f2 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Companies.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Companies.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/ExternalLinks.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/ExternalLinks.kt index 5f1fed8..da2c3be 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/ExternalLinks.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/ExternalLinks.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/ImageMediaEntity.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/ImageMediaEntity.kt index e845b62..2c3fc63 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/ImageMediaEntity.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/ImageMediaEntity.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Individual.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Individual.kt index 22e3132..e5a4a38 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Individual.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Individual.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/MergedEpisode.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/MergedEpisode.kt index 8e672ad..0708da5 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/MergedEpisode.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/MergedEpisode.kt @@ -1,10 +1,16 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable @Serializable data class MergedEpisode( - var number: Int, - var ids: MutableList = mutableListOf(), - var nextEpisodeDate: String = "" + var malId: Int, + var title: String, + var titleJapanese: String, + var titleRomanji: String, + var aired: String, + var score: Float, + var filler: Boolean, + var recap: Boolean, ) + diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/MoreInfoEntity.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/MoreInfoEntity.kt index 606f501..a8ba132 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/MoreInfoEntity.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/MoreInfoEntity.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString @@ -7,8 +7,8 @@ import org.bson.Document @Serializable data class MoreInfoEntity( - val id: Long? = null, var malId: Int = 0, + val id: String = "", var title: String = "", var poster: String = "", var cover: String = "", diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Related.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Related.kt index d3ced56..64c441c 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Related.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Related.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Score.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Score.kt index 03209bf..2db62d2 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Score.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Score.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Staff.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Staff.kt index eddcf84..506b645 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Staff.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Staff.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Statistics.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Statistics.kt index e026a62..7f271be 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Statistics.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Statistics.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Themes.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Themes.kt index c29df06..28ba2a0 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/Themes.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/Themes.kt @@ -1,4 +1,4 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/models/anime/VideoPromo.kt b/src/main/kotlin/com/jeluchu/features/anime/models/anime/VideoPromo.kt index 0f58cc9..a6aa919 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/models/anime/VideoPromo.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/models/anime/VideoPromo.kt @@ -1,6 +1,5 @@ -package com.example.models +package com.jeluchu.features.anime.models.anime -import com.jeluchu.features.anime.models.anime.Images import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/kotlin/com/jeluchu/features/anime/routes/AnimeRoutes.kt b/src/main/kotlin/com/jeluchu/features/anime/routes/AnimeRoutes.kt index d820204..015be1f 100644 --- a/src/main/kotlin/com/jeluchu/features/anime/routes/AnimeRoutes.kt +++ b/src/main/kotlin/com/jeluchu/features/anime/routes/AnimeRoutes.kt @@ -8,8 +8,10 @@ import io.ktor.server.routing.* fun Route.animeEndpoints( mongoDatabase: MongoDatabase, - service: AnimeService = AnimeService(mongoDatabase) + service: AnimeService = AnimeService(mongoDatabase), ) { - getToJson(Routes.DIRECTORY) { service.getDirectory(call) } getToJson(Routes.ANIME_DETAILS) { service.getAnimeByMalId(call) } + route(Routes.DIRECTORY) { + getToJson { service.getDirectory(call) } + } } \ No newline at end of file diff --git a/src/main/kotlin/com/jeluchu/features/rankings/models/AnimeTopEntity.kt b/src/main/kotlin/com/jeluchu/features/rankings/models/AnimeTopEntity.kt index 4b691af..acac3ba 100644 --- a/src/main/kotlin/com/jeluchu/features/rankings/models/AnimeTopEntity.kt +++ b/src/main/kotlin/com/jeluchu/features/rankings/models/AnimeTopEntity.kt @@ -1,6 +1,6 @@ package com.jeluchu.features.rankings.models -import com.example.models.VideoPromo +import com.jeluchu.features.anime.models.anime.VideoPromo import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/kotlin/com/jeluchu/features/schedule/models/ScheduleEntity.kt b/src/main/kotlin/com/jeluchu/features/schedule/models/ScheduleEntity.kt index 6c662da..09795e5 100644 --- a/src/main/kotlin/com/jeluchu/features/schedule/models/ScheduleEntity.kt +++ b/src/main/kotlin/com/jeluchu/features/schedule/models/ScheduleEntity.kt @@ -1,7 +1,7 @@ package com.jeluchu.features.schedule.models -import com.jeluchu.core.models.jikan.search.Pagination import com.jeluchu.core.models.jikan.anime.AnimeData +import com.jeluchu.core.models.jikan.search.Pagination import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable