-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #335 from Shikkanime/dev
Dev
- Loading branch information
Showing
34 changed files
with
262 additions
and
111 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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/fr/shikkanime/controllers/site/SiteController.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
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
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/fr/shikkanime/converters/anime/AnimeToAnimeNoStatusDtoConverter.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,34 @@ | ||
package fr.shikkanime.converters.anime | ||
|
||
import fr.shikkanime.converters.AbstractConverter | ||
import fr.shikkanime.dtos.SimulcastDto | ||
import fr.shikkanime.dtos.animes.AnimeNoStatusDto | ||
import fr.shikkanime.entities.Anime | ||
import fr.shikkanime.services.SimulcastService.Companion.sortBySeasonAndYear | ||
import fr.shikkanime.utils.StringUtils | ||
import fr.shikkanime.utils.withUTC | ||
import org.hibernate.Hibernate | ||
import java.time.format.DateTimeFormatter | ||
|
||
class AnimeToAnimeNoStatusDtoConverter : AbstractConverter<Anime, AnimeNoStatusDto>() { | ||
override fun convert(from: Anime): AnimeNoStatusDto { | ||
return AnimeNoStatusDto( | ||
uuid = from.uuid, | ||
releaseDateTime = from.releaseDateTime.withUTC() | ||
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME), | ||
image = from.image, | ||
banner = from.banner, | ||
countryCode = from.countryCode!!, | ||
name = from.name!!, | ||
shortName = StringUtils.getShortName(from.name!!), | ||
description = from.description, | ||
simulcasts = if (Hibernate.isInitialized(from.simulcasts)) convert( | ||
from.simulcasts.sortBySeasonAndYear(), | ||
SimulcastDto::class.java | ||
) else null, | ||
slug = from.slug, | ||
lastReleaseDateTime = from.lastReleaseDateTime.withUTC() | ||
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME) | ||
) | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package fr.shikkanime.dtos.animes | ||
|
||
import fr.shikkanime.dtos.SimulcastDto | ||
import fr.shikkanime.dtos.enums.Status | ||
import fr.shikkanime.entities.enums.CountryCode | ||
import java.util.* | ||
|
||
data class AnimeDto( | ||
override val uuid: UUID?, | ||
override val countryCode: CountryCode, | ||
override var name: String, | ||
override var shortName: String, | ||
override var releaseDateTime: String, | ||
override val image: String? = null, | ||
override val banner: String? = null, | ||
override val description: String?, | ||
override val simulcasts: List<SimulcastDto>?, | ||
override val slug: String? = null, | ||
override val lastReleaseDateTime: String? = null, | ||
val status: Status? = null, | ||
) : AnimeNoStatusDto( | ||
uuid, | ||
countryCode, | ||
name, | ||
shortName, | ||
releaseDateTime, | ||
image, | ||
banner, | ||
description, | ||
simulcasts, | ||
slug, | ||
lastReleaseDateTime | ||
) { | ||
companion object { | ||
fun from(animeNoStatusDto: AnimeNoStatusDto, status: Status?): AnimeDto { | ||
return AnimeDto( | ||
animeNoStatusDto.uuid, | ||
animeNoStatusDto.countryCode, | ||
animeNoStatusDto.name, | ||
animeNoStatusDto.shortName, | ||
animeNoStatusDto.releaseDateTime, | ||
animeNoStatusDto.image, | ||
animeNoStatusDto.banner, | ||
animeNoStatusDto.description, | ||
animeNoStatusDto.simulcasts, | ||
animeNoStatusDto.slug, | ||
animeNoStatusDto.lastReleaseDateTime, | ||
status, | ||
) | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/fr/shikkanime/dtos/animes/AnimeNoStatusDto.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,32 @@ | ||
package fr.shikkanime.dtos.animes | ||
|
||
import fr.shikkanime.dtos.SimulcastDto | ||
import fr.shikkanime.entities.enums.CountryCode | ||
import java.util.* | ||
|
||
open class AnimeNoStatusDto( | ||
@Transient | ||
open val uuid: UUID?, | ||
@Transient | ||
open val countryCode: CountryCode, | ||
@Transient | ||
open var name: String, | ||
@Transient | ||
open var shortName: String, | ||
@Transient | ||
open var releaseDateTime: String, | ||
@Transient | ||
open val image: String? = null, | ||
@Transient | ||
open val banner: String? = null, | ||
@Transient | ||
open val description: String?, | ||
@Transient | ||
open val simulcasts: List<SimulcastDto>?, | ||
@Transient | ||
open val slug: String? = null, | ||
@Transient | ||
open val lastReleaseDateTime: String? = null | ||
) { | ||
fun toAnimeDto() = AnimeDto.from(this, 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
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
Oops, something went wrong.