indexed posts, more specs

This commit is contained in:
Dylan Knutson
2024-12-25 17:30:03 +00:00
parent 9c7a83eb4e
commit c70240b143
27 changed files with 407 additions and 169 deletions

View File

@@ -84,6 +84,7 @@ group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "rspec-rails", "~> 7.0"
gem "rails-controller-testing"
gem "selenium-webdriver"
gem "webdrivers"
end

View File

@@ -282,6 +282,10 @@ GEM
activesupport (= 7.2.2.1)
bundler (>= 1.15.0)
railties (= 7.2.2.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
@@ -450,6 +454,7 @@ DEPENDENCIES
rack-cors
rack-mini-profiler (~> 3.3)
rails (~> 7.2)
rails-controller-testing
rails_live_reload!
rails_semantic_logger (~> 4.17)
rb-bsdiff!

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -8,7 +8,7 @@ class BlobsController < ApplicationController
def contents
thumb = params[:thumb]
raise("invalid thumb #{thumb}") if !thumb.blank? && !thumb_params(thumb)
raise("invalid thumb #{thumb}") if thumb.present? && !thumb_params(thumb)
expires_dur = 1.year
response.headers["Expires"] = expires_dur.from_now.httpdate
@@ -33,7 +33,7 @@ class BlobsController < ApplicationController
Vips::Image.thumbnail_buffer(
blob_entry.contents,
width,
height: height
height: height,
)
resized_image_contents = image.jpegsave_buffer
@@ -41,7 +41,7 @@ class BlobsController < ApplicationController
resized_image_contents,
type: "image/jpg",
disposition: "inline",
filename: filename
filename: filename,
)
else
ext = helpers.ext_for_content_type(blob_entry.content_type)
@@ -50,7 +50,7 @@ class BlobsController < ApplicationController
blob_entry.contents,
type: blob_entry.content_type,
disposition: "inline",
filename: "data#{ext}"
filename: "data#{ext}",
)
end
elsif blob_entry.content_type =~ %r{text/plain}

View File

@@ -0,0 +1,10 @@
class IndexedPostsController < ApplicationController
def index
@posts =
IndexedPost
.includes(:postable)
.order(created_at: :desc)
.page(params[:page])
.per(50)
end
end

View File

@@ -0,0 +1,2 @@
module IndexablePostsHelper
end

View File

@@ -10,7 +10,7 @@ module LogEntriesHelper
(1...path_parts.length).map do |i|
[
path_parts[i],
path_parts[0..i].join("/") + (i == path_parts.length - 1 ? "" : "/")
path_parts[0..i].join("/") + (i == path_parts.length - 1 ? "" : "/"),
]
end
end
@@ -37,7 +37,8 @@ module LogEntriesHelper
end
def is_thumbable_content_type?(content_type)
is_renderable_image_type?(content_type)
%w[video/webm].any? { |ct| content_type.starts_with?(ct) } ||
is_renderable_image_type?(content_type)
end
def is_renderable_video_type?(content_type)

View File

@@ -40,6 +40,7 @@ module Domain::E621::TagUtil
e621_post.md5 = e621_md5
e621_post.file_url_str = post_json["file"]["url"]
e621_post.posted_at = post_json["created_at"]
e621_post.description = post_json["description"]
e621_post.rating = post_json["rating"]
e621_post.score = post_json["score"]["total"]

View File

@@ -40,7 +40,7 @@ class Scraper::ClientFactory
end
def self.get_e621_http_client
if Rails.env.test? || Rails.env.development?
if Rails.env.test?
@http_client_mock || raise("no http client mock set")
else
_http_client_impl(:e621, Scraper::E621HttpClientConfig)
@@ -64,12 +64,12 @@ class Scraper::ClientFactory
Rails.application.config.x.proxy || raise("no proxy config")
if proxy_config[:gallery_dl].blank?
raise(
"no gallery_dl host defined for proxy config #{proxy_config[:name]}"
"no gallery_dl host defined for proxy config #{proxy_config[:name]}",
)
end
Scraper::GalleryDlClient.new(
proxy_config[:name],
proxy_config[:gallery_dl]
proxy_config[:gallery_dl],
)
end
end

View File

