feat: New APIs for search (#6564)

- Adding new API endpoints for search
- Migrations to add appropriate indexes
This commit is contained in:
Sojan Jose
2023-02-28 22:00:36 +05:30
committed by GitHub
parent 9bd47588fc
commit d4e7eaecce
18 changed files with 423 additions and 5 deletions

View 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