diff options
author | yhirano <yhirano@me.com> | 2017-05-02 09:14:47 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-02 02:14:47 +0200 |
commit | 298796cc7b4fdc075be659fc6aea7ab2543a0f9d (patch) | |
tree | f70f563b70284f5458c1897bacd3d8d0371a14f2 /app/models | |
parent | a4859446abea166ae55806169425646c1bd42f85 (diff) |
annotate models (#2697)
* add annotate to Gemfile * rails g annotate:install * configure annotate_models * add schema info to models * fix rubocop to add frozen_string_literal
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 38 | ||||
-rw-r--r-- | app/models/block.rb | 10 | ||||
-rw-r--r-- | app/models/domain_block.rb | 11 | ||||
-rw-r--r-- | app/models/favourite.rb | 10 | ||||
-rw-r--r-- | app/models/follow.rb | 10 | ||||
-rw-r--r-- | app/models/follow_request.rb | 10 | ||||
-rw-r--r-- | app/models/import.rb | 15 | ||||
-rw-r--r-- | app/models/media_attachment.rb | 18 | ||||
-rw-r--r-- | app/models/mention.rb | 10 | ||||
-rw-r--r-- | app/models/mute.rb | 10 | ||||
-rw-r--r-- | app/models/notification.rb | 12 | ||||
-rw-r--r-- | app/models/preview_card.rb | 24 | ||||
-rw-r--r-- | app/models/report.rb | 14 | ||||
-rw-r--r-- | app/models/setting.rb | 12 | ||||
-rw-r--r-- | app/models/status.rb | 23 | ||||
-rw-r--r-- | app/models/stream_entry.rb | 12 | ||||
-rw-r--r-- | app/models/subscription.rb | 14 | ||||
-rw-r--r-- | app/models/tag.rb | 9 | ||||
-rw-r--r-- | app/models/user.rb | 33 | ||||
-rw-r--r-- | app/models/web/setting.rb | 10 |
20 files changed, 305 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index c5fc6d7ab..88f25aa4b 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,4 +1,42 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: accounts +# +# id :integer not null, primary key +# username :string default(""), not null +# domain :string +# secret :string default(""), not null +# private_key :text +# public_key :text default(""), not null +# remote_url :string default(""), not null +# salmon_url :string default(""), not null +# hub_url :string default(""), not null +# created_at :datetime not null +# updated_at :datetime not null +# note :text default(""), not null +# display_name :string default(""), not null +# uri :string default(""), not null +# url :string +# avatar_file_name :string +# avatar_content_type :string +# avatar_file_size :integer +# avatar_updated_at :datetime +# header_file_name :string +# header_content_type :string +# header_file_size :integer +# header_updated_at :datetime +# avatar_remote_url :string +# subscription_expires_at :datetime +# silenced :boolean default(FALSE), not null +# suspended :boolean default(FALSE), not null +# locked :boolean default(FALSE), not null +# header_remote_url :string default(""), not null +# statuses_count :integer default(0), not null +# followers_count :integer default(0), not null +# following_count :integer default(0), not null +# last_webfingered_at :datetime +# class Account < ApplicationRecord include Targetable diff --git a/app/models/block.rb b/app/models/block.rb index c978b2200..edb0d2d11 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -1,4 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: blocks +# +# id :integer not null, primary key +# account_id :integer not null +# target_account_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# class Block < ApplicationRecord include Paginable diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index 6c2ba70f7..99dae9c1d 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -1,4 +1,15 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: domain_blocks +# +# id :integer not null, primary key +# domain :string default(""), not null +# created_at :datetime not null +# updated_at :datetime not null +# severity :integer default("silence") +# reject_media :boolean +# class DomainBlock < ApplicationRecord enum severity: [:silence, :suspend] diff --git a/app/models/favourite.rb b/app/models/favourite.rb index 32d54476b..53c79ccea 100644 --- a/app/models/favourite.rb +++ b/app/models/favourite.rb @@ -1,4 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: favourites +# +# id :integer not null, primary key +# account_id :integer not null +# status_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# class Favourite < ApplicationRecord include Paginable diff --git a/app/models/follow.rb b/app/models/follow.rb index b6b9dca7c..863710f5d 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -1,4 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: follows +# +# id :integer not null, primary key +# account_id :integer not null +# target_account_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# class Follow < ApplicationRecord include Paginable diff --git a/app/models/follow_request.rb b/app/models/follow_request.rb index 20e1332dd..458c3a2cd 100644 --- a/app/models/follow_request.rb +++ b/app/models/follow_request.rb @@ -1,4 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: follow_requests +# +# id :integer not null, primary key +# account_id :integer not null +# target_account_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# class FollowRequest < ApplicationRecord include Paginable diff --git a/app/models/import.rb b/app/models/import.rb index 85f6ca4bd..8c6253d49 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -1,4 +1,19 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: imports +# +# id :integer not null, primary key +# account_id :integer not null +# type :integer not null +# approved :boolean +# created_at :datetime not null +# updated_at :datetime not null +# data_file_name :string +# data_content_type :string +# data_file_size :integer +# data_updated_at :datetime +# class Import < ApplicationRecord FILE_TYPES = ['text/plain', 'text/csv'].freeze diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 2ebddcb69..1613346ff 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -1,4 +1,22 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: media_attachments +# +# id :integer not null, primary key +# status_id :integer +# file_file_name :string +# file_content_type :string +# file_file_size :integer +# file_updated_at :datetime +# remote_url :string default(""), not null +# account_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# shortcode :string +# type :integer default("image"), not null +# file_meta :json +# class MediaAttachment < ApplicationRecord self.inheritance_column = nil diff --git a/app/models/mention.rb b/app/models/mention.rb index 03e76fcc4..a8d243259 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -1,4 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: mentions +# +# id :integer not null, primary key +# account_id :integer +# status_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# class Mention < ApplicationRecord belongs_to :account, inverse_of: :mentions, required: true diff --git a/app/models/mute.rb b/app/models/mute.rb index d0de62ed5..00e5661a7 100644 --- a/app/models/mute.rb +++ b/app/models/mute.rb @@ -1,4 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: mutes +# +# id :integer not null, primary key +# account_id :integer not null +# target_account_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# class Mute < ApplicationRecord include Paginable diff --git a/app/models/notification.rb b/app/models/notification.rb index 302d4382d..5b8f46cad 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,4 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: notifications +# +# id :integer not null, primary key +# account_id :integer +# activity_id :integer +# activity_type :string +# created_at :datetime not null +# updated_at :datetime not null +# from_account_id :integer +# class Notification < ApplicationRecord include Paginable diff --git a/app/models/preview_card.rb b/app/models/preview_card.rb index 238588157..a57f1252c 100644 --- a/app/models/preview_card.rb +++ b/app/models/preview_card.rb @@ -1,4 +1,28 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: preview_cards +# +# id :integer not null, primary key +# status_id :integer +# url :string default(""), not null +# title :string +# description :string +# image_file_name :string +# image_content_type :string +# image_file_size :integer +# image_updated_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# type :integer default("link"), not null +# html :text default(""), not null +# author_name :string default(""), not null +# author_url :string default(""), not null +# provider_name :string default(""), not null +# provider_url :string default(""), not null +# width :integer default(0), not null +# height :integer default(0), not null +# class PreviewCard < ApplicationRecord IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze diff --git a/app/models/report.rb b/app/models/report.rb index d813d0d0d..7c317490b 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -1,4 +1,18 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: reports +# +# id :integer not null, primary key +# account_id :integer not null +# target_account_id :integer not null +# status_ids :integer default([]), not null, is an Array +# comment :text default(""), not null +# action_taken :boolean default(FALSE), not null +# created_at :datetime not null +# updated_at :datetime not null +# action_taken_by_account_id :integer +# class Report < ApplicationRecord belongs_to :account diff --git a/app/models/setting.rb b/app/models/setting.rb index 31e1ee198..db16f228b 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -1,4 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: settings +# +# id :integer not null, primary key +# var :string not null +# value :text +# thing_type :string +# thing_id :integer +# created_at :datetime +# updated_at :datetime +# class Setting < RailsSettings::Base source Rails.root.join('config/settings.yml') diff --git a/app/models/status.rb b/app/models/status.rb index 3243d1ecb..4808b1a64 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -1,4 +1,27 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: statuses +# +# id :integer not null, primary key +# uri :string +# account_id :integer not null +# text :text default(""), not null +# created_at :datetime not null +# updated_at :datetime not null +# in_reply_to_id :integer +# reblog_of_id :integer +# url :string +# sensitive :boolean default(FALSE) +# visibility :integer default("public"), not null +# in_reply_to_account_id :integer +# application_id :integer +# spoiler_text :text default(""), not null +# reply :boolean default(FALSE) +# favourites_count :integer default(0), not null +# reblogs_count :integer default(0), not null +# language :string default("en"), not null +# class Status < ApplicationRecord include Paginable diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb index 8aff5ae06..c173e6257 100644 --- a/app/models/stream_entry.rb +++ b/app/models/stream_entry.rb @@ -1,4 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: stream_entries +# +# id :integer not null, primary key +# account_id :integer +# activity_id :integer +# activity_type :string +# created_at :datetime not null +# updated_at :datetime not null +# hidden :boolean default(FALSE), not null +# class StreamEntry < ApplicationRecord include Paginable diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 63553e9fe..6a039cf07 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -1,4 +1,18 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: subscriptions +# +# id :integer not null, primary key +# callback_url :string default(""), not null +# secret :string +# expires_at :datetime +# confirmed :boolean default(FALSE), not null +# account_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# last_successful_delivery_at :datetime +# class Subscription < ApplicationRecord MIN_EXPIRATION = 3600 * 24 * 7 diff --git a/app/models/tag.rb b/app/models/tag.rb index 6209d7dab..4001e6ed5 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,4 +1,13 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: tags +# +# id :integer not null, primary key +# name :string default(""), not null +# created_at :datetime not null +# updated_at :datetime not null +# class Tag < ApplicationRecord has_and_belongs_to_many :statuses diff --git a/app/models/user.rb b/app/models/user.rb index 48e7b8088..f6e080d4e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,37 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: users +# +# id :integer not null, primary key +# email :string default(""), not null +# account_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# encrypted_password :string default(""), not null +# reset_password_token :string +# reset_password_sent_at :datetime +# remember_created_at :datetime +# sign_in_count :integer default(0), not null +# current_sign_in_at :datetime +# last_sign_in_at :datetime +# current_sign_in_ip :inet +# last_sign_in_ip :inet +# admin :boolean default(FALSE) +# confirmation_token :string +# confirmed_at :datetime +# confirmation_sent_at :datetime +# unconfirmed_email :string +# locale :string +# encrypted_otp_secret :string +# encrypted_otp_secret_iv :string +# encrypted_otp_secret_salt :string +# consumed_timestep :integer +# otp_required_for_login :boolean +# last_emailed_at :datetime +# otp_backup_codes :string is an Array +# allowed_languages :string default([]), not null, is an Array +# class User < ApplicationRecord include Settings::Extend diff --git a/app/models/web/setting.rb b/app/models/web/setting.rb index 3d601189b..04a049523 100644 --- a/app/models/web/setting.rb +++ b/app/models/web/setting.rb @@ -1,4 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: web_settings +# +# id :integer not null, primary key +# user_id :integer +# data :json +# created_at :datetime not null +# updated_at :datetime not null +# class Web::Setting < ApplicationRecord belongs_to :user |