@@ -0,0 +1,18 @@
module IndexedPostable
extend ActiveSupport::Concern
included do
has_one :indexed_post,
as: :postable,
dependent: :destroy,
inverse_of: :postable,
autosave: true
before_save :ensure_indexed_post!
def ensure_indexed_post!
self.indexed_post ||=
IndexedPost.new(created_at: self.created_at, postable: self)
end
end
end

View File

@@ -2,6 +2,7 @@ class Domain::E621::Post < ReduxApplicationRecord
self.table_name = "domain_e621_posts"
has_lite_trail(schema_version: 1, separate_versions_table: true)
include IndexedPostable
include Discard::Model
self.discard_column = :deleted_at
default_scope -> { kept }

View File

@@ -4,8 +4,8 @@ class Domain::Fa::Post < ReduxApplicationRecord
has_lite_trail(
schema_version: 1,
map_attribute: {
file_sha256: ::Sha256AttributeMapper
}
file_sha256: ::Sha256AttributeMapper,
},
)
enum :state,
@@ -13,7 +13,7 @@ class Domain::Fa::Post < ReduxApplicationRecord
:ok, # so far so good, post may not yet be scanned or have file downloaded
:removed, # post has been removed
:scan_error, # error scanning post page (see state_detail)
:file_error # error downloading post file (see state_detail)
:file_error, # error downloading post file (see state_detail)
]
validates_inclusion_of(:state, in: self.states.keys)
after_initialize do
@@ -52,6 +52,8 @@ class Domain::Fa::Post < ReduxApplicationRecord
foreign_key: :post_id,
dependent: :destroy
include IndexedPostable
def to_param
self.fa_id.to_s
end
@@ -141,7 +143,7 @@ class Domain::Fa::Post < ReduxApplicationRecord
uri_host: "www.furaffinity.net",
uri_path: ["/view/#{self.fa_id}/", "/view/#{self.fa_id}"],
uri_query: nil,
status_code: 200
status_code: 200,
)
.order(created_at: :desc)
.first
@@ -158,7 +160,7 @@ class Domain::Fa::Post < ReduxApplicationRecord
)
creator =
Domain::Fa::User.find_or_create_by(
{ url_name: submission.artist_url_name }
{ url_name: submission.artist_url_name },
) { |user| user.name = submission.artist }
{
@@ -167,8 +169,8 @@ class Domain::Fa::Post < ReduxApplicationRecord
title: submission.title,
state_detail: {
"first_seen_entry" => first_seen_log_entry&.id,
"thumbnail_url_str" => submission.thumb_path
}
"thumbnail_url_str" => submission.thumb_path,
},
}
end
end

View File

@@ -0,0 +1,49 @@
class IndexedPost < ReduxApplicationRecord
belongs_to :postable, polymorphic: true, inverse_of: :indexed_post
validates_presence_of :postable_id, :postable_type
def show_path
case postable_type
when "Domain::Fa::Post"
# need to use the helper here because the postable is not loaded
Rails.application.routes.url_helpers.domain_fa_post_path(postable)
when "Domain::E621::Post"
Rails.application.routes.url_helpers.domain_e621_post_path(postable)
else
raise("Unsupported postable type: #{postable_type}")
end
end
def title
case postable_type
when "Domain::Fa::Post"
postable&.title || "FA Post #{postable&.id}"
when "Domain::E621::Post"
"E621 Post #{postable&.e621_id}"
else
raise("Unsupported postable type: #{postable_type}")
end
end
def file_sha256
case postable_type
when "Domain::Fa::Post"
postable&.file&.response_sha256
when "Domain::E621::Post"
postable&.file&.response_sha256
else
raise("Unsupported postable type: #{postable_type}")
end
end
def file_blob_entry
case postable_type
when "Domain::Fa::Post"
postable&.file&.response
when "Domain::E621::Post"
postable&.file&.response
else
raise("Unsupported postable type: #{postable_type}")
end
end
end

View File

