Add coverage for api/v1/peers/search
endpoint and extract controller query to Instance scope (#28796)
This commit is contained in:
parent
2115bc52e4
commit
0b853678a4
3 changed files with 71 additions and 4 deletions
|
@ -23,6 +23,7 @@ class Instance < ApplicationRecord
|
|||
|
||||
scope :searchable, -> { where.not(domain: DomainBlock.select(:domain)) }
|
||||
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
||||
scope :domain_starts_with, ->(value) { where(arel_table[:domain].matches("#{sanitize_sql_like(value)}%", false, true)) }
|
||||
scope :by_domain_and_subdomains, ->(domain) { where("reverse('.' || domain) LIKE reverse(?)", "%.#{domain}") }
|
||||
|
||||
def self.refresh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue