annotate models
This commit is contained in:
parent
5b56b091b4
commit
22c7e0cdb6
23 changed files with 427 additions and 1 deletions
65
.annotaterb.yml
Normal file
65
.annotaterb.yml
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
:position: before
|
||||
:position_in_additional_file_patterns: before
|
||||
:position_in_class: before
|
||||
:position_in_factory: before
|
||||
:position_in_fixture: before
|
||||
:position_in_routes: before
|
||||
:position_in_serializer: before
|
||||
:position_in_test: before
|
||||
:classified_sort: true
|
||||
:exclude_controllers: true
|
||||
:exclude_factories: false
|
||||
:exclude_fixtures: false
|
||||
:exclude_helpers: true
|
||||
:exclude_scaffolds: true
|
||||
:exclude_serializers: false
|
||||
:exclude_sti_subclasses: false
|
||||
:exclude_tests: false
|
||||
:force: false
|
||||
:format_markdown: false
|
||||
:format_rdoc: false
|
||||
:format_yard: false
|
||||
:frozen: false
|
||||
:grouped_polymorphic: false
|
||||
:ignore_model_sub_dir: false
|
||||
:ignore_unknown_models: false
|
||||
:include_version: false
|
||||
:show_check_constraints: false
|
||||
:show_complete_foreign_keys: false
|
||||
:show_foreign_keys: true
|
||||
:show_indexes: true
|
||||
:show_indexes_include: false
|
||||
:simple_indexes: false
|
||||
:sort: false
|
||||
:timestamp: false
|
||||
:trace: false
|
||||
:with_comment: true
|
||||
:with_column_comments: true
|
||||
:with_table_comments: true
|
||||
:position_of_column_comment: :with_name
|
||||
:active_admin: false
|
||||
:command:
|
||||
:debug: false
|
||||
:hide_default_column_types: ''
|
||||
:hide_limit_column_types: ''
|
||||
:timestamp_columns:
|
||||
- created_at
|
||||
- updated_at
|
||||
:ignore_columns:
|
||||
:ignore_routes:
|
||||
:ignore_multi_database_name: false
|
||||
:models: true
|
||||
:routes: false
|
||||
:skip_on_db_migrate: false
|
||||
:target_action: :do_annotations
|
||||
:wrapper:
|
||||
:wrapper_close:
|
||||
:wrapper_open:
|
||||
:classes_default_to_s: []
|
||||
:additional_file_patterns: []
|
||||
:model_dir:
|
||||
- app/models
|
||||
:require: []
|
||||
:root_dir:
|
||||
- ''
|
||||
|
|
@ -1,2 +1,17 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: admins
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# email :string
|
||||
# name :string
|
||||
# password_digest :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_admins_on_email (email) UNIQUE
|
||||
#
|
||||
class Admin < ApplicationRecord
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: chains
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class Chain < ApplicationRecord
|
||||
has_one_attached :image
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,12 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: guests
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# username :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class Guest < ApplicationRecord
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,24 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: moderation_logs
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# moderatable_type :string not null
|
||||
# reason :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# admin_id :integer not null
|
||||
# moderatable_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_moderation_logs_on_admin_id (admin_id)
|
||||
# index_moderation_logs_on_moderatable (moderatable_type,moderatable_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (admin_id => admins.id)
|
||||
#
|
||||
class ModerationLog < ApplicationRecord
|
||||
belongs_to :moderatable, polymorphic: true
|
||||
belongs_to :admin
|
||||
|
|
|
|||
|
|
@ -1,3 +1,31 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: price_reports
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# discount_price :decimal(, )
|
||||
# downvotes :integer
|
||||
# price :decimal(, )
|
||||
# reported_at :datetime
|
||||
# upvotes :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# guest_id :integer not null
|
||||
# product_id :integer not null
|
||||
# store_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_price_reports_on_guest_id (guest_id)
|
||||
# index_price_reports_on_product_id (product_id)
|
||||
# index_price_reports_on_store_id (store_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (guest_id => guests.id)
|
||||
# fk_rails_... (product_id => products.id)
|
||||
# fk_rails_... (store_id => stores.id)
|
||||
#
|
||||
class PriceReport < ApplicationRecord
|
||||
belongs_to :product
|
||||
belongs_to :store
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: products
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# barcode :string
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_products_on_barcode (barcode) UNIQUE
|
||||
#
|
||||
class Product < ApplicationRecord
|
||||
has_one_attached :image
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,23 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: stores
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# latitude :float
|
||||
# longitude :float
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# chain_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_stores_on_chain_id (chain_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (chain_id => chains.id)
|
||||
#
|
||||
class Store < ApplicationRecord
|
||||
has_one_attached :image
|
||||
belongs_to :chain
|
||||
|
|
|
|||
10
lib/tasks/annotate_rb.rake
Normal file
10
lib/tasks/annotate_rb.rake
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# This rake task was added by annotate_rb gem.
|
||||
|
||||
# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this
|
||||
if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil?
|
||||
require "annotate_rb"
|
||||
|
||||
# Can modify the config path here if needed - by default, it's .annotaterb.yml in the root of the project
|
||||
# AnnotateRb::ConfigFinder.config_path = ""
|
||||
AnnotateRb::Core.load_rake_tasks
|
||||
end
|
||||
15
test/fixtures/admins.yml
vendored
15
test/fixtures/admins.yml
vendored
|
|
@ -1,5 +1,20 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: admins
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# email :string
|
||||
# name :string
|
||||
# password_digest :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_admins_on_email (email) UNIQUE
|
||||
#
|
||||
one:
|
||||
name: MyString
|
||||
email: MyString
|
||||
|
|
|
|||
9
test/fixtures/chains.yml
vendored
9
test/fixtures/chains.yml
vendored
|
|
@ -1,5 +1,14 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: chains
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
one:
|
||||
name: MyString
|
||||
|
||||
|
|
|
|||
10
test/fixtures/guests.yml
vendored
10
test/fixtures/guests.yml
vendored
|
|
@ -1,5 +1,15 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: guests
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# username :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
one:
|
||||
username: MyString
|
||||
name: MyString
|
||||
|
|
|
|||
21
test/fixtures/moderation_logs.yml
vendored
21
test/fixtures/moderation_logs.yml
vendored
|
|
@ -1,5 +1,26 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: moderation_logs
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# moderatable_type :string not null
|
||||
# reason :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# admin_id :integer not null
|
||||
# moderatable_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_moderation_logs_on_admin_id (admin_id)
|
||||
# index_moderation_logs_on_moderatable (moderatable_type,moderatable_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (admin_id => admins.id)
|
||||
#
|
||||
one:
|
||||
reason: MyString
|
||||
moderatable: one
|
||||
|
|
|
|||
28
test/fixtures/price_reports.yml
vendored
28
test/fixtures/price_reports.yml
vendored
|
|
@ -1,5 +1,33 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: price_reports
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# discount_price :decimal(, )
|
||||
# downvotes :integer
|
||||
# price :decimal(, )
|
||||
# reported_at :datetime
|
||||
# upvotes :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# guest_id :integer not null
|
||||
# product_id :integer not null
|
||||
# store_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_price_reports_on_guest_id (guest_id)
|
||||
# index_price_reports_on_product_id (product_id)
|
||||
# index_price_reports_on_store_id (store_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (guest_id => guests.id)
|
||||
# fk_rails_... (product_id => products.id)
|
||||
# fk_rails_... (store_id => stores.id)
|
||||
#
|
||||
one:
|
||||
price: 9.99
|
||||
discount_price: 9.99
|
||||
|
|
|
|||
16
test/fixtures/products.yml
vendored
16
test/fixtures/products.yml
vendored
|
|
@ -1,5 +1,19 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: products
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# barcode :string
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_products_on_barcode (barcode) UNIQUE
|
||||
#
|
||||
one:
|
||||
name: MyString
|
||||
barcode: MyString
|
||||
barcode: MyString
|
||||
|
|
|
|||
20
test/fixtures/stores.yml
vendored
20
test/fixtures/stores.yml
vendored
|
|
@ -1,5 +1,25 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: stores
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# latitude :float
|
||||
# longitude :float
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# chain_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_stores_on_chain_id (chain_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (chain_id => chains.id)
|
||||
#
|
||||
one:
|
||||
name: MyString
|
||||
latitude: 1.5
|
||||
|
|
|
|||
|
|
@ -1,3 +1,18 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: admins
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# email :string
|
||||
# name :string
|
||||
# password_digest :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_admins_on_email (email) UNIQUE
|
||||
#
|
||||
require "test_helper"
|
||||
|
||||
class AdminTest < ActiveSupport::TestCase
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: chains
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
require "test_helper"
|
||||
|
||||
class ChainTest < ActiveSupport::TestCase
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: guests
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# username :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
require "test_helper"
|
||||
|
||||
class GuestTest < ActiveSupport::TestCase
|
||||
|
|
|
|||
|
|
@ -1,3 +1,24 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: moderation_logs
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# moderatable_type :string not null
|
||||
# reason :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# admin_id :integer not null
|
||||
# moderatable_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_moderation_logs_on_admin_id (admin_id)
|
||||
# index_moderation_logs_on_moderatable (moderatable_type,moderatable_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (admin_id => admins.id)
|
||||
#
|
||||
require "test_helper"
|
||||
|
||||
class ModerationLogTest < ActiveSupport::TestCase
|
||||
|
|
|
|||
|
|
@ -1,3 +1,31 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: price_reports
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# discount_price :decimal(, )
|
||||
# downvotes :integer
|
||||
# price :decimal(, )
|
||||
# reported_at :datetime
|
||||
# upvotes :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# guest_id :integer not null
|
||||
# product_id :integer not null
|
||||
# store_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_price_reports_on_guest_id (guest_id)
|
||||
# index_price_reports_on_product_id (product_id)
|
||||
# index_price_reports_on_store_id (store_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (guest_id => guests.id)
|
||||
# fk_rails_... (product_id => products.id)
|
||||
# fk_rails_... (store_id => stores.id)
|
||||
#
|
||||
require "test_helper"
|
||||
|
||||
class PriceReportTest < ActiveSupport::TestCase
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: products
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# barcode :string
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_products_on_barcode (barcode) UNIQUE
|
||||
#
|
||||
require "test_helper"
|
||||
|
||||
class ProductTest < ActiveSupport::TestCase
|
||||
|
|
|
|||
|
|
@ -1,3 +1,23 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: stores
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# latitude :float
|
||||
# longitude :float
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# chain_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_stores_on_chain_id (chain_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (chain_id => chains.id)
|
||||
#
|
||||
require "test_helper"
|
||||
|
||||
class StoreTest < ActiveSupport::TestCase
|
||||
|
|
|
|||
Loading…
Reference in a new issue