Annotations (#327)

* Add annotate gem to the project
* Annotate models, fixtures, factories and model_specs
* Keep annotations only in Models
* Remove unwanted changes in model specs
* Exclude auto_annotate_models from rubocop
This commit is contained in:
Mukesh Chaudhary
2019-11-30 19:09:55 +05:30
committed by Sojan Jose
parent 60e96f446e
commit c08074b981
18 changed files with 335 additions and 0 deletions

View File

@@ -1,3 +1,13 @@
# == Schema Information
#
# Table name: accounts
#
# id :integer not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
#
class Account < ApplicationRecord
include Events::Types

View File

@@ -1,3 +1,21 @@
# == Schema Information
#
# Table name: attachments
#
# id :integer not null, primary key
# coordinates_lat :float default(0.0)
# coordinates_long :float default(0.0)
# extension :string
# external_url :string
# fallback_title :string
# file :string
# file_type :integer default("image")
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
# message_id :integer not null
#
require 'uri'
require 'open-uri'
class Attachment < ApplicationRecord

View File

@@ -1,3 +1,15 @@
# == Schema Information
#
# Table name: canned_responses
#
# id :integer not null, primary key
# content :text
# short_code :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
#
class CannedResponse < ApplicationRecord
validates_presence_of :content
validates_presence_of :short_code

View File

@@ -1,3 +1,22 @@
# == Schema Information
#
# Table name: channel_facebook_pages
#
# id :integer not null, primary key
# avatar :string
# name :string not null
# page_access_token :string not null
# user_access_token :string not null
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
# page_id :string not null
#
# Indexes
#
# index_channel_facebook_pages_on_page_id (page_id)
#
module Channel
class FacebookPage < ApplicationRecord
self.table_name = 'channel_facebook_pages'

View File

@@ -1,3 +1,21 @@
# == Schema Information
#
# Table name: channel_web_widgets
#
# id :integer not null, primary key
# website_name :string
# website_token :string
# website_url :string
# widget_color :string default("#1f93ff")
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
#
# Indexes
#
# index_channel_web_widgets_on_website_token (website_token) UNIQUE
#
module Channel
class WebWidget < ApplicationRecord
self.table_name = 'channel_web_widgets'

View File

@@ -1,3 +1,23 @@
# == Schema Information
#
# Table name: contacts
#
# id :integer not null, primary key
# avatar :string
# email :string
# name :string
# phone_number :string
# pubsub_token :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
#
# Indexes
#
# index_contacts_on_account_id (account_id)
# index_contacts_on_pubsub_token (pubsub_token) UNIQUE
#
class Contact < ApplicationRecord
include Pubsubable
validates :account_id, presence: true

View File

@@ -1,3 +1,27 @@
# == Schema Information
#
# Table name: contact_inboxes
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# contact_id :bigint
# inbox_id :bigint
# source_id :string not null
#
# Indexes
#
# index_contact_inboxes_on_contact_id (contact_id)
# index_contact_inboxes_on_inbox_id (inbox_id)
# index_contact_inboxes_on_inbox_id_and_source_id (inbox_id,source_id) UNIQUE
# index_contact_inboxes_on_source_id (source_id)
#
# Foreign Keys
#
# fk_rails_... (contact_id => contacts.id)
# fk_rails_... (inbox_id => inboxes.id)
#
class ContactInbox < ApplicationRecord
validates :inbox_id, presence: true
validates :contact_id, presence: true

View File

@@ -1,3 +1,27 @@
# == Schema Information
#
# Table name: conversations
#
# id :integer not null, primary key
# additional_attributes :jsonb
# agent_last_seen_at :datetime
# locked :boolean default(FALSE)
# status :integer default("open"), not null
# user_last_seen_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
# assignee_id :integer
# contact_id :bigint
# display_id :integer not null
# inbox_id :integer not null
#
# Indexes
#
# index_conversations_on_account_id (account_id)
# index_conversations_on_account_id_and_display_id (account_id,display_id) UNIQUE
#
class Conversation < ApplicationRecord
include Events::Types

View File

@@ -1,5 +1,22 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: inboxes
#
# id :integer not null, primary key
# channel_type :string
# name :string not null
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
# channel_id :integer not null
#
# Indexes
#
# index_inboxes_on_account_id (account_id)
#
class Inbox < ApplicationRecord
validates :account_id, presence: true

View File

@@ -1,3 +1,18 @@
# == Schema Information
#
# Table name: inbox_members
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# inbox_id :integer not null
# user_id :integer not null
#
# Indexes
#
# index_inbox_members_on_inbox_id (inbox_id)
#
class InboxMember < ApplicationRecord
validates :inbox_id, presence: true
validates :user_id, presence: true

View File

@@ -1,3 +1,25 @@
# == Schema Information
#
# Table name: messages
#
# id :integer not null, primary key
# content :text
# message_type :integer not null
# private :boolean default(FALSE)
# status :integer default("sent")
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
# conversation_id :integer not null
# fb_id :string
# inbox_id :integer not null
# user_id :integer
#
# Indexes
#
# index_messages_on_conversation_id (conversation_id)
#
class Message < ApplicationRecord
include Events::Types

View File

@@ -1,3 +1,19 @@
# == Schema Information
#
# Table name: subscriptions
#
# id :integer not null, primary key
# billing_plan :string default("trial")
# expiry :datetime
# payment_source_added :boolean default(FALSE)
# pricing_version :string
# state :integer default("trial")
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
# stripe_customer_id :string
#
class Subscription < ApplicationRecord
include Events::Types

View File

@@ -1,3 +1,15 @@
# == Schema Information
#
# Table name: telegram_bots
#
# id :integer not null, primary key
# auth_key :string
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
#
class TelegramBot < ApplicationRecord
belongs_to :account
has_one :inbox, as: :channel, dependent: :destroy

View File

@@ -1,3 +1,48 @@
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# confirmation_sent_at :datetime
# confirmation_token :string
# confirmed_at :datetime
# current_sign_in_at :datetime
# current_sign_in_ip :string
# email :string
# encrypted_password :string default(""), not null
# image :string
# last_sign_in_at :datetime
# last_sign_in_ip :string
# name :string not null
# nickname :string
# provider :string default("email"), not null
# pubsub_token :string
# remember_created_at :datetime
# reset_password_sent_at :datetime
# reset_password_token :string
# role :integer default("agent")
# sign_in_count :integer default(0), not null
# tokens :json
# uid :string default(""), not null
# unconfirmed_email :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null
# inviter_id :bigint
#
# Indexes
#
# index_users_on_email (email)
# index_users_on_inviter_id (inviter_id)
# index_users_on_pubsub_token (pubsub_token) UNIQUE
# index_users_on_reset_password_token (reset_password_token) UNIQUE
# index_users_on_uid_and_provider (uid,provider) UNIQUE
#
# Foreign Keys
#
# fk_rails_... (inviter_id => users.id) ON DELETE => nullify
#
class User < ApplicationRecord
# Include default devise modules.
include DeviseTokenAuth::Concerns::User