mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-20 03:03:34 -05:00
add category and global meta (#438)
This commit is contained in:
@@ -11,5 +11,6 @@ data class CategoryDataClass(
|
||||
val id: Int,
|
||||
val order: Int,
|
||||
val name: String,
|
||||
val default: Boolean
|
||||
val default: Boolean,
|
||||
val meta: Map<String, String> = emptyMap()
|
||||
)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package suwayomi.tachidesk.manga.model.table
|
||||
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 org.jetbrains.exposed.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.sql.ReferenceOption
|
||||
import suwayomi.tachidesk.manga.model.table.CategoryMetaTable.ref
|
||||
|
||||
/**
|
||||
* Metadata storage for clients, about Chapter with id == [ref].
|
||||
*/
|
||||
object CategoryMetaTable : IntIdTable() {
|
||||
val key = varchar("key", 256)
|
||||
val value = varchar("value", 4096)
|
||||
val ref = reference("category_ref", CategoryTable, ReferenceOption.CASCADE)
|
||||
}
|
||||
@@ -9,6 +9,7 @@ package suwayomi.tachidesk.manga.model.table
|
||||
|
||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.sql.ResultRow
|
||||
import suwayomi.tachidesk.manga.impl.Category
|
||||
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
|
||||
|
||||
object CategoryTable : IntIdTable() {
|
||||
@@ -18,8 +19,9 @@ object CategoryTable : IntIdTable() {
|
||||
}
|
||||
|
||||
fun CategoryTable.toDataClass(categoryEntry: ResultRow) = CategoryDataClass(
|
||||
categoryEntry[this.id].value,
|
||||
categoryEntry[id].value,
|
||||
categoryEntry[order],
|
||||
categoryEntry[name],
|
||||
categoryEntry[isDefault]
|
||||
categoryEntry[isDefault],
|
||||
Category.getCategoryMetaMap(categoryEntry[id].value)
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.exposed.sql.ReferenceOption
|
||||
import suwayomi.tachidesk.manga.model.table.ChapterMetaTable.ref
|
||||
|
||||
/**
|
||||
* Meta data storage for clients, about Chapter with id == [ref].
|
||||
* Metadata storage for clients, about Chapter with id == [ref].
|
||||
*
|
||||
* For example, if you added reader mode(with the key juiReaderMode) such as webtoon to a manga object,
|
||||
* this is what will show up when you request that manga from the api again
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.exposed.sql.ReferenceOption
|
||||
import suwayomi.tachidesk.manga.model.table.MangaMetaTable.ref
|
||||
|
||||
/**
|
||||
* Meta data storage for clients, about Manga with id == [ref].
|
||||
* Metadata storage for clients, about Manga with id == [ref].
|
||||
*
|
||||
* For example, if you added reader mode(with the key juiReaderMode) such as webtoon to a manga object,
|
||||
* this is what will show up when you request that manga from the api again
|
||||
|
||||
Reference in New Issue
Block a user