* Add Search::Postgres::User * Add sorting params * Use a better algorithm to filter out suspended users * Add tsvector index on users.name * Add specs * Add UserRole spec * Update spec/services/search/postgres/user_spec.rb Co-authored-by: Michael Kohl <citizen428@dev.to> * Fix search with quotes in users's names Co-authored-by: Michael Kohl <citizen428@dev.to>
17 lines
467 B
Ruby
17 lines
467 B
Ruby
module Search
|
|
# to be renamed when ES is gone
|
|
class PostgresUserSerializer < ApplicationSerializer
|
|
attribute :class_name, -> { "User" }
|
|
attributes :id, :path
|
|
attribute :title, &:name
|
|
|
|
attribute :user do |user|
|
|
{
|
|
# currently the frontend expects this to be the username, despite the attribute name
|
|
name: user.username,
|
|
profile_image_90: user.profile_image_90,
|
|
username: user.username
|
|
}
|
|
end
|
|
end
|
|
end
|