feat(mobile): cache image info (#2899)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { sql } from "drizzle-orm"
|
||||
import { integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core"
|
||||
|
||||
import type { AttachmentsModel, ExtraModel, MediaModel } from "./types"
|
||||
import type { AttachmentsModel, ExtraModel, ImageColorsResult, MediaModel } from "./types"
|
||||
|
||||
export const feedsTable = sqliteTable("feeds", {
|
||||
id: text("id").primaryKey(),
|
||||
@@ -104,3 +105,9 @@ export const summariesTable = sqliteTable(
|
||||
unq: uniqueIndex("unq").on(table.entryId, table.language),
|
||||
}),
|
||||
)
|
||||
|
||||
export const imagesTable = sqliteTable("images", (t) => ({
|
||||
url: t.text("url").notNull().primaryKey(),
|
||||
colors: t.text("colors", { mode: "json" }).$type<ImageColorsResult>().notNull(),
|
||||
createdAt: t.integer("created_at", { mode: "timestamp" }).default(sql`(CURRENT_TIMESTAMP)`),
|
||||
}))
|
||||
|
||||
@@ -2,6 +2,7 @@ import type {
|
||||
collectionsTable,
|
||||
entriesTable,
|
||||
feedsTable,
|
||||
imagesTable,
|
||||
inboxesTable,
|
||||
listsTable,
|
||||
subscriptionsTable,
|
||||
@@ -27,6 +28,9 @@ export type EntrySchema = typeof entriesTable.$inferSelect
|
||||
export type CollectionSchema = typeof collectionsTable.$inferSelect
|
||||
|
||||
export type SummarySchema = typeof summariesTable.$inferSelect
|
||||
|
||||
export type ImageSchema = typeof imagesTable.$inferInsert
|
||||
|
||||
export type MediaModel = {
|
||||
url: string
|
||||
type: "photo" | "video"
|
||||
@@ -51,3 +55,5 @@ export type ExtraModel = {
|
||||
content_html?: string
|
||||
}[]
|
||||
}
|
||||
|
||||
export { ImageColorsResult } from "react-native-image-colors"
|
||||
|
||||
Reference in New Issue
Block a user