added library database
This commit is contained in:
1 parent
8f8b466e89
commit
02a40c2589
10 files changed
+383
-100
No files matched your search
@@ -19,7 +19,9 @@ data class BookRecord(
|
||||
val id: String,
|
||||
val title: String? = null,
|
||||
val subtitle: String? = null,
|
||||
val authors: List<String> = emptyList(),
|
||||
val language: String? = null,
|
||||
val date: String? = null,
|
||||
val description: String? = null,
|
||||
val coverImage: ByteArray? = null,
|
||||
val coverImageMimeType: String? = null,
|
||||
@@ -33,7 +35,9 @@ data class BookRecord(
|
||||
return id == other.id &&
|
||||
title == other.title &&
|
||||
subtitle == other.subtitle &&
|
||||
authors == other.authors &&
|
||||
language == other.language &&
|
||||
date == other.date &&
|
||||
description == other.description &&
|
||||
coverImage.contentEquals(other.coverImage) &&
|
||||
coverImageMimeType == other.coverImageMimeType &&
|
||||
@@ -45,7 +49,9 @@ data class BookRecord(
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + (title?.hashCode() ?: 0)
|
||||
result = 31 * result + (subtitle?.hashCode() ?: 0)
|
||||
result = 31 * result + authors.hashCode()
|
||||
result = 31 * result + (language?.hashCode() ?: 0)
|
||||
result = 31 * result + (date?.hashCode() ?: 0)
|
||||
result = 31 * result + (description?.hashCode() ?: 0)
|
||||
result = 31 * result + (coverImage?.contentHashCode() ?: 0)
|
||||
result = 31 * result + (coverImageMimeType?.hashCode() ?: 0)
|
||||
@@ -55,6 +61,11 @@ data class BookRecord(
|
||||
}
|
||||
}
|
||||
|
||||
data class BookCoverRecord(
|
||||
val image: ByteArray,
|
||||
val mimeType: String?,
|
||||
)
|
||||
|
||||
data class BookBodyRecord(
|
||||
val id: String,
|
||||
val exactTextHash: String,
|
||||
@@ -90,6 +101,20 @@ data class BookFileRecord(
|
||||
val updatedAt: Long,
|
||||
)
|
||||
|
||||
data class LibraryFileRecord(
|
||||
val fileId: String,
|
||||
val bookId: String? = null,
|
||||
val title: String? = null,
|
||||
val authors: List<String> = emptyList(),
|
||||
val language: String? = null,
|
||||
val date: String? = null,
|
||||
val format: String? = null,
|
||||
val sizeBytes: Long? = null,
|
||||
val originalFilename: String? = null,
|
||||
val storageUri: String? = null,
|
||||
val lastSeenAt: Long? = null,
|
||||
)
|
||||
|
||||
data class ContentAnchor(
|
||||
val version: Int = 1,
|
||||
val canonicalCharOffset: Long? = null,
|
||||
@@ -136,6 +161,7 @@ data class NoteRecord(
|
||||
interface BookRepository {
|
||||
fun upsert(book: BookRecord)
|
||||
fun get(id: String): BookRecord?
|
||||
fun getCover(id: String): BookCoverRecord?
|
||||
fun list(limit: Int = 100, offset: Int = 0): List<BookRecord>
|
||||
fun delete(id: String): Boolean
|
||||
}
|
||||
@@ -155,7 +181,9 @@ interface BodyClusterRepository {
|
||||
interface BookFileRepository {
|
||||
fun upsert(file: BookFileRecord)
|
||||
fun get(id: String): BookFileRecord?
|
||||
fun getLibraryFile(id: String): LibraryFileRecord?
|
||||
fun findByRawSha256(rawSha256: String): List<BookFileRecord>
|
||||
fun listLibraryFiles(limit: Int = 100, offset: Int = 0): List<LibraryFileRecord>
|
||||
fun list(limit: Int = 500, offset: Int = 0): List<BookFileRecord>
|
||||
fun listForBook(bookId: String): List<BookFileRecord>
|
||||
fun delete(id: String): Boolean
|
||||
|
||||
Reference in new issue
Block a user