diff --git a/src/main/kotlin/fr/shikkanime/controllers/api/AnimeController.kt b/src/main/kotlin/fr/shikkanime/controllers/api/AnimeController.kt index f99946cf..8eb276b5 100644 --- a/src/main/kotlin/fr/shikkanime/controllers/api/AnimeController.kt +++ b/src/main/kotlin/fr/shikkanime/controllers/api/AnimeController.kt @@ -3,6 +3,7 @@ package fr.shikkanime.controllers.api import com.google.inject.Inject import fr.shikkanime.converters.AbstractConverter import fr.shikkanime.dtos.* +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.weekly.v1.WeeklyAnimesDto import fr.shikkanime.entities.enums.CountryCode diff --git a/src/main/kotlin/fr/shikkanime/controllers/api/EpisodeMappingController.kt b/src/main/kotlin/fr/shikkanime/controllers/api/EpisodeMappingController.kt index c05419df..efa4e388 100644 --- a/src/main/kotlin/fr/shikkanime/controllers/api/EpisodeMappingController.kt +++ b/src/main/kotlin/fr/shikkanime/controllers/api/EpisodeMappingController.kt @@ -3,7 +3,7 @@ package fr.shikkanime.controllers.api import com.google.inject.Inject import fr.shikkanime.converters.AbstractConverter import fr.shikkanime.dtos.PageableDto -import fr.shikkanime.dtos.UpdateAllEpisodeMappingDto +import fr.shikkanime.dtos.mappings.UpdateAllEpisodeMappingDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.mappings.EpisodeMappingDto import fr.shikkanime.dtos.variants.EpisodeVariantDto diff --git a/src/main/kotlin/fr/shikkanime/controllers/site/SEOController.kt b/src/main/kotlin/fr/shikkanime/controllers/site/SEOController.kt index 33d1733f..c433c7ff 100644 --- a/src/main/kotlin/fr/shikkanime/controllers/site/SEOController.kt +++ b/src/main/kotlin/fr/shikkanime/controllers/site/SEOController.kt @@ -4,7 +4,6 @@ import com.google.inject.Inject import fr.shikkanime.dtos.URLDto import fr.shikkanime.entities.SortParameter import fr.shikkanime.entities.enums.CountryCode -import fr.shikkanime.entities.enums.EpisodeType import fr.shikkanime.entities.enums.Link import fr.shikkanime.services.caches.EpisodeMappingCacheService import fr.shikkanime.services.caches.SimulcastCacheService @@ -61,21 +60,18 @@ class SEOController { URLDto("${Constant.baseUrl}/catalog/${it.slug}", it.lastReleaseDateTime!!) } - episodeMappingCacheService.findAllSeo()?.groupBy { it[0] as String }?.forEach { (animeSlug, episodes) -> - val seasonMap = episodes.groupBy { it[1] as Int } - val firstSeasonDateTime = seasonMap.values.flatten().maxOf { it[4] as ZonedDateTime } + episodeMappingCacheService.findAllSeo()?.groupBy { it.animeSlug }?.forEach { (animeSlug, episodes) -> + val seasonMap = episodes.groupBy { it.season } + val firstSeasonDateTime = seasonMap.values.flatten().maxOf { it.lastReleaseDateTime } urls.add(URLDto("${Constant.baseUrl}/animes/$animeSlug", firstSeasonDateTime.formatDateTime())) seasonMap.forEach { (season, seasonEpisodes) -> - val lastSeasonDateTime = seasonEpisodes.maxOf { it[4] as ZonedDateTime } + val lastSeasonDateTime = seasonEpisodes.maxOf { it.lastReleaseDateTime } urls.add(URLDto("${Constant.baseUrl}/animes/$animeSlug/season-$season", lastSeasonDateTime.formatDateTime())) seasonEpisodes.forEach { - val episodeType = it[2] as EpisodeType - val number = it[3] as Int - val episodeDateTime = it[4] as ZonedDateTime - urls.add(URLDto("${Constant.baseUrl}/animes/$animeSlug/season-$season/${episodeType.slug}-$number", episodeDateTime.formatDateTime())) + urls.add(URLDto("${Constant.baseUrl}/animes/$animeSlug/season-$season/${it.episodeType.slug}-${it.number}", it.lastReleaseDateTime.formatDateTime())) } } } diff --git a/src/main/kotlin/fr/shikkanime/controllers/site/SiteController.kt b/src/main/kotlin/fr/shikkanime/controllers/site/SiteController.kt index 755e2712..16937a1b 100644 --- a/src/main/kotlin/fr/shikkanime/controllers/site/SiteController.kt +++ b/src/main/kotlin/fr/shikkanime/controllers/site/SiteController.kt @@ -1,7 +1,7 @@ package fr.shikkanime.controllers.site import com.google.inject.Inject -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.entities.SortParameter import fr.shikkanime.entities.enums.* import fr.shikkanime.services.caches.AnimeCacheService diff --git a/src/main/kotlin/fr/shikkanime/converters/AbstractConverter.kt b/src/main/kotlin/fr/shikkanime/converters/AbstractConverter.kt index f7790aa4..c3e3f6fc 100644 --- a/src/main/kotlin/fr/shikkanime/converters/AbstractConverter.kt +++ b/src/main/kotlin/fr/shikkanime/converters/AbstractConverter.kt @@ -17,7 +17,7 @@ abstract class AbstractConverter { val converters = Constant.reflections.getSubTypesOf(AbstractConverter::class.java) converters.forEach { - val (from, to) = (it.genericSuperclass as ParameterizedType).actualTypeArguments.map { argument -> argument as Class<*> } + val (from, to) = (it.genericSuperclass as ParameterizedType).actualTypeArguments.filterIsInstance>() this.converters[Pair(from, to)] = Constant.injector.getInstance(it) } } @@ -39,10 +39,7 @@ abstract class AbstractConverter { function.isAccessible = true return try { - val invoke = function.call(abstractConverter, `object`, *args) - ?: throw NullPointerException("Can not convert null to \"${to.simpleName}\"") - check(invoke is T) { "Can not convert \"${`object`.javaClass.simpleName}\" to \"${to.simpleName}\"" } - invoke + function.call(abstractConverter, `object`, *args) as? T ?: throw NullPointerException("Can not convert null to \"${to.simpleName}\"") } catch (e: Exception) { throw IllegalStateException( "Can not convert \"${`object`.javaClass.simpleName}\" to \"${to.simpleName}\"", diff --git a/src/main/kotlin/fr/shikkanime/converters/anime/AnimeDtoToAnimeConverter.kt b/src/main/kotlin/fr/shikkanime/converters/anime/AnimeDtoToAnimeConverter.kt index aa78faf0..0db4ed5f 100644 --- a/src/main/kotlin/fr/shikkanime/converters/anime/AnimeDtoToAnimeConverter.kt +++ b/src/main/kotlin/fr/shikkanime/converters/anime/AnimeDtoToAnimeConverter.kt @@ -2,7 +2,7 @@ package fr.shikkanime.converters.anime import com.google.inject.Inject import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.entities.Anime import fr.shikkanime.entities.Simulcast import fr.shikkanime.services.AnimeService diff --git a/src/main/kotlin/fr/shikkanime/converters/anime/AnimeToAnimeDtoConverter.kt b/src/main/kotlin/fr/shikkanime/converters/anime/AnimeToAnimeDtoConverter.kt index b0f0149e..ad4985b4 100644 --- a/src/main/kotlin/fr/shikkanime/converters/anime/AnimeToAnimeDtoConverter.kt +++ b/src/main/kotlin/fr/shikkanime/converters/anime/AnimeToAnimeDtoConverter.kt @@ -2,7 +2,7 @@ package fr.shikkanime.converters.anime import com.google.inject.Inject import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.AnimePlatformDto import fr.shikkanime.dtos.SeasonDto import fr.shikkanime.dtos.SimulcastDto @@ -21,7 +21,7 @@ class AnimeToAnimeDtoConverter : AbstractConverter() { @Converter fun convert(from: Anime): AnimeDto { val (audioLocales, seasons) = animeCacheService.findAudioLocalesAndSeasonsByAnimeCache(from) - ?: Pair(emptyList(), emptyList()) + ?: Pair(emptySet(), emptyList()) return AnimeDto( uuid = from.uuid, diff --git a/src/main/kotlin/fr/shikkanime/converters/episode_mapping/EpisodeMappingToEpisodeMappingDtoConverter.kt b/src/main/kotlin/fr/shikkanime/converters/episode_mapping/EpisodeMappingToEpisodeMappingDtoConverter.kt index 0793bdff..6d0ed015 100644 --- a/src/main/kotlin/fr/shikkanime/converters/episode_mapping/EpisodeMappingToEpisodeMappingDtoConverter.kt +++ b/src/main/kotlin/fr/shikkanime/converters/episode_mapping/EpisodeMappingToEpisodeMappingDtoConverter.kt @@ -2,7 +2,7 @@ package fr.shikkanime.converters.episode_mapping import com.google.inject.Inject import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.PlatformDto import fr.shikkanime.dtos.mappings.EpisodeMappingDto import fr.shikkanime.dtos.variants.EpisodeVariantWithoutMappingDto diff --git a/src/main/kotlin/fr/shikkanime/converters/member/MemberToRefreshMemberDtoConverter.kt b/src/main/kotlin/fr/shikkanime/converters/member/MemberToRefreshMemberDtoConverter.kt index 97c5ab40..9f0c556c 100644 --- a/src/main/kotlin/fr/shikkanime/converters/member/MemberToRefreshMemberDtoConverter.kt +++ b/src/main/kotlin/fr/shikkanime/converters/member/MemberToRefreshMemberDtoConverter.kt @@ -2,8 +2,8 @@ package fr.shikkanime.converters.member import com.google.inject.Inject import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto -import fr.shikkanime.dtos.MissedAnimeDto +import fr.shikkanime.dtos.animes.AnimeDto +import fr.shikkanime.dtos.animes.MissedAnimeDto import fr.shikkanime.dtos.PageableDto import fr.shikkanime.dtos.mappings.EpisodeMappingDto import fr.shikkanime.dtos.member.RefreshMemberDto diff --git a/src/main/kotlin/fr/shikkanime/dtos/CalendarEpisodeDto.kt b/src/main/kotlin/fr/shikkanime/dtos/CalendarEpisodeDto.kt deleted file mode 100644 index e646f007..00000000 --- a/src/main/kotlin/fr/shikkanime/dtos/CalendarEpisodeDto.kt +++ /dev/null @@ -1,8 +0,0 @@ -package fr.shikkanime.dtos - -data class CalendarEpisodeDto( - val anime: String, - val season: Int = 1, - val episode: String, - val platform: String -) diff --git a/src/main/kotlin/fr/shikkanime/dtos/animes/AnimeAudioLocalesSeasonsDto.kt b/src/main/kotlin/fr/shikkanime/dtos/animes/AnimeAudioLocalesSeasonsDto.kt new file mode 100644 index 00000000..2798c95f --- /dev/null +++ b/src/main/kotlin/fr/shikkanime/dtos/animes/AnimeAudioLocalesSeasonsDto.kt @@ -0,0 +1,11 @@ +package fr.shikkanime.dtos.animes + +import java.time.ZonedDateTime +import java.util.UUID + +data class AnimeAudioLocalesSeasonsDto( + val animeUuid: UUID, + val audioLocale: String, + val season: Int, + val lastReleaseDateTime: ZonedDateTime, +) \ No newline at end of file diff --git a/src/main/kotlin/fr/shikkanime/dtos/AnimeDto.kt b/src/main/kotlin/fr/shikkanime/dtos/animes/AnimeDto.kt similarity index 81% rename from src/main/kotlin/fr/shikkanime/dtos/AnimeDto.kt rename to src/main/kotlin/fr/shikkanime/dtos/animes/AnimeDto.kt index ebe73c5f..22d49e5b 100644 --- a/src/main/kotlin/fr/shikkanime/dtos/AnimeDto.kt +++ b/src/main/kotlin/fr/shikkanime/dtos/animes/AnimeDto.kt @@ -1,5 +1,8 @@ -package fr.shikkanime.dtos +package fr.shikkanime.dtos.animes +import fr.shikkanime.dtos.AnimePlatformDto +import fr.shikkanime.dtos.SeasonDto +import fr.shikkanime.dtos.SimulcastDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.mappings.EpisodeMappingWithoutAnimeDto import fr.shikkanime.entities.enums.CountryCode @@ -19,7 +22,7 @@ data class AnimeDto( val banner: String, val description: String? = null, val simulcasts: List? = null, - var audioLocales: List? = null, + var audioLocales: Set? = null, var langTypes: List? = null, var seasons: List? = null, var episodes: List? = null, diff --git a/src/main/kotlin/fr/shikkanime/dtos/MissedAnimeDto.kt b/src/main/kotlin/fr/shikkanime/dtos/animes/MissedAnimeDto.kt similarity index 71% rename from src/main/kotlin/fr/shikkanime/dtos/MissedAnimeDto.kt rename to src/main/kotlin/fr/shikkanime/dtos/animes/MissedAnimeDto.kt index b8438ccd..923e0956 100644 --- a/src/main/kotlin/fr/shikkanime/dtos/MissedAnimeDto.kt +++ b/src/main/kotlin/fr/shikkanime/dtos/animes/MissedAnimeDto.kt @@ -1,4 +1,4 @@ -package fr.shikkanime.dtos +package fr.shikkanime.dtos.animes data class MissedAnimeDto( val anime: AnimeDto, diff --git a/src/main/kotlin/fr/shikkanime/dtos/mappings/EpisodeMappingDto.kt b/src/main/kotlin/fr/shikkanime/dtos/mappings/EpisodeMappingDto.kt index c30ab0cc..e1d29110 100644 --- a/src/main/kotlin/fr/shikkanime/dtos/mappings/EpisodeMappingDto.kt +++ b/src/main/kotlin/fr/shikkanime/dtos/mappings/EpisodeMappingDto.kt @@ -1,6 +1,6 @@ package fr.shikkanime.dtos.mappings -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.PlatformDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.variants.EpisodeVariantWithoutMappingDto diff --git a/src/main/kotlin/fr/shikkanime/dtos/mappings/EpisodeMappingSeoDto.kt b/src/main/kotlin/fr/shikkanime/dtos/mappings/EpisodeMappingSeoDto.kt new file mode 100644 index 00000000..e40d0a6b --- /dev/null +++ b/src/main/kotlin/fr/shikkanime/dtos/mappings/EpisodeMappingSeoDto.kt @@ -0,0 +1,12 @@ +package fr.shikkanime.dtos.mappings + +import fr.shikkanime.entities.enums.EpisodeType +import java.time.ZonedDateTime + +data class EpisodeMappingSeoDto( + val animeSlug: String, + val season: Int, + val episodeType: EpisodeType, + val number: Int, + val lastReleaseDateTime: ZonedDateTime +) diff --git a/src/main/kotlin/fr/shikkanime/dtos/UpdateAllEpisodeMappingDto.kt b/src/main/kotlin/fr/shikkanime/dtos/mappings/UpdateAllEpisodeMappingDto.kt similarity index 77% rename from src/main/kotlin/fr/shikkanime/dtos/UpdateAllEpisodeMappingDto.kt rename to src/main/kotlin/fr/shikkanime/dtos/mappings/UpdateAllEpisodeMappingDto.kt index 02250dbe..1d53f075 100644 --- a/src/main/kotlin/fr/shikkanime/dtos/UpdateAllEpisodeMappingDto.kt +++ b/src/main/kotlin/fr/shikkanime/dtos/mappings/UpdateAllEpisodeMappingDto.kt @@ -1,11 +1,11 @@ -package fr.shikkanime.dtos +package fr.shikkanime.dtos.mappings import fr.shikkanime.entities.enums.EpisodeType -import java.util.* +import java.util.UUID data class UpdateAllEpisodeMappingDto( val uuids: List, val episodeType: EpisodeType?, val season: Int?, val forceUpdate: Boolean? -) +) \ No newline at end of file diff --git a/src/main/kotlin/fr/shikkanime/dtos/member/RefreshMemberDto.kt b/src/main/kotlin/fr/shikkanime/dtos/member/RefreshMemberDto.kt index 8fc8a33f..60e942c8 100644 --- a/src/main/kotlin/fr/shikkanime/dtos/member/RefreshMemberDto.kt +++ b/src/main/kotlin/fr/shikkanime/dtos/member/RefreshMemberDto.kt @@ -1,7 +1,7 @@ package fr.shikkanime.dtos.member -import fr.shikkanime.dtos.AnimeDto -import fr.shikkanime.dtos.MissedAnimeDto +import fr.shikkanime.dtos.animes.AnimeDto +import fr.shikkanime.dtos.animes.MissedAnimeDto import fr.shikkanime.dtos.PageableDto import fr.shikkanime.dtos.mappings.EpisodeMappingDto diff --git a/src/main/kotlin/fr/shikkanime/dtos/variants/EpisodeVariantIdentifierDto.kt b/src/main/kotlin/fr/shikkanime/dtos/variants/EpisodeVariantIdentifierDto.kt new file mode 100644 index 00000000..e659422b --- /dev/null +++ b/src/main/kotlin/fr/shikkanime/dtos/variants/EpisodeVariantIdentifierDto.kt @@ -0,0 +1,17 @@ +package fr.shikkanime.dtos.variants + +import fr.shikkanime.entities.enums.CountryCode +import fr.shikkanime.entities.enums.EpisodeType +import fr.shikkanime.entities.enums.Platform +import java.util.UUID + +data class EpisodeVariantIdentifierDto( + val countryCode: CountryCode, + val animeUuid: UUID, + val platform: Platform, + val season: Int, + val episodeType: EpisodeType, + val number: Int, + val audioLocale: String, + val identifier: String, +) diff --git a/src/main/kotlin/fr/shikkanime/dtos/variants/VariantReleaseDto.kt b/src/main/kotlin/fr/shikkanime/dtos/variants/VariantReleaseDto.kt new file mode 100644 index 00000000..b7c3b547 --- /dev/null +++ b/src/main/kotlin/fr/shikkanime/dtos/variants/VariantReleaseDto.kt @@ -0,0 +1,14 @@ +package fr.shikkanime.dtos.variants + +import fr.shikkanime.entities.Anime +import fr.shikkanime.entities.EpisodeMapping +import fr.shikkanime.entities.enums.Platform +import java.time.ZonedDateTime + +data class VariantReleaseDto( + val anime: Anime, + val episodeMapping: EpisodeMapping, + val releaseDateTime: ZonedDateTime, + val platform: Platform, + val audioLocale: String, +) diff --git a/src/main/kotlin/fr/shikkanime/dtos/weekly/v1/WeeklyAnimeDto.kt b/src/main/kotlin/fr/shikkanime/dtos/weekly/v1/WeeklyAnimeDto.kt index 711d68c1..c17df7c8 100644 --- a/src/main/kotlin/fr/shikkanime/dtos/weekly/v1/WeeklyAnimeDto.kt +++ b/src/main/kotlin/fr/shikkanime/dtos/weekly/v1/WeeklyAnimeDto.kt @@ -1,6 +1,6 @@ package fr.shikkanime.dtos.weekly.v1 -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.PlatformDto import fr.shikkanime.dtos.mappings.EpisodeMappingWithoutAnimeDto import fr.shikkanime.entities.enums.EpisodeType diff --git a/src/main/kotlin/fr/shikkanime/dtos/weekly/v2/WeeklyAnimeDto.kt b/src/main/kotlin/fr/shikkanime/dtos/weekly/v2/WeeklyAnimeDto.kt index 9d334770..b7e69139 100644 --- a/src/main/kotlin/fr/shikkanime/dtos/weekly/v2/WeeklyAnimeDto.kt +++ b/src/main/kotlin/fr/shikkanime/dtos/weekly/v2/WeeklyAnimeDto.kt @@ -1,6 +1,6 @@ package fr.shikkanime.dtos.weekly.v2 -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.PlatformDto import fr.shikkanime.dtos.mappings.EpisodeMappingWithoutAnimeDto import fr.shikkanime.entities.enums.EpisodeType diff --git a/src/main/kotlin/fr/shikkanime/jobs/FetchEpisodesJob.kt b/src/main/kotlin/fr/shikkanime/jobs/FetchEpisodesJob.kt index 223e7f0d..9169eb6f 100644 --- a/src/main/kotlin/fr/shikkanime/jobs/FetchEpisodesJob.kt +++ b/src/main/kotlin/fr/shikkanime/jobs/FetchEpisodesJob.kt @@ -2,6 +2,7 @@ package fr.shikkanime.jobs import fr.shikkanime.converters.AbstractConverter import fr.shikkanime.dtos.variants.EpisodeVariantDto +import fr.shikkanime.dtos.variants.EpisodeVariantIdentifierDto import fr.shikkanime.entities.Anime import fr.shikkanime.entities.EpisodeMapping import fr.shikkanime.entities.EpisodeVariant @@ -12,10 +13,8 @@ import fr.shikkanime.services.MediaImage import fr.shikkanime.services.caches.ConfigCacheService import fr.shikkanime.utils.* import jakarta.inject.Inject -import jakarta.persistence.Tuple import java.io.ByteArrayOutputStream import java.time.ZonedDateTime -import java.util.* import java.util.logging.Level import javax.imageio.ImageIO @@ -52,20 +51,18 @@ class FetchEpisodesJob : AbstractJob { if (!isInitialized) { val variants = episodeVariantService.findAllTypeIdentifier() - val elements = variants.map { it[7] as String }.toSet() - identifiers.addAll(elements) + identifiers.addAll(variants.map { it.identifier }) Constant.abstractPlatforms.forEach { it.hashCache.addAll( - variants.filter { variant -> (variant[2] as Platform) == it.getPlatform() } + variants.filter { variant -> variant.platform == it.getPlatform() } .map { variant -> - ".{2}-.{4}-(.*)-.{2}-.{2}".toRegex().find(variant[7] as String)!!.groupValues[1] + ".{2}-.{4}-(.*)-.{2}-.{2}".toRegex().find(variant.identifier)!!.groupValues[1] } ) } variants.forEach { typeIdentifiers.add(getTypeIdentifier(it)) } - isInitialized = true } @@ -111,40 +108,25 @@ class FetchEpisodesJob : AbstractJob { sendToNetworks(savedEpisodes) } - data class TypeIdentifier( - val country: CountryCode, - val anime: UUID, - val season: Int, - val episodeType: EpisodeType, - val number: Int, - val audioLocale: String - ) - private fun getTypeIdentifier(input: Any): String { - val (country, anime, season, episodeType, number, audioLocale) = when (input) { - is Tuple -> TypeIdentifier( - input[0] as CountryCode, - input[1] as UUID, - input[4] as Int, - input[3] as EpisodeType, - input[5] as Int, - input[6] as String - ) - - is EpisodeVariant -> TypeIdentifier( + val episodeVariantIdentifierDto = when (input) { + is EpisodeVariantIdentifierDto -> input + is EpisodeVariant -> EpisodeVariantIdentifierDto( input.mapping!!.anime!!.countryCode!!, input.mapping!!.anime!!.uuid!!, + input.platform!!, input.mapping!!.season!!, input.mapping!!.episodeType!!, input.mapping!!.number!!, - input.audioLocale!! + input.audioLocale!!, + input.identifier!! ) else -> throw IllegalArgumentException("Invalid input type") } - val langType = LangType.fromAudioLocale(country, audioLocale) - return "${country}_${anime}_${season}_${episodeType}_${number}_${langType}" + val langType = LangType.fromAudioLocale(episodeVariantIdentifierDto.countryCode, episodeVariantIdentifierDto.audioLocale) + return "${episodeVariantIdentifierDto.countryCode}_${episodeVariantIdentifierDto.animeUuid}_${episodeVariantIdentifierDto.season}_${episodeVariantIdentifierDto.episodeType}_${episodeVariantIdentifierDto.number}_${langType}" } private fun sendToNetworks(savedEpisodes: List) { diff --git a/src/main/kotlin/fr/shikkanime/modules/SEOManager.kt b/src/main/kotlin/fr/shikkanime/modules/SEOManager.kt index 5947c09c..2f977287 100644 --- a/src/main/kotlin/fr/shikkanime/modules/SEOManager.kt +++ b/src/main/kotlin/fr/shikkanime/modules/SEOManager.kt @@ -1,6 +1,6 @@ package fr.shikkanime.modules -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.mappings.EpisodeMappingDto import fr.shikkanime.entities.LinkObject import fr.shikkanime.entities.enums.ConfigPropertyKey diff --git a/src/main/kotlin/fr/shikkanime/repositories/AbstractRepository.kt b/src/main/kotlin/fr/shikkanime/repositories/AbstractRepository.kt index 25ff8799..4ef3803c 100644 --- a/src/main/kotlin/fr/shikkanime/repositories/AbstractRepository.kt +++ b/src/main/kotlin/fr/shikkanime/repositories/AbstractRepository.kt @@ -53,9 +53,8 @@ abstract class AbstractRepository { var total = 0L if (scrollableResults.first() && scrollableResults.scroll((limit * page) - limit)) { - (0 until limit).forEach { - val get = scrollableResults.get() ?: return@forEach - require(get is C) { "Entity is not of type C" } + (0 until limit).forEach { _ -> + val get = scrollableResults.get() as? C ?: return@forEach list.add(get) if (!scrollableResults.next()) return@forEach } @@ -109,7 +108,11 @@ abstract class AbstractRepository { fun deleteAll() { inTransaction { - it.createQuery("DELETE FROM ${getEntityClass().simpleName}").executeUpdate() + val cb = it.criteriaBuilder + val query = cb.createCriteriaDelete(getEntityClass()) + query.from(getEntityClass()) + + it.createQuery(query).executeUpdate() } } } \ No newline at end of file diff --git a/src/main/kotlin/fr/shikkanime/repositories/AnimeRepository.kt b/src/main/kotlin/fr/shikkanime/repositories/AnimeRepository.kt index 346aae93..766e6c42 100644 --- a/src/main/kotlin/fr/shikkanime/repositories/AnimeRepository.kt +++ b/src/main/kotlin/fr/shikkanime/repositories/AnimeRepository.kt @@ -1,5 +1,6 @@ package fr.shikkanime.repositories +import fr.shikkanime.dtos.animes.AnimeAudioLocalesSeasonsDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.entities.* import fr.shikkanime.entities.enums.CountryCode @@ -51,8 +52,6 @@ class AnimeRepository : AbstractRepository() { ) val orders = sort.mapNotNull { sortParameter -> - val order = if (sortParameter.order == SortParameter.Order.ASC) cb::asc else cb::desc - val field = when (sortParameter.field) { "name" -> root[Anime_.name] "releaseDateTime" -> root[Anime_.releaseDateTime] @@ -60,7 +59,7 @@ class AnimeRepository : AbstractRepository() { else -> null } - field?.let { order(it) } + field?.let { (if (sortParameter.order == SortParameter.Order.ASC) cb::asc else cb::desc).invoke(it) } } query.orderBy(orders) @@ -224,17 +223,20 @@ class AnimeRepository : AbstractRepository() { } } - fun findAllAudioLocalesAndSeasons(): Map, List>>> { + fun findAllAudioLocalesAndSeasons(): Map, List>>> { return database.entityManager.use { em -> val cb = em.criteriaBuilder - val query = cb.createTupleQuery() + val query = cb.createQuery(AnimeAudioLocalesSeasonsDto::class.java) val root = query.from(EpisodeVariant::class.java) - query.multiselect( - root[EpisodeVariant_.mapping][EpisodeMapping_.anime][Anime_.uuid], - root[EpisodeVariant_.audioLocale], - root[EpisodeVariant_.mapping][EpisodeMapping_.season], - cb.greatest(root[EpisodeVariant_.mapping][EpisodeMapping_.lastReleaseDateTime]) + query.select( + cb.construct( + AnimeAudioLocalesSeasonsDto::class.java, + root[EpisodeVariant_.mapping][EpisodeMapping_.anime][Anime_.uuid], + root[EpisodeVariant_.audioLocale], + root[EpisodeVariant_.mapping][EpisodeMapping_.season], + cb.greatest(root[EpisodeVariant_.mapping][EpisodeMapping_.lastReleaseDateTime]) + ) ) query.groupBy( @@ -247,18 +249,18 @@ class AnimeRepository : AbstractRepository() { createReadOnlyQuery(em, query) .resultList - .groupBy { tuple -> tuple[0] as UUID } + .groupBy { it.animeUuid } .mapValues { (_, results) -> // Process results val audioLocales = mutableSetOf() val seasons = mutableListOf>() - results.forEach { tuple -> - audioLocales.add(tuple[1] as String) - seasons.add(tuple[2] as Int to tuple[3] as ZonedDateTime) + results.forEach { + audioLocales.add(it.audioLocale) + seasons.add(it.season to it.lastReleaseDateTime) } - Pair(audioLocales.toList(), seasons.distinctBy { it.first }) + Pair(audioLocales, seasons.distinctBy { it.first }) } } } diff --git a/src/main/kotlin/fr/shikkanime/repositories/EpisodeMappingRepository.kt b/src/main/kotlin/fr/shikkanime/repositories/EpisodeMappingRepository.kt index 99709509..043acd19 100644 --- a/src/main/kotlin/fr/shikkanime/repositories/EpisodeMappingRepository.kt +++ b/src/main/kotlin/fr/shikkanime/repositories/EpisodeMappingRepository.kt @@ -1,6 +1,7 @@ package fr.shikkanime.repositories import fr.shikkanime.dtos.enums.Status +import fr.shikkanime.dtos.mappings.EpisodeMappingSeoDto import fr.shikkanime.entities.* import fr.shikkanime.entities.enums.CountryCode import fr.shikkanime.entities.enums.EpisodeType @@ -36,7 +37,6 @@ class EpisodeMappingRepository : AbstractRepository() { query.where(*predicates.toTypedArray()) val orders = sort.mapNotNull { sortParameter -> - val order = if (sortParameter.order == SortParameter.Order.ASC) cb::asc else cb::desc val field = when (sortParameter.field) { "episodeType" -> root[EpisodeMapping_.episodeType] @@ -48,7 +48,7 @@ class EpisodeMappingRepository : AbstractRepository() { else -> null } - field?.let { order(it) } + field?.let { (if (sortParameter.order == SortParameter.Order.ASC) cb::asc else cb::desc).invoke(it) } } query.orderBy(orders) @@ -106,18 +106,21 @@ class EpisodeMappingRepository : AbstractRepository() { } } - fun findAllSeo(): List { + fun findAllSeo(): List { return database.entityManager.use { val cb = it.criteriaBuilder - val query = cb.createTupleQuery() + val query = cb.createQuery(EpisodeMappingSeoDto::class.java) val root = query.from(getEntityClass()) - query.multiselect( - root[EpisodeMapping_.anime][Anime_.slug], - root[EpisodeMapping_.season], - root[EpisodeMapping_.episodeType], - root[EpisodeMapping_.number], - root[EpisodeMapping_.lastReleaseDateTime], + query.select( + cb.construct( + EpisodeMappingSeoDto::class.java, + root[EpisodeMapping_.anime][Anime_.slug], + root[EpisodeMapping_.season], + root[EpisodeMapping_.episodeType], + root[EpisodeMapping_.number], + root[EpisodeMapping_.lastReleaseDateTime], + ) ) query.orderBy(cb.asc(root[EpisodeMapping_.releaseDateTime])) diff --git a/src/main/kotlin/fr/shikkanime/repositories/EpisodeVariantRepository.kt b/src/main/kotlin/fr/shikkanime/repositories/EpisodeVariantRepository.kt index a838b60b..9c931181 100644 --- a/src/main/kotlin/fr/shikkanime/repositories/EpisodeVariantRepository.kt +++ b/src/main/kotlin/fr/shikkanime/repositories/EpisodeVariantRepository.kt @@ -1,10 +1,11 @@ package fr.shikkanime.repositories +import fr.shikkanime.dtos.variants.EpisodeVariantIdentifierDto +import fr.shikkanime.dtos.variants.VariantReleaseDto import fr.shikkanime.entities.* import fr.shikkanime.entities.enums.CountryCode import fr.shikkanime.entities.enums.EpisodeType import fr.shikkanime.entities.enums.Platform -import jakarta.persistence.Tuple import jakarta.persistence.criteria.JoinType import java.time.ZonedDateTime import java.util.* @@ -29,19 +30,22 @@ class EpisodeVariantRepository : AbstractRepository() { member: Member?, start: ZonedDateTime, end: ZonedDateTime, - ): List { + ): List { return database.entityManager.use { entityManager -> val cb = entityManager.criteriaBuilder - val query = cb.createTupleQuery() + val query = cb.createQuery(VariantReleaseDto::class.java) val root = query.from(getEntityClass()) - query.multiselect( + query.select( + cb.construct( + VariantReleaseDto::class.java, root[EpisodeVariant_.mapping][EpisodeMapping_.anime], root[EpisodeVariant_.mapping], root[EpisodeVariant_.releaseDateTime], root[EpisodeVariant_.platform], root[EpisodeVariant_.audioLocale], ) + ) val countryPredicate = cb.equal(root[EpisodeVariant_.mapping][EpisodeMapping_.anime][Anime_.countryCode], countryCode) val datePredicate = cb.between(root[EpisodeVariant_.releaseDateTime], start, end) @@ -121,24 +125,27 @@ class EpisodeVariantRepository : AbstractRepository() { } } - fun findAllTypeIdentifier(): List { + fun findAllTypeIdentifier(): List { return database.entityManager.use { val cb = it.criteriaBuilder - val query = cb.createTupleQuery() + val query = cb.createQuery(EpisodeVariantIdentifierDto::class.java) val root = query.from(getEntityClass()) val episodeMappingPath = root[EpisodeVariant_.mapping] val animePath = episodeMappingPath[EpisodeMapping_.anime] - query.multiselect( - animePath[Anime_.countryCode], - animePath[Anime_.uuid], - root[EpisodeVariant_.platform], - episodeMappingPath[EpisodeMapping_.episodeType], - episodeMappingPath[EpisodeMapping_.season], - episodeMappingPath[EpisodeMapping_.number], - root[EpisodeVariant_.audioLocale], - root[EpisodeVariant_.identifier] + query.select( + cb.construct( + EpisodeVariantIdentifierDto::class.java, + animePath[Anime_.countryCode], + animePath[Anime_.uuid], + root[EpisodeVariant_.platform], + episodeMappingPath[EpisodeMapping_.season], + episodeMappingPath[EpisodeMapping_.episodeType], + episodeMappingPath[EpisodeMapping_.number], + root[EpisodeVariant_.audioLocale], + root[EpisodeVariant_.identifier] + ) ) createReadOnlyQuery(it, query) diff --git a/src/main/kotlin/fr/shikkanime/services/AnimeService.kt b/src/main/kotlin/fr/shikkanime/services/AnimeService.kt index 91464adb..5c906a15 100644 --- a/src/main/kotlin/fr/shikkanime/services/AnimeService.kt +++ b/src/main/kotlin/fr/shikkanime/services/AnimeService.kt @@ -2,21 +2,20 @@ package fr.shikkanime.services import com.google.inject.Inject import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.PlatformDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.mappings.EpisodeMappingWithoutAnimeDto +import fr.shikkanime.dtos.variants.VariantReleaseDto import fr.shikkanime.dtos.weekly.v1.WeeklyAnimeDto import fr.shikkanime.dtos.weekly.v1.WeeklyAnimesDto import fr.shikkanime.entities.* import fr.shikkanime.entities.enums.CountryCode import fr.shikkanime.entities.enums.EpisodeType import fr.shikkanime.entities.enums.LangType -import fr.shikkanime.entities.enums.Platform import fr.shikkanime.repositories.AnimeRepository import fr.shikkanime.utils.* import fr.shikkanime.utils.StringUtils.capitalizeWords -import jakarta.persistence.Tuple import java.time.LocalDate import java.time.ZoneId import java.time.ZonedDateTime @@ -93,12 +92,7 @@ class AnimeService : AbstractService() { fun getWeeklyAnimes(countryCode: CountryCode, member: Member?, startOfWeekDay: LocalDate): List { val zoneId = ZoneId.of(countryCode.timezone) - val startOfPreviousWeek = startOfWeekDay.minusWeeks(1).atStartOfDay(zoneId) - val endOfWeek = startOfWeekDay.atEndOfWeek().atEndOfTheDay(zoneId) - - val tuples = episodeVariantService.findAllAnimeEpisodeMappingReleaseDateTimePlatformAudioLocaleByDateRange( - countryCode, member, startOfPreviousWeek, endOfWeek - ) + val variantReleaseDtos = fetchEpisodeTuples(countryCode, member, startOfWeekDay, zoneId) val dateFormatter = DateTimeFormatter.ofPattern("EEEE", Locale.forLanguageTag(countryCode.locale)) val currentWeek = startOfWeekDay[ChronoField.ALIGNED_WEEK_OF_YEAR] @@ -106,27 +100,29 @@ class AnimeService : AbstractService() { return (0..6).map { dayOffset -> val date = startOfWeekDay.plusDays(dayOffset.toLong()) val zonedDate = date.atStartOfDay(zoneId) - val tuplesDay = tuples.filter { (it[2] as ZonedDateTime).withZoneSameInstant(zoneId).dayOfWeek == zonedDate.dayOfWeek } + val variantReleasesDay = variantReleaseDtos.filter { it.releaseDateTime.withZoneSameInstant(zoneId).dayOfWeek == zonedDate.dayOfWeek } WeeklyAnimesDto( date.format(dateFormatter).capitalizeWords(), - tuplesDay.groupBy { triple -> - val anime = triple[0] as Anime - anime to LangType.fromAudioLocale(anime.countryCode!!, triple[4] as String) + variantReleasesDay.groupBy { variantReleaseDto -> + variantReleaseDto.anime to LangType.fromAudioLocale(variantReleaseDto.anime.countryCode!!, variantReleaseDto.audioLocale) }.flatMap { (pair, values) -> val (anime, langType) = pair - val releaseDateTime = values.maxOf { it[2] as ZonedDateTime } + val releaseDateTime = values.maxOf(VariantReleaseDto::releaseDateTime) - val mappings = values.filter { - (it[2] as ZonedDateTime).withZoneSameInstant(zoneId)[ChronoField.ALIGNED_WEEK_OF_YEAR] == currentWeek - }.map { it[1] as EpisodeMapping } + val mappings = values.asSequence() + .filter { it.releaseDateTime.withZoneSameInstant(zoneId)[ChronoField.ALIGNED_WEEK_OF_YEAR] == currentWeek } + .map { it.episodeMapping } .distinctBy { it.uuid } .sortedWith(compareBy({ it.releaseDateTime }, { it.season }, { it.episodeType }, { it.number })) + .toList() - mappings.groupBy { it.episodeType }.ifEmpty { mapOf(null to mappings) }.map { (episodeType, episodeMappings) -> + mappings.groupBy { it.episodeType } + .ifEmpty { mapOf(null to mappings) } + .map { (episodeType, episodeMappings) -> WeeklyAnimeDto( AbstractConverter.convert(anime, AnimeDto::class.java), - AbstractConverter.convert(values.mapNotNull { it[3] as? Platform }.distinct(), PlatformDto::class.java)!!, + AbstractConverter.convert(values.map { it.platform }.distinct(), PlatformDto::class.java)!!, releaseDateTime.withUTCString(), buildString { append("/animes/${anime.slug}") @@ -163,8 +159,8 @@ class AnimeService : AbstractService() { val dateFormatter = DateTimeFormatter.ofPattern("EEEE", Locale.forLanguageTag(countryCode.locale)) val currentWeek = startOfWeekDay[ChronoField.ALIGNED_WEEK_OF_YEAR] - val tuples = fetchEpisodeTuples(countryCode, member, startOfWeekDay, zoneId) - val releases = processReleases(tuples, zoneId, currentWeek) + val variantReleaseDtos = fetchEpisodeTuples(countryCode, member, startOfWeekDay, zoneId) + val releases = processReleases(variantReleaseDtos, zoneId, currentWeek) releases.removeIf { hasCurrentWeekRelease(it, releases, currentWeek) } @@ -176,30 +172,27 @@ class AnimeService : AbstractService() { member: Member?, startOfWeekDay: LocalDate, zoneId: ZoneId - ): List { - val startOfPreviousWeek = startOfWeekDay.minusWeeks(1).atStartOfDay(zoneId) - val endOfWeek = startOfWeekDay.atEndOfWeek().atEndOfTheDay(zoneId) - return episodeVariantService.findAllAnimeEpisodeMappingReleaseDateTimePlatformAudioLocaleByDateRange( - countryCode, member, startOfPreviousWeek, endOfWeek - ) - } + ) = episodeVariantService.findAllAnimeEpisodeMappingReleaseDateTimePlatformAudioLocaleByDateRange( + countryCode, + member, + startOfWeekDay.minusWeeks(1).atStartOfDay(zoneId), + startOfWeekDay.atEndOfWeek().atEndOfTheDay(zoneId) + ) private fun processReleases( - tuples: List, + variantReleaseDtos: List, zoneId: ZoneId, currentWeek: Int ): MutableSet { - val isCurrentWeek: (Tuple) -> Boolean = { tuple -> - (tuple[2] as ZonedDateTime).withZoneSameInstant(zoneId)[ChronoField.ALIGNED_WEEK_OF_YEAR] == currentWeek + val isCurrentWeek: (VariantReleaseDto) -> Boolean = { variantReleaseDto -> + variantReleaseDto.releaseDateTime.withZoneSameInstant(zoneId)[ChronoField.ALIGNED_WEEK_OF_YEAR] == currentWeek } - return tuples.groupBy { tuple -> - val releaseDateTime = tuple[2] as ZonedDateTime - val anime = tuple[0] as Anime - releaseDateTime.format(DateTimeFormatter.ofPattern("EEEE")) to anime + return variantReleaseDtos.groupBy { variantReleaseDto -> + variantReleaseDto.releaseDateTime.format(DateTimeFormatter.ofPattern("EEEE")) to variantReleaseDto.anime }.flatMap { (pair, values) -> - values.groupBy { tuple -> - (tuple[2] as ZonedDateTime).format(DateTimeFormatter.ofPattern("HH")) + values.groupBy { variantReleaseDto -> + variantReleaseDto.releaseDateTime.format(DateTimeFormatter.ofPattern("HH")) }.flatMap { (_, hourValues) -> val filter = hourValues.filter(isCurrentWeek) createWeeklyAnimeDtos(filter, hourValues, pair) @@ -208,13 +201,15 @@ class AnimeService : AbstractService() { } private fun createWeeklyAnimeDtos( - filter: List, - hourValues: List, + filter: List, + hourValues: List, pair: Pair ): List { - val mappings = filter.map { it[1] as EpisodeMapping } + val mappings = filter.asSequence() + .map { it.episodeMapping } .distinctBy { it.uuid } .sortedWith(compareBy({ it.releaseDateTime }, { it.season }, { it.episodeType }, { it.number })) + .toList() return mappings.groupBy { it.episodeType } .ifEmpty { mapOf(null to mappings) } @@ -224,21 +219,23 @@ class AnimeService : AbstractService() { } private fun createWeeklyAnimeDto( - filter: List, - hourValues: List, + filter: List, + hourValues: List, pair: Pair, episodeType: EpisodeType?, episodeMappings: List ): fr.shikkanime.dtos.weekly.v2.WeeklyAnimeDto { - val platforms = filter.mapNotNull { it[3] as? Platform }.distinct() - .ifEmpty { hourValues.mapNotNull { it[3] as? Platform }.distinct() } - val releaseDateTime = filter.minOfOrNull { it[2] as ZonedDateTime } ?: hourValues.minOf { it[2] as ZonedDateTime } - val langTypes = - filter.map { LangType.fromAudioLocale(pair.second.countryCode!!, it[4] as String) }.distinct().sorted() - .ifEmpty { - hourValues.map { LangType.fromAudioLocale(pair.second.countryCode!!, it[4] as String) }.distinct() - .sorted() - } + val platforms = filter.map { it.platform }.distinct().ifEmpty { hourValues.map { it.platform }.distinct() } + val releaseDateTime = filter.minOfOrNull { it.releaseDateTime } ?: hourValues.minOf { it.releaseDateTime } + val langTypes = filter.map { + LangType.fromAudioLocale(pair.second.countryCode!!, it.audioLocale) } + .distinct() + .sorted() + .ifEmpty { + hourValues.map { LangType.fromAudioLocale(pair.second.countryCode!!, it.audioLocale) } + .distinct() + .sorted() + } return fr.shikkanime.dtos.weekly.v2.WeeklyAnimeDto( AbstractConverter.convert(pair.second, AnimeDto::class.java), diff --git a/src/main/kotlin/fr/shikkanime/services/EpisodeMappingService.kt b/src/main/kotlin/fr/shikkanime/services/EpisodeMappingService.kt index 3651d1e4..d4c9991a 100644 --- a/src/main/kotlin/fr/shikkanime/services/EpisodeMappingService.kt +++ b/src/main/kotlin/fr/shikkanime/services/EpisodeMappingService.kt @@ -1,7 +1,7 @@ package fr.shikkanime.services import com.google.inject.Inject -import fr.shikkanime.dtos.UpdateAllEpisodeMappingDto +import fr.shikkanime.dtos.mappings.UpdateAllEpisodeMappingDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.mappings.EpisodeMappingDto import fr.shikkanime.entities.* diff --git a/src/main/kotlin/fr/shikkanime/services/caches/AnimeCacheService.kt b/src/main/kotlin/fr/shikkanime/services/caches/AnimeCacheService.kt index 53571c60..178ade7c 100644 --- a/src/main/kotlin/fr/shikkanime/services/caches/AnimeCacheService.kt +++ b/src/main/kotlin/fr/shikkanime/services/caches/AnimeCacheService.kt @@ -6,7 +6,7 @@ import fr.shikkanime.caches.CountryCodeLocalDateKeyCache import fr.shikkanime.caches.CountryCodeNamePaginationKeyCache import fr.shikkanime.caches.CountryCodeUUIDSortPaginationKeyCache import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.PageableDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.weekly.v1.WeeklyAnimesDto @@ -102,7 +102,7 @@ class AnimeCacheService : AbstractCacheService { } private val findAllAudioLocalesAndSeasonsCache = - MapCache, List>>>>( + MapCache, List>>>>( classes = listOf( Anime::class.java, EpisodeMapping::class.java, diff --git a/src/main/kotlin/fr/shikkanime/services/caches/EpisodeMappingCacheService.kt b/src/main/kotlin/fr/shikkanime/services/caches/EpisodeMappingCacheService.kt index 2738a88e..15fe9229 100644 --- a/src/main/kotlin/fr/shikkanime/services/caches/EpisodeMappingCacheService.kt +++ b/src/main/kotlin/fr/shikkanime/services/caches/EpisodeMappingCacheService.kt @@ -7,6 +7,7 @@ import fr.shikkanime.converters.AbstractConverter import fr.shikkanime.dtos.PageableDto import fr.shikkanime.dtos.enums.Status import fr.shikkanime.dtos.mappings.EpisodeMappingDto +import fr.shikkanime.dtos.mappings.EpisodeMappingSeoDto import fr.shikkanime.entities.EpisodeMapping import fr.shikkanime.entities.EpisodeVariant import fr.shikkanime.entities.SortParameter @@ -46,7 +47,7 @@ class EpisodeMappingCacheService : AbstractCacheService { ) } - private val findAllSeo = MapCache>(classes = listOf(EpisodeMapping::class.java)) { + private val findAllSeo = MapCache>(classes = listOf(EpisodeMapping::class.java)) { episodeMappingService.findAllSeo() } diff --git a/src/main/kotlin/fr/shikkanime/services/caches/MemberFollowAnimeCacheService.kt b/src/main/kotlin/fr/shikkanime/services/caches/MemberFollowAnimeCacheService.kt index 6e10d95b..3cd3a3c0 100644 --- a/src/main/kotlin/fr/shikkanime/services/caches/MemberFollowAnimeCacheService.kt +++ b/src/main/kotlin/fr/shikkanime/services/caches/MemberFollowAnimeCacheService.kt @@ -3,8 +3,8 @@ package fr.shikkanime.services.caches import com.google.inject.Inject import fr.shikkanime.caches.UUIDPaginationKeyCache import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto -import fr.shikkanime.dtos.MissedAnimeDto +import fr.shikkanime.dtos.animes.AnimeDto +import fr.shikkanime.dtos.animes.MissedAnimeDto import fr.shikkanime.dtos.PageableDto import fr.shikkanime.entities.Anime import fr.shikkanime.entities.EpisodeMapping diff --git a/src/main/resources/templates/_freemarker_implicit.ftl b/src/main/resources/templates/_freemarker_implicit.ftl index 2356a39b..070e9750 100644 --- a/src/main/resources/templates/_freemarker_implicit.ftl +++ b/src/main/resources/templates/_freemarker_implicit.ftl @@ -6,9 +6,9 @@ [#-- @ftlvariable name="platforms" type="kotlin.collections.AbstractList" --] [#-- @ftlvariable name="platform" type="fr.shikkanime.entities.enums.Platform" --] [#-- @ftlvariable name="error" type="kotlin.NumbersKt" --] -[#-- @ftlvariable name="anime" type="fr.shikkanime.dtos.AnimeDto" --] +[#-- @ftlvariable name="anime" type="fr.shikkanime.dtos.animes.AnimeDto" --] [#-- @ftlvariable name="simulcast_config" type="fr.shikkanime.platforms.configuration.PlatformSimulcast" --] -[#-- @ftlvariable name="animes" type="kotlin.collections.AbstractList" --] +[#-- @ftlvariable name="animes" type="kotlin.collections.AbstractList" --] [#-- @ftlvariable name="originalSize" type="java.lang.String" --] [#-- @ftlvariable name="compressedSize" type="java.lang.String" --] [#-- @ftlvariable name="simulcasts" type="kotlin.collections.AbstractList" --] diff --git a/src/test/kotlin/fr/shikkanime/controllers/api/AnimeControllerTest.kt b/src/test/kotlin/fr/shikkanime/controllers/api/AnimeControllerTest.kt index c06f19c2..112d2e32 100644 --- a/src/test/kotlin/fr/shikkanime/controllers/api/AnimeControllerTest.kt +++ b/src/test/kotlin/fr/shikkanime/controllers/api/AnimeControllerTest.kt @@ -2,6 +2,8 @@ package fr.shikkanime.controllers.api import com.google.gson.reflect.TypeToken import fr.shikkanime.dtos.* +import fr.shikkanime.dtos.animes.AnimeDto +import fr.shikkanime.dtos.animes.MissedAnimeDto import fr.shikkanime.dtos.weekly.v1.WeeklyAnimesDto import fr.shikkanime.entities.enums.CountryCode import fr.shikkanime.entities.enums.LangType diff --git a/src/test/kotlin/fr/shikkanime/services/AnimeServiceTest.kt b/src/test/kotlin/fr/shikkanime/services/AnimeServiceTest.kt index 26fd61f2..1e45e982 100644 --- a/src/test/kotlin/fr/shikkanime/services/AnimeServiceTest.kt +++ b/src/test/kotlin/fr/shikkanime/services/AnimeServiceTest.kt @@ -2,7 +2,7 @@ package fr.shikkanime.services import fr.shikkanime.AbstractTest import fr.shikkanime.converters.AbstractConverter -import fr.shikkanime.dtos.AnimeDto +import fr.shikkanime.dtos.animes.AnimeDto import fr.shikkanime.dtos.GenericDto import fr.shikkanime.entities.* import fr.shikkanime.entities.enums.CountryCode