mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-15 16:54:09 -05:00
Change type of Manga.genre to a List<String> (#188)
This commit is contained in:
@@ -7,6 +7,7 @@ package suwayomi.tachidesk.manga.model.dataclass
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import suwayomi.tachidesk.manga.impl.util.lang.trimAll
|
||||
import suwayomi.tachidesk.manga.model.table.MangaStatus
|
||||
|
||||
data class MangaDataClass(
|
||||
@@ -22,7 +23,7 @@ data class MangaDataClass(
|
||||
val artist: String? = null,
|
||||
val author: String? = null,
|
||||
val description: String? = null,
|
||||
val genre: String? = null,
|
||||
val genre: List<String> = emptyList(),
|
||||
val status: String = MangaStatus.UNKNOWN.name,
|
||||
val inLibrary: Boolean = false,
|
||||
val source: SourceDataClass? = null,
|
||||
@@ -39,3 +40,5 @@ data class PagedMangaListDataClass(
|
||||
val mangaList: List<MangaDataClass>,
|
||||
val hasNextPage: Boolean
|
||||
)
|
||||
|
||||
internal inline fun String?.toGenreList() = this?.split(",")?.trimAll().orEmpty()
|
||||
@@ -13,6 +13,7 @@ import org.jetbrains.exposed.sql.ResultRow
|
||||
import suwayomi.tachidesk.manga.impl.Manga.getMangaMetaMap
|
||||
import suwayomi.tachidesk.manga.impl.MangaList.proxyThumbnailUrl
|
||||
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
||||
import suwayomi.tachidesk.manga.model.dataclass.toGenreList
|
||||
import suwayomi.tachidesk.manga.model.table.MangaStatus.Companion
|
||||
|
||||
object MangaTable : IntIdTable() {
|
||||
@@ -52,7 +53,7 @@ fun MangaTable.toDataClass(mangaEntry: ResultRow) =
|
||||
mangaEntry[artist],
|
||||
mangaEntry[author],
|
||||
mangaEntry[description],
|
||||
mangaEntry[genre],
|
||||
mangaEntry[genre].toGenreList(),
|
||||
Companion.valueOf(mangaEntry[status]).name,
|
||||
mangaEntry[inLibrary],
|
||||
meta = getMangaMetaMap(mangaEntry[id].value),
|
||||
|
||||
Reference in New Issue
Block a user