@@ -0,0 +1,43 @@
<div
class="m-4 flex h-fit flex-col rounded-lg border border-slate-300 bg-slate-50 shadow-sm"
>
<div class="flex border-b border-slate-300 p-4">
<%= render partial: "inline_postable_domain_link", locals: { post: post } %>
</div>
<div class="flex items-center justify-center p-4">
<% if post.file_blob_entry.present? %>
<%= link_to post.show_path do %>
<img
class="max-h-[300px] max-w-[300px] rounded-md border border-slate-300 object-contain shadow-md"
alt="<%= post.title %>"
src="<%= contents_blob_path(
HexUtil.bin2hex(post.file_sha256),
format: "jpg",
thumb: "small",
) %>"
/>
<% end %>
<% else %>
<span>No file available</span>
<% end %>
</div>
<div class="border-t border-slate-300">
<h2 class="p-4 text-center text-lg">
<%= link_to post.title, post.show_path, class: "sky-link" %>
</h2>
<div class="px-4 pb-4 text-sm text-slate-600">
<div class="flex items-start justify-between">
<% if post.created_at %>
Posted <%= post.created_at.strftime("%Y-%m-%d") %>
<div class="text-slate-500">
(<%= time_ago_in_words(post.created_at) %> ago)
</div>
<% else %>
Posted date unknown
<% end %>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,31 @@
<% case post.postable_type %>
<% when "Domain::Fa::Post" %>
<% domain_icon = asset_path("fa-logo.png") %>
<% icon_title = "Furaffinity" %>
<% external_url = "https://www.furaffinity.net/view/#{post.postable.fa_id}" %>
<% link_text = "FA ##{post.postable.fa_id}" %>
<% when "Domain::E621::Post" %>
<% domain_icon = asset_path("e621-logo.png") %>
<% icon_title = "E621" %>
<% external_url = "https://e621.net/posts/#{post.postable.e621_id}" %>
<% link_text = "E621 ##{post.postable.e621_id}" %>
<% else %>
<% domain_icon = nil %>
<% external_url = nil %>
<% link_text = "Unknown postable #{post.postable_type}" %>
<% end %>
<div class="flex w-full items-center justify-between">
<% if domain_icon.present? %>
<%= image_tag domain_icon, class: "w-6 h-6", title: icon_title %>
<% end %>
<% link_class =
"flex items-center text-slate-500 hover:text-slate-700 decoration-dotted underline" %>
<%= link_to external_url, target: "_blank", rel: "noopener", class: link_class do %>
<span><%= link_text %></span>
<%= render partial: "shared/icons/external_link",
locals: {
class_name: "w-4 h-4 ml-1",
} %>
<% end %>
</div>

View File

@@ -0,0 +1,11 @@
<div class="mx-auto mt-4 text-center sm:mt-6">
<h1 class="text-2xl">All Posts <%= page_str(params) %></h1>
</div>
<%= render partial: "shared/pagination_controls", locals: { collection: @posts } %>
<div class="mx-auto flex flex-wrap justify-center">
<% @posts.each do |post| %>
<%= render partial: "indexed_post", locals: { post: post } %>
<% end %>
</div>

View File

@@ -15,6 +15,9 @@ Rails.application.routes.draw do
resources :users, param: :url_name, only: [:show]
resources :posts, param: :fa_id, only: [:show]
end
namespace :e621 do
resources :posts, param: :e621_id, only: [:show]
end
end
resources :blobs, only: [], slug: :sha256 do
@@ -59,6 +62,8 @@ Rails.application.routes.draw do
end
end
resources :posts, only: [:index], controller: "indexed_posts"
resources :blobs, only: [:show], slug: :sha256
resources :log_entries, only: %i[index show] do
@@ -68,7 +73,7 @@ Rails.application.routes.draw do
on: :collection,
action: :index,
constraints: {
filter: /.*/
filter: /.*/,
}
end
end

View File

@@ -0,0 +1,12 @@
class CreateIndexedPosts < ActiveRecord::Migration[7.2]
def change
create_table :indexed_posts do |t|
t.integer :postable_id, null: false
t.string :postable_type, null: false
t.timestamps
end
add_index :indexed_posts, %i[postable_id postable_type], unique: true
add_index :indexed_posts, :created_at
end
end

View File

@@ -0,0 +1,5 @@
class AddPostedAtToDomainE621Posts < ActiveRecord::Migration[7.2]
def change
add_column :domain_e621_posts, :posted_at, :datetime
end
end

239
db/schema.rb generated
View File

