add category and global meta (#438)

This commit is contained in:
Aria Moradi
2022-11-07 21:04:34 +03:30
committed by GitHub
parent 907adea73f
commit e850049e8e
15 changed files with 244 additions and 16 deletions

View File

@@ -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()
)

View File

@@ -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)
}

View File

@@ -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)
)

View File

@@ -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

View File

@@ -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