Skip to content

Commit cba59d4

Browse files
committed
Update model annotations with schema info
1 parent f20c8d1 commit cba59d4

File tree

4 files changed

+124
-18
lines changed

4 files changed

+124
-18
lines changed

app/models/pwb/price_guess.rb

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,35 @@ module Pwb
44
# PriceGuess represents a visitor's guess in the "Guess the Price" game.
55
# Polymorphic: can belong to either SaleListing or RentalListing.
66
#
7-
# == Schema Information
8-
#
9-
# Table name: pwb_price_guesses
10-
#
11-
# id :uuid not null, primary key
12-
# listing_type :string not null (Pwb::SaleListing or Pwb::RentalListing)
13-
# listing_id :uuid not null
14-
# website_id :integer not null
15-
# visitor_token :string not null
16-
# guessed_price_cents :bigint not null
17-
# guessed_price_currency :string default("EUR")
18-
# actual_price_cents :bigint not null
19-
# actual_price_currency :string default("EUR")
20-
# percentage_diff :decimal(8, 2)
21-
# score :integer default(0)
22-
# created_at :datetime not null
23-
# updated_at :datetime not null
24-
#
7+
# == Schema Information
8+
#
9+
# Table name: pwb_price_guesses
10+
#
11+
# id :uuid not null, primary key
12+
# actual_price_cents :bigint not null
13+
# actual_price_currency :string default("EUR")
14+
# guessed_price_cents :bigint not null
15+
# guessed_price_currency :string default("EUR")
16+
# listing_type :string not null
17+
# percentage_diff :decimal(8, 2)
18+
# score :integer default(0)
19+
# visitor_token :string not null
20+
# created_at :datetime not null
21+
# updated_at :datetime not null
22+
# listing_id :uuid not null
23+
# website_id :bigint not null
24+
#
25+
# Indexes
26+
#
27+
# index_price_guesses_on_listing_and_score (listing_type,listing_id,score)
28+
# index_price_guesses_on_listing_and_visitor (listing_type,listing_id,visitor_token) UNIQUE
29+
# index_pwb_price_guesses_on_listing (listing_type,listing_id)
30+
# index_pwb_price_guesses_on_website_id (website_id)
31+
#
32+
# Foreign Keys
33+
#
34+
# fk_rails_... (website_id => pwb_websites.id)
35+
#
2536
class PriceGuess < ApplicationRecord
2637
self.table_name = "pwb_price_guesses"
2738

app/models/pwb/search_filter_option.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,39 @@ module Pwb
2020
#
2121
# @example Mapping to external provider
2222
# option.external_mapping_for('resales_online') # => "1-1"
23+
# == Schema Information
24+
#
25+
# Table name: pwb_search_filter_options
26+
#
27+
# id :bigint not null, primary key
28+
# external_code :string
29+
# filter_type :string not null
30+
# global_key :string not null
31+
# icon :string
32+
# metadata :jsonb not null
33+
# show_in_search :boolean default(TRUE), not null
34+
# sort_order :integer default(0), not null
35+
# translations :jsonb not null
36+
# visible :boolean default(TRUE), not null
37+
# created_at :datetime not null
38+
# updated_at :datetime not null
39+
# parent_id :bigint
40+
# website_id :bigint not null
41+
#
42+
# Indexes
43+
#
44+
# index_pwb_search_filter_options_on_parent_id (parent_id)
45+
# index_pwb_search_filter_options_on_website_id (website_id)
46+
# index_search_filter_options_on_external_code (website_id,external_code) WHERE (external_code IS NOT NULL)
47+
# index_search_filter_options_on_order (website_id,filter_type,sort_order)
48+
# index_search_filter_options_on_type (website_id,filter_type)
49+
# index_search_filter_options_unique_key (website_id,filter_type,global_key) UNIQUE
50+
#
51+
# Foreign Keys
52+
#
53+
# fk_rails_... (parent_id => pwb_search_filter_options.id)
54+
# fk_rails_... (website_id => pwb_websites.id)
55+
#
2356
#
2457
class SearchFilterOption < ApplicationRecord
2558
extend Mobility

spec/models/pwb/price_guess_spec.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# frozen_string_literal: true
22

3+
# == Schema Information
4+
#
5+
# Table name: pwb_price_guesses
6+
#
7+
# id :uuid not null, primary key
8+
# actual_price_cents :bigint not null
9+
# actual_price_currency :string default("EUR")
10+
# guessed_price_cents :bigint not null
11+
# guessed_price_currency :string default("EUR")
12+
# listing_type :string not null
13+
# percentage_diff :decimal(8, 2)
14+
# score :integer default(0)
15+
# visitor_token :string not null
16+
# created_at :datetime not null
17+
# updated_at :datetime not null
18+
# listing_id :uuid not null
19+
# website_id :bigint not null
20+
#
21+
# Indexes
22+
#
23+
# index_price_guesses_on_listing_and_score (listing_type,listing_id,score)
24+
# index_price_guesses_on_listing_and_visitor (listing_type,listing_id,visitor_token) UNIQUE
25+
# index_pwb_price_guesses_on_listing (listing_type,listing_id)
26+
# index_pwb_price_guesses_on_website_id (website_id)
27+
#
28+
# Foreign Keys
29+
#
30+
# fk_rails_... (website_id => pwb_websites.id)
31+
#
332
require "rails_helper"
433

534
RSpec.describe Pwb::PriceGuess, type: :model do

spec/models/pwb/search_filter_option_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# frozen_string_literal: true
22

3+
# == Schema Information
4+
#
5+
# Table name: pwb_search_filter_options
6+
#
7+
# id :bigint not null, primary key
8+
# external_code :string
9+
# filter_type :string not null
10+
# global_key :string not null
11+
# icon :string
12+
# metadata :jsonb not null
13+
# show_in_search :boolean default(TRUE), not null
14+
# sort_order :integer default(0), not null
15+
# translations :jsonb not null
16+
# visible :boolean default(TRUE), not null
17+
# created_at :datetime not null
18+
# updated_at :datetime not null
19+
# parent_id :bigint
20+
# website_id :bigint not null
21+
#
22+
# Indexes
23+
#
24+
# index_pwb_search_filter_options_on_parent_id (parent_id)
25+
# index_pwb_search_filter_options_on_website_id (website_id)
26+
# index_search_filter_options_on_external_code (website_id,external_code) WHERE (external_code IS NOT NULL)
27+
# index_search_filter_options_on_order (website_id,filter_type,sort_order)
28+
# index_search_filter_options_on_type (website_id,filter_type)
29+
# index_search_filter_options_unique_key (website_id,filter_type,global_key) UNIQUE
30+
#
31+
# Foreign Keys
32+
#
33+
# fk_rails_... (parent_id => pwb_search_filter_options.id)
34+
# fk_rails_... (website_id => pwb_websites.id)
35+
#
336
require 'rails_helper'
437

538
module Pwb

0 commit comments

Comments
 (0)