@@ -10,25 +10,15 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
ActiveRecord::Schema[7.2].define(version: 2024_12_24_061643) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_prewarm"
enable_extension "pg_stat_statements"
enable_extension "pg_trgm"
enable_extension "pgcrypto"
enable_extension "plpgsql"
enable_extension "vector"
create_table "blob_entries", id: false, force: :cascade do |t|
t.binary "sha256", null: false
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
t.binary "contents", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["sha256"], name: "index_blob_entries_on_sha256", unique: true
end
create_table "blob_entries_p", id: false, force: :cascade do |t|
t.binary "sha256", null: false
t.binary "base_sha256"
@@ -39,8 +29,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_on_sha256", unique: true
end
create_table "blob_entries_p_00", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_00", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -49,8 +38,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_00_on_sha256", unique: true
end
create_table "blob_entries_p_01", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_01", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -59,8 +47,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_01_on_sha256", unique: true
end
create_table "blob_entries_p_02", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_02", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -69,8 +56,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_02_on_sha256", unique: true
end
create_table "blob_entries_p_03", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_03", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -79,8 +65,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_03_on_sha256", unique: true
end
create_table "blob_entries_p_04", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_04", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -89,8 +74,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_04_on_sha256", unique: true
end
create_table "blob_entries_p_05", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_05", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -99,8 +83,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_05_on_sha256", unique: true
end
create_table "blob_entries_p_06", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_06", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -109,8 +92,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_06_on_sha256", unique: true
end
create_table "blob_entries_p_07", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_07", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -119,8 +101,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_07_on_sha256", unique: true
end
create_table "blob_entries_p_08", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_08", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -129,8 +110,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_08_on_sha256", unique: true
end
create_table "blob_entries_p_09", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_09", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -139,8 +119,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_09_on_sha256", unique: true
end
create_table "blob_entries_p_10", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_10", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -149,8 +128,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_10_on_sha256", unique: true
end
create_table "blob_entries_p_11", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_11", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -159,8 +137,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_11_on_sha256", unique: true
end
create_table "blob_entries_p_12", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_12", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -169,8 +146,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_12_on_sha256", unique: true
end
create_table "blob_entries_p_13", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_13", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -179,8 +155,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_13_on_sha256", unique: true
end
create_table "blob_entries_p_14", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_14", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -189,8 +164,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_14_on_sha256", unique: true
end
create_table "blob_entries_p_15", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_15", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -199,8 +173,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_15_on_sha256", unique: true
end
create_table "blob_entries_p_16", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_16", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -209,8 +182,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_16_on_sha256", unique: true
end
create_table "blob_entries_p_17", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_17", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -219,8 +191,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_17_on_sha256", unique: true
end
create_table "blob_entries_p_18", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_18", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -229,8 +200,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_18_on_sha256", unique: true
end
create_table "blob_entries_p_19", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_19", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -239,8 +209,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_19_on_sha256", unique: true
end
create_table "blob_entries_p_20", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_20", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -249,8 +218,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_20_on_sha256", unique: true
end
create_table "blob_entries_p_21", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_21", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -259,8 +227,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_21_on_sha256", unique: true
end
create_table "blob_entries_p_22", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_22", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -269,8 +236,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_22_on_sha256", unique: true
end
create_table "blob_entries_p_23", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_23", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -279,8 +245,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_23_on_sha256", unique: true
end
create_table "blob_entries_p_24", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_24", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -289,8 +254,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_24_on_sha256", unique: true
end
create_table "blob_entries_p_25", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_25", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -299,8 +263,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_25_on_sha256", unique: true
end
create_table "blob_entries_p_26", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_26", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -309,8 +272,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_26_on_sha256", unique: true
end
create_table "blob_entries_p_27", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_27", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -319,8 +281,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_27_on_sha256", unique: true
end
create_table "blob_entries_p_28", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_28", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -329,8 +290,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_28_on_sha256", unique: true
end
create_table "blob_entries_p_29", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_29", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -339,8 +299,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_29_on_sha256", unique: true
end
create_table "blob_entries_p_30", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_30", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -349,8 +308,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_30_on_sha256", unique: true
end
create_table "blob_entries_p_31", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_31", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -359,8 +317,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_31_on_sha256", unique: true
end
create_table "blob_entries_p_32", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_32", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -369,8 +326,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_32_on_sha256", unique: true
end
create_table "blob_entries_p_33", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_33", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -379,8 +335,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_33_on_sha256", unique: true
end
create_table "blob_entries_p_34", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_34", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -389,8 +344,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_34_on_sha256", unique: true
end
create_table "blob_entries_p_35", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_35", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -399,8 +353,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_35_on_sha256", unique: true
end
create_table "blob_entries_p_36", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_36", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -409,8 +362,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_36_on_sha256", unique: true
end
create_table "blob_entries_p_37", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_37", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -419,8 +371,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_37_on_sha256", unique: true
end
create_table "blob_entries_p_38", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_38", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -429,8 +380,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_38_on_sha256", unique: true
end
create_table "blob_entries_p_39", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_39", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -439,8 +389,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_39_on_sha256", unique: true
end
create_table "blob_entries_p_40", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_40", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -449,8 +398,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_40_on_sha256", unique: true
end
create_table "blob_entries_p_41", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_41", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -459,8 +407,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_41_on_sha256", unique: true
end
create_table "blob_entries_p_42", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_42", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -469,8 +416,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_42_on_sha256", unique: true
end
create_table "blob_entries_p_43", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_43", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -479,8 +425,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_43_on_sha256", unique: true
end
create_table "blob_entries_p_44", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_44", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -489,8 +434,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_44_on_sha256", unique: true
end
create_table "blob_entries_p_45", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_45", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -499,8 +443,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_45_on_sha256", unique: true
end
create_table "blob_entries_p_46", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_46", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -509,8 +452,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_46_on_sha256", unique: true
end
create_table "blob_entries_p_47", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_47", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -519,8 +461,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_47_on_sha256", unique: true
end
create_table "blob_entries_p_48", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_48", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -529,8 +470,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_48_on_sha256", unique: true
end
create_table "blob_entries_p_49", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_49", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -539,8 +479,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_49_on_sha256", unique: true
end
create_table "blob_entries_p_50", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_50", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -549,8 +488,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_50_on_sha256", unique: true
end
create_table "blob_entries_p_51", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_51", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -559,8 +497,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_51_on_sha256", unique: true
end
create_table "blob_entries_p_52", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_52", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -569,8 +506,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_52_on_sha256", unique: true
end
create_table "blob_entries_p_53", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_53", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -579,8 +515,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_53_on_sha256", unique: true
end
create_table "blob_entries_p_54", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_54", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -589,8 +524,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_54_on_sha256", unique: true
end
create_table "blob_entries_p_55", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_55", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -599,8 +533,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_55_on_sha256", unique: true
end
create_table "blob_entries_p_56", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_56", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -609,8 +542,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_56_on_sha256", unique: true
end
create_table "blob_entries_p_57", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_57", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -619,8 +551,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_57_on_sha256", unique: true
end
create_table "blob_entries_p_58", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_58", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -629,8 +560,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_58_on_sha256", unique: true
end
create_table "blob_entries_p_59", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_59", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -639,8 +569,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_59_on_sha256", unique: true
end
create_table "blob_entries_p_60", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_60", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -649,8 +578,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_60_on_sha256", unique: true
end
create_table "blob_entries_p_61", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_61", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -659,8 +587,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_61_on_sha256", unique: true
end
create_table "blob_entries_p_62", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_62", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -669,8 +596,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_blob_entries_p_62_on_sha256", unique: true
end
create_table "blob_entries_p_63", id: false, force: :cascade do |t|
t.binary "sha256", null: false
create_table "blob_entries_p_63", primary_key: "sha256", id: :binary, force: :cascade do |t|
t.binary "base_sha256"
t.string "content_type", null: false
t.integer "size", null: false
@@ -1343,7 +1269,9 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.datetime "updated_at"
t.string "signature"
t.jsonb "args"
t.index ["priority", "run_at"], name: "delayed_jobs_priority"
t.index ["priority", "run_at"], name: "delayed_jobs_priority_run_at_idx"
t.index ["queue"], name: "delayed_jobs_queue_idx"
t.index ["signature"], name: "delayed_jobs_signature_idx", unique: true
end
create_table "domain_e621_post_versions", force: :cascade do |t|
@@ -1379,6 +1307,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "posted_at"
t.index ["e621_id"], name: "index_domain_e621_posts_on_e621_id", unique: true
t.index ["file_id"], name: "index_domain_e621_posts_on_file_id"
t.index ["md5"], name: "index_domain_e621_posts_on_md5", unique: true, where: "(deleted_at IS NULL)"
@@ -1404,7 +1333,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
create_table "domain_fa_favs", id: false, force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "post_id", null: false
t.index ["post_id"], name: "index_domain_fa_favs_on_post_id"
t.index ["user_id", "post_id"], name: "index_domain_fa_favs_on_user_id_and_post_id", unique: true
t.index ["user_id"], name: "index_domain_fa_favs_on_user_id"
end
@@ -1447,7 +1375,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.jsonb "state_detail"
t.jsonb "log_entry_detail"
t.index ["creator_id"], name: "index_domain_fa_posts_on_creator_id"
t.index ["fa_id"], name: "index_domain_fa_posts_on_fa_id", unique: true
t.index ["fa_id"], name: "index_domain_fa_posts_on_fa_id", unique: true, include: ["id"]
t.index ["file_id"], name: "index_domain_fa_posts_on_file_id"
end
@@ -1507,7 +1435,9 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.jsonb "state_detail"
t.datetime "scanned_follows_at"
t.datetime "scanned_favs_at"
t.index ["name"], name: "domain_fa_users_name_idx", opclass: :gist_trgm_ops, using: :gist
t.index ["name"], name: "index_domain_fa_users_on_name", unique: true
t.index ["url_name"], name: "domain_fa_users_url_name_idx", opclass: :gist_trgm_ops, using: :gist
t.index ["url_name"], name: "index_domain_fa_users_on_url_name", unique: true
end
@@ -1603,6 +1533,13 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.datetime "updated_at", null: false
end
create_table "domain_inkbunny_user_avatars", force: :cascade do |t|
t.bigint "user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_domain_inkbunny_user_avatars_on_user_id"
end
create_table "domain_inkbunny_users", force: :cascade do |t|
t.integer "state", null: false
t.json "state_detail"
@@ -1658,7 +1595,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.integer "state"
t.json "state_detail"
t.json "raw_data"
t.integer "tw_id"
t.string "name", null: false
t.string "nick"
t.string "description"
@@ -1669,6 +1605,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.datetime "scanned_timeline_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "tw_id"
t.index ["name"], name: "index_domain_twitter_users_on_name", unique: true
t.index ["tw_id"], name: "index_domain_twitter_users_on_tw_id", unique: true
end
@@ -1800,6 +1737,15 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["sha256"], name: "index_http_log_entry_headers_on_sha256", unique: true
end
create_table "indexed_posts", force: :cascade do |t|
t.integer "postable_id", null: false
t.string "postable_type", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["created_at"], name: "index_indexed_posts_on_created_at"
t.index ["postable_id", "postable_type"], name: "index_indexed_posts_on_postable_id_and_postable_type", unique: true
end
create_table "log_store_sst_entries", id: false, force: :cascade do |t|
t.binary "key", null: false
t.binary "value", null: false
@@ -1838,11 +1784,9 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
end
add_foreign_key "blob_entries", "blob_entries", column: "base_sha256", primary_key: "sha256"
add_foreign_key "domain_e621_post_versions", "domain_e621_posts", column: "item_id"
add_foreign_key "domain_e621_taggings", "domain_e621_posts", column: "post_id"
add_foreign_key "domain_e621_taggings", "domain_e621_tags", column: "tag_id"
add_foreign_key "domain_fa_favs", "domain_fa_posts", column: "post_id"
add_foreign_key "domain_fa_favs", "domain_fa_users", column: "user_id"
add_foreign_key "domain_fa_follows", "domain_fa_users", column: "followed_id"
add_foreign_key "domain_fa_follows", "domain_fa_users", column: "follower_id"
@@ -1862,8 +1806,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_23_175146) do
add_foreign_key "domain_inkbunny_pool_joins", "domain_inkbunny_posts", column: "post_id"
add_foreign_key "domain_twitter_medias", "domain_twitter_tweets", column: "tweet_id"
add_foreign_key "domain_twitter_medias", "http_log_entries", column: "file_id"
add_foreign_key "domain_twitter_tweets", "domain_twitter_users", column: "author_id"
add_foreign_key "domain_twitter_user_versions", "domain_twitter_users", column: "item_id"
add_foreign_key "domain_twitter_tweets", "domain_twitter_users", column: "author_id", primary_key: "tw_id", name: "on_author_id"
add_foreign_key "http_log_entries", "http_log_entries", column: "caused_by_id"
add_foreign_key "http_log_entries", "http_log_entry_headers", column: "request_headers_id"
add_foreign_key "http_log_entries", "http_log_entry_headers", column: "response_headers_id"

View File

@@ -0,0 +1,21 @@
require "rails_helper"
RSpec.describe Domain::Fa::ApiController, type: :controller do
describe "GET #search_user_names" do
it "returns matching users" do
get :search_user_names, params: { name: "test" }
expect(response).to be_successful
expect(JSON.parse(response.body)).to include("users")
end
end
describe "POST #object_statuses" do
it "returns status of posts and users" do
post :object_statuses, params: { fa_ids: [123], url_names: ["test"] }
expect(response).to be_successful
expect(JSON.parse(response.body)).to include("posts", "users", "queues")
end
end
# Add more tests for other endpoints
end

View File

@@ -0,0 +1,18 @@
require "rails_helper"
RSpec.describe LogEntriesController, type: :controller do
describe "GET #index" do
it "returns filtered log entries" do
get :index, params: { filter: "example.com/test" }
expect(response).to be_successful
end
end
describe "GET #stats" do
it "returns statistics in the specified time window" do
get :stats, params: { seconds: 3600 }
expect(response).to be_successful
expect(assigns(:time_window)).to eq 3600.seconds
end
end
end

View File

@@ -0,0 +1,15 @@
require "rails_helper"
RSpec.describe PagesController, type: :controller do
describe "GET #root" do
it "returns http success" do
get :root
expect(response).to have_http_status(:success)
end
it "renders the root template" do
get :root
expect(response).to render_template(:root)
end
end
end

View File

@@ -0,0 +1,14 @@
require "rails_helper"
describe Domain::E621::Post do
it "ensures indexed_post is created" do
post = SpecUtil.build_e621_post(created_at: 1.day.ago)
expect(post.indexed_post).to be_nil
post.save!
expect(post.indexed_post).to be_present
expect(post.indexed_post.created_at).to eq(post.created_at)
expect(post.indexed_post.postable_id).to eq(post.id)
expect(post.indexed_post.postable_type).to eq("Domain::E621::Post")
expect(post.indexed_post.postable).to eq(post)
end
end

View File

@@ -0,0 +1,14 @@
require "rails_helper"
describe Domain::Fa::Post do
it "ensures indexed_post is created" do
post = SpecUtil.build_domain_fa_post(created_at: 1.day.ago)
expect(post.indexed_post).to be_nil
post.save!
expect(post.indexed_post).to be_present
expect(post.indexed_post.created_at).to eq(post.created_at)
expect(post.indexed_post.postable_id).to eq(post.id)
expect(post.indexed_post.postable_type).to eq("Domain::Fa::Post")
expect(post.indexed_post.postable).to eq(post)
end
end

View File

@@ -198,12 +198,13 @@ class SpecUtil
build_domain_fa_user(...).tap { |model| model.save! }
end
def self.build_domain_fa_post(creator: nil, fa_id: nil)
def self.build_domain_fa_post(creator: nil, fa_id: nil, created_at: nil)
@last_fa_id ||= 0
@last_fa_id += 1
Domain::Fa::Post.new(
creator: creator || build_domain_fa_user,
fa_id: fa_id || @last_fa_id,
created_at: created_at,
)
end
@@ -211,9 +212,17 @@ class SpecUtil
build_domain_fa_post(...).tap { |model| model.save! }
end
def self.build_e621_post(e621_id: nil, file_url_str: nil, md5: nil)
::Domain::E621::Post.new(
{ e621_id: e621_id || 10, file_url_str: file_url_str, md5: md5 },
def self.build_e621_post(
e621_id: nil,
file_url_str: nil,
md5: nil,
created_at: nil
)
Domain::E621::Post.new(
e621_id: e621_id || 10,
file_url_str: file_url_str,
md5: md5,
created_at: created_at,
)
end

View File

@@ -0,0 +1,7 @@
require "test_helper"
class IndexablePostsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end