feat: New APIs for search (#6564)
- Adding new API endpoints for search - Migrations to add appropriate indexes
This commit is contained in:
28
app/controllers/api/v1/accounts/search_controller.rb
Normal file
28
app/controllers/api/v1/accounts/search_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class Api::V1::Accounts::SearchController < Api::V1::Accounts::BaseController
|
||||
def index
|
||||
@result = search('all')
|
||||
end
|
||||
|
||||
def conversations
|
||||
@result = search('Conversation')
|
||||
end
|
||||
|
||||
def contacts
|
||||
@result = search('Contact')
|
||||
end
|
||||
|
||||
def messages
|
||||
@result = search('Message')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def search(search_type)
|
||||
SearchService.new(
|
||||
current_user: Current.user,
|
||||
current_account: Current.account,
|
||||
search_type: search_type,
|
||||
params: params
|
||||
).perform
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user