-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/docker-compose
- Loading branch information
Showing
15 changed files
with
156 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.car-card { | ||
border-radius: 20px; | ||
border-radius: 200px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# frozen_string_literal: true | ||
|
||
module Cars | ||
class Searcher | ||
include Interactor | ||
def call | ||
search_by_make | ||
search_by_model | ||
search_by_year_from | ||
search_by_year_to | ||
search_by_price_from | ||
search_by_price_to | ||
|
||
context.cars | ||
end | ||
|
||
private | ||
|
||
def search_by_make | ||
return context.cars if context.params['make'].blank? | ||
|
||
context.cars = context.cars.filter_by_make(context.params['make']) | ||
end | ||
|
||
def search_by_model | ||
return context.cars if context.params['model'].blank? | ||
|
||
context.cars = context.cars.filter_by_model(context.params['model']) | ||
end | ||
|
||
def search_by_year_from | ||
return context.cars if context.params['year_from'].blank? | ||
|
||
context.cars = context.cars.filter_by_year_from(context.params['year_from'].to_i) | ||
end | ||
|
||
def search_by_year_to | ||
return context.cars if context.params['year_to'].blank? | ||
|
||
context.cars = context.cars.filter_by_year_to(context.params['year_to'].to_i) | ||
end | ||
|
||
def search_by_price_from | ||
return context.cars if context.params['price_from'].blank? | ||
|
||
context.cars = context.cars.filter_by_price_from(context.params['price_from'].to_i) | ||
end | ||
|
||
def search_by_price_to | ||
return context.cars if context.params['price_to'].blank? | ||
|
||
context.cars = context.cars.filter_by_price_to(context.params['price_to'].to_i) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Cars | ||
class Sorter | ||
include Interactor | ||
|
||
attr_reader :data | ||
|
||
def call | ||
context.cars = context.cars.filter_sort_by(context.params) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class User < ApplicationRecord | ||
has_many :searches, dependent: :delete_all | ||
|
||
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP } | ||
validates :password, length: { within: 8..128 } | ||
|
||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :validatable | ||
|
||
validates :email, presence: true | ||
validates :email, uniqueness: true | ||
|
||
has_many :searches, dependent: :delete_all | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.