feat: Add API to get the active contacts (#1313)
This commit is contained in:
@@ -8,6 +8,12 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController
|
||||
@contacts = Current.account.contacts
|
||||
end
|
||||
|
||||
# returns online contacts
|
||||
def active
|
||||
@contacts = Current.account.contacts.where(id: ::OnlineStatusTracker
|
||||
.get_available_contact_ids(Current.account.id))
|
||||
end
|
||||
|
||||
def show; end
|
||||
|
||||
def create
|
||||
|
||||
@@ -3,6 +3,10 @@ class ContactPolicy < ApplicationPolicy
|
||||
true
|
||||
end
|
||||
|
||||
def active?
|
||||
true
|
||||
end
|
||||
|
||||
def search?
|
||||
true
|
||||
end
|
||||
|
||||
5
app/views/api/v1/accounts/contacts/active.json.jbuilder
Normal file
5
app/views/api/v1/accounts/contacts/active.json.jbuilder
Normal file
@@ -0,0 +1,5 @@
|
||||
json.payload do
|
||||
json.array! @contacts do |contact|
|
||||
json.partial! 'api/v1/models/contact.json.jbuilder', resource: contact, with_contact_inboxes: true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user