Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/alert_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# updated_at :datetime not null
# stolen_record_id :integer not null
#
# Indexes
#
# index_alert_images_on_stolen_record_id (stolen_record_id)
#
# Foreign Keys
#
# fk_rails_... (stolen_record_id => stolen_records.id)
Expand Down
7 changes: 6 additions & 1 deletion app/models/ambassador.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
# partner_data :jsonb
# password :text
# password_digest :string(255)
# token_for_password_reset :text
# phone :string(255)
# preferred_language :string
# show_bikes :boolean default(FALSE), not null
Expand All @@ -46,6 +45,7 @@
# terms_of_service :boolean default(FALSE), not null
# time_single_format :boolean default(FALSE)
# title :text
# token_for_password_reset :text
# twitter :string(255)
# username :string(255)
# vendor_terms_of_service :boolean
Expand All @@ -57,6 +57,11 @@
# state_id :integer
# stripe_id :string(255)
#
# Indexes
#
# index_users_on_auth_token (auth_token)
# index_users_on_token_for_password_reset (token_for_password_reset)
#
class Ambassador < User
default_scope -> { ambassadors }

Expand Down
4 changes: 4 additions & 0 deletions app/models/ambassador_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_ambassador_tasks_on_title (title) UNIQUE
#
class AmbassadorTask < ApplicationRecord
has_many :ambassador_task_assignments
has_many :ambassadors, through: :ambassador_task_assignments
Expand Down
5 changes: 5 additions & 0 deletions app/models/ambassador_task_assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
# ambassador_task_id :integer not null
# user_id :integer not null
#
# Indexes
#
# index_ambassador_task_assignments_on_ambassador_task_id (ambassador_task_id)
# unique_assignment_to_ambassador (user_id,ambassador_task_id) UNIQUE
#
# Foreign Keys
#
# fk_rails_... (ambassador_task_id => ambassador_tasks.id) ON DELETE => cascade
Expand Down
4 changes: 4 additions & 0 deletions app/models/b_param.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# creator_id :integer
# organization_id :integer
#
# Indexes
#
# index_b_params_on_organization_id (organization_id)
#

# b_param stands for Bike param
class BParam < ApplicationRecord
Expand Down
4 changes: 4 additions & 0 deletions app/models/banned_email_domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# updated_at :datetime not null
# creator_id :bigint
#
# Indexes
#
# index_banned_email_domains_on_creator_id (creator_id)
#
class BannedEmailDomain < ApplicationRecord
BIKE_MAX_COUNT = 2
EMAIL_MIN_COUNT = 500
Expand Down
20 changes: 20 additions & 0 deletions app/models/bike.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@
# tertiary_frame_color_id :integer
# updator_id :integer
#
# Indexes
#
# index_bikes_on_current_impound_record_id (current_impound_record_id)
# index_bikes_on_current_ownership_id (current_ownership_id)
# index_bikes_on_current_stolen_record_id (current_stolen_record_id)
# index_bikes_on_deleted_at (deleted_at)
# index_bikes_on_example (example)
# index_bikes_on_latitude_and_longitude (latitude,longitude)
# index_bikes_on_listing_order (listing_order)
# index_bikes_on_manufacturer_id (manufacturer_id)
# index_bikes_on_model_audit_id (model_audit_id)
# index_bikes_on_organization_id (creation_organization_id)
# index_bikes_on_paint_id (paint_id)
# index_bikes_on_primary_frame_color_id (primary_frame_color_id)
# index_bikes_on_secondary_frame_color_id (secondary_frame_color_id)
# index_bikes_on_state_id (state_id)
# index_bikes_on_status (status)
# index_bikes_on_tertiary_frame_color_id (tertiary_frame_color_id)
# index_bikes_on_user_hidden (user_hidden)
#
class Bike < ApplicationRecord
include ActiveModel::Dirty
include BikeSearchable
Expand Down
6 changes: 6 additions & 0 deletions app/models/bike_organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
# bike_id :integer
# organization_id :integer
#
# Indexes
#
# index_bike_organizations_on_bike_id (bike_id)
# index_bike_organizations_on_deleted_at (deleted_at)
# index_bike_organizations_on_organization_id (organization_id)
#
class BikeOrganization < ApplicationRecord
acts_as_paranoid

Expand Down
6 changes: 6 additions & 0 deletions app/models/bike_sticker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
# secondary_organization_id :bigint
# user_id :integer
#
# Indexes
#
# index_bike_stickers_on_bike_id (bike_id)
# index_bike_stickers_on_bike_sticker_batch_id (bike_sticker_batch_id)
# index_bike_stickers_on_secondary_organization_id (secondary_organization_id)
#
class BikeSticker < ApplicationRecord
KIND_ENUM = {sticker: 0, spokecard: 1}.freeze
MAX_UNORGANIZED = 20
Expand Down
5 changes: 5 additions & 0 deletions app/models/bike_sticker_batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
# organization_id :integer
# user_id :integer
#
# Indexes
#
# index_bike_sticker_batches_on_organization_id (organization_id)
# index_bike_sticker_batches_on_user_id (user_id)
#
class BikeStickerBatch < ApplicationRecord
belongs_to :user # Creator of the batch
belongs_to :organization
Expand Down
9 changes: 9 additions & 0 deletions app/models/bike_sticker_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
# organization_id :bigint
# user_id :bigint
#
# Indexes
#
# index_bike_sticker_updates_on_bike_id (bike_id)
# index_bike_sticker_updates_on_bike_sticker_id (bike_sticker_id)
# index_bike_sticker_updates_on_bulk_import_id (bulk_import_id)
# index_bike_sticker_updates_on_export_id (export_id)
# index_bike_sticker_updates_on_organization_id (organization_id)
# index_bike_sticker_updates_on_user_id (user_id)
#
class BikeStickerUpdate < ApplicationRecord
KIND_ENUM = {initial_claim: 0, re_claim: 1, un_claim: 2, failed_claim: 3, admin_reassign: 4}.freeze
CREATOR_KIND_ENUM = {creator_user: 0, creator_export: 1, creator_pos: 2, creator_bike_creation: 3, creator_import: 4}.freeze
Expand Down
14 changes: 14 additions & 0 deletions app/models/bike_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
# secondary_frame_color_id :bigint
# tertiary_frame_color_id :bigint
#
# Indexes
#
# index_bike_versions_on_bike_id (bike_id)
# index_bike_versions_on_front_gear_type_id (front_gear_type_id)
# index_bike_versions_on_front_wheel_size_id (front_wheel_size_id)
# index_bike_versions_on_manufacturer_id (manufacturer_id)
# index_bike_versions_on_owner_id (owner_id)
# index_bike_versions_on_paint_id (paint_id)
# index_bike_versions_on_primary_frame_color_id (primary_frame_color_id)
# index_bike_versions_on_rear_gear_type_id (rear_gear_type_id)
# index_bike_versions_on_rear_wheel_size_id (rear_wheel_size_id)
# index_bike_versions_on_secondary_frame_color_id (secondary_frame_color_id)
# index_bike_versions_on_tertiary_frame_color_id (tertiary_frame_color_id)
#
class BikeVersion < ApplicationRecord
include BikeSearchable
include BikeAttributable
Expand Down
5 changes: 5 additions & 0 deletions app/models/blog_content_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
# blog_id :bigint
# content_tag_id :bigint
#
# Indexes
#
# index_blog_content_tags_on_blog_id (blog_id)
# index_blog_content_tags_on_content_tag_id (content_tag_id)
#
class BlogContentTag < ApplicationRecord
belongs_to :blog
belongs_to :content_tag
Expand Down
6 changes: 6 additions & 0 deletions app/models/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
# ctype_id :integer
# manufacturer_id :integer
#
# Indexes
#
# index_components_on_bike_id (bike_id)
# index_components_on_bike_version_id (bike_version_id)
# index_components_on_manufacturer_id (manufacturer_id)
#
class Component < ApplicationRecord
include ActiveModel::Dirty

Expand Down
4 changes: 4 additions & 0 deletions app/models/exchange_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_exchange_rates_on_from_and_to (from,to) UNIQUE
#
class ExchangeRate < ApplicationRecord
validates :from, :to, :rate, presence: true
validates :from, :to, format: {with: /\A[A-Z]{3}\z/, message: "must be a valid ISO currency code"}
Expand Down
5 changes: 5 additions & 0 deletions app/models/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# organization_id :integer
# user_id :integer
#
# Indexes
#
# index_exports_on_organization_id (organization_id)
# index_exports_on_user_id (user_id)
#
class Export < ApplicationRecord
PROGRESS_ENUM = {
pending: 0,
Expand Down
7 changes: 7 additions & 0 deletions app/models/external_registry_bike.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
# country_id :integer not null
# external_id :string not null
#
# Indexes
#
# index_external_registry_bikes_on_country_id (country_id)
# index_external_registry_bikes_on_external_id (external_id)
# index_external_registry_bikes_on_serial_normalized (serial_normalized)
# index_external_registry_bikes_on_type (type)
#
class ExternalRegistryBike < ApplicationRecord
belongs_to :country, class_name: "Country"

Expand Down
7 changes: 7 additions & 0 deletions app/models/external_registry_bike/project529_bike.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
# country_id :integer not null
# external_id :string not null
#
# Indexes
#
# index_external_registry_bikes_on_country_id (country_id)
# index_external_registry_bikes_on_external_id (external_id)
# index_external_registry_bikes_on_serial_normalized (serial_normalized)
# index_external_registry_bikes_on_type (type)
#
class ExternalRegistryBike::Project529Bike < ExternalRegistryBike
def registry_url
"https://project529.com"
Expand Down
7 changes: 7 additions & 0 deletions app/models/external_registry_bike/stop_heling_bike.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
# country_id :integer not null
# external_id :string not null
#
# Indexes
#
# index_external_registry_bikes_on_country_id (country_id)
# index_external_registry_bikes_on_external_id (external_id)
# index_external_registry_bikes_on_serial_normalized (serial_normalized)
# index_external_registry_bikes_on_type (type)
#
class ExternalRegistryBike::StopHelingBike < ExternalRegistryBike
def registry_url
"https://www.stopheling.nl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
# country_id :integer not null
# external_id :string not null
#
# Indexes
#
# index_external_registry_bikes_on_country_id (country_id)
# index_external_registry_bikes_on_external_id (external_id)
# index_external_registry_bikes_on_serial_normalized (serial_normalized)
# index_external_registry_bikes_on_type (type)
#
class ExternalRegistryBike::VerlorenOfGevondenBike < ExternalRegistryBike
def registry_url
"https://verlorenofgevonden.nl"
Expand Down
4 changes: 4 additions & 0 deletions app/models/external_registry_credential.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# updated_at :datetime not null
# app_id :string
#
# Indexes
#
# index_external_registry_credentials_on_type (type)
#
class ExternalRegistryCredential < ApplicationRecord
validates :type, uniqueness: true
validates :app_id, uniqueness: {scope: :type}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# updated_at :datetime not null
# app_id :string
#
# Indexes
#
# index_external_registry_credentials_on_type (type)
#
class ExternalRegistryCredential::Project529Credential < ExternalRegistryCredential
validates :app_id, :refresh_token, presence: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# updated_at :datetime not null
# app_id :string
#
# Indexes
#
# index_external_registry_credentials_on_type (type)
#
class ExternalRegistryCredential::StopHelingCredential < ExternalRegistryCredential
validates :app_id, :access_token, presence: true

Expand Down
5 changes: 5 additions & 0 deletions app/models/feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
# mailchimp_datum_id :bigint
# user_id :integer
#
# Indexes
#
# index_feedbacks_on_mailchimp_datum_id (mailchimp_datum_id)
# index_feedbacks_on_user_id (user_id)
#
class Feedback < ApplicationRecord
KIND_ENUM = {
message: 0,
Expand Down
10 changes: 10 additions & 0 deletions app/models/graduated_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
# primary_notification_id :bigint
# user_id :bigint
#
# Indexes
#
# index_graduated_notifications_on_bike_id (bike_id)
# index_graduated_notifications_on_bike_organization_id (bike_organization_id)
# index_graduated_notifications_on_marked_remaining_by_id (marked_remaining_by_id)
# index_graduated_notifications_on_organization_id (organization_id)
# index_graduated_notifications_on_primary_bike_id (primary_bike_id)
# index_graduated_notifications_on_primary_notification_id (primary_notification_id)
# index_graduated_notifications_on_user_id (user_id)
#
class GraduatedNotification < ApplicationRecord
STATUS_ENUM = {pending: 0, bike_graduated: 1, marked_remaining: 2}.freeze
PENDING_PERIOD = 24.hours.freeze
Expand Down
4 changes: 4 additions & 0 deletions app/models/hot_sheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# updated_at :datetime not null
# organization_id :bigint
#
# Indexes
#
# index_hot_sheets_on_organization_id (organization_id)
#
class HotSheet < ApplicationRecord
belongs_to :organization

Expand Down
4 changes: 4 additions & 0 deletions app/models/hot_sheet_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# updated_at :datetime not null
# organization_id :bigint
#
# Indexes
#
# index_hot_sheet_configurations_on_organization_id (organization_id)
#
class HotSheetConfiguration < ApplicationRecord
include SearchRadiusMetricable

Expand Down
9 changes: 9 additions & 0 deletions app/models/impound_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
# stolen_record_id :bigint
# user_id :bigint
#
# Indexes
#
# index_impound_claims_on_bike_claimed_id (bike_claimed_id)
# index_impound_claims_on_bike_submitting_id (bike_submitting_id)
# index_impound_claims_on_impound_record_id (impound_record_id)
# index_impound_claims_on_organization_id (organization_id)
# index_impound_claims_on_stolen_record_id (stolen_record_id)
# index_impound_claims_on_user_id (user_id)
#
class ImpoundClaim < ApplicationRecord
STATUS_ENUM = {
pending: 0,
Expand Down
Loading