ai tags: make ai tags accessible in api via includes.
Make these things work: * https://danbooru.donmai.us/posts.json?only=ai_tags * https://danbooru.donmai.us/media_assets.json?only=ai_tags * https://danbooru.donmai.us/ai_tags.json?only=media_asset,post,tag
This commit is contained in:
@@ -50,4 +50,8 @@ class AITag < ApplicationRecord
|
||||
post.has_tag?(tag.name)
|
||||
end
|
||||
end
|
||||
|
||||
def self.available_includes
|
||||
%i[media_asset post tag]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -388,4 +388,8 @@ class MediaAsset < ApplicationRecord
|
||||
def initialize_file_key
|
||||
self.file_key = MediaAsset.generate_file_key
|
||||
end
|
||||
|
||||
def self.available_includes
|
||||
%i[post media_metadata pixiv_ugoira_frame_data ai_tags]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,6 +69,7 @@ class Post < ApplicationRecord
|
||||
has_many :disapprovals, :class_name => "PostDisapproval", :dependent => :destroy
|
||||
has_many :favorites, dependent: :destroy
|
||||
has_many :replacements, class_name: "PostReplacement", :dependent => :destroy
|
||||
has_many :ai_tags, through: :media_asset
|
||||
|
||||
attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning, :post_edit
|
||||
|
||||
@@ -1639,7 +1640,7 @@ class Post < ApplicationRecord
|
||||
%i[
|
||||
uploader approver flags appeals parent children notes
|
||||
comments approvals disapprovals replacements pixiv_ugoira_frame_data
|
||||
artist_commentary
|
||||
artist_commentary media_asset ai_tags